Skip to contentSkip to conversation

perf ui: Move annotate browser to util/ui/browsers/

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Aug 11, 2010 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  211ef12771e759a08e10c3c606e6a8b1663519e7
Gitweb:     http://git.kernel.org/tip/211ef12771e759a08e10c3c606e6a8b1663519e7
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 10 Aug 2010 14:54:09 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 10 Aug 2010 16:09:41 -0300

perf ui: Move annotate browser to util/ui/browsers/

LKML-Reference: <new-submission>

---
 tools/perf/Makefile                    |    7 ++-
 tools/perf/util/debug.h                |    1 +
 tools/perf/util/newt.c                 |  132 +-------------------------------
 tools/perf/util/ui/browser.h           |    1 +
 tools/perf/util/ui/browsers/annotate.c |  114 +++++++++++++++++++++++++++
 tools/perf/util/ui/libslang.h          |   27 +++++++
 6 files changed, 151 insertions(+), 131 deletions(-)
tools/perf/Makefile +6 -1
index 528c914..ae443b6 100644
@@ -158,7 +158,7 @@ all::
 # Define NO_DWARF if you do not want debug-info analysis feature at all.
 
 $(shell sh -c 'mkdir -p $(OUTPUT)scripts/{perl,python}/Perf-Trace-Util/' 2> /dev/null)
-$(shell sh -c 'mkdir -p $(OUTPUT)util/{ui,scripting-engines}/' 2> /dev/null)
+$(shell sh -c 'mkdir -p $(OUTPUT)util/{ui/browsers,scripting-engines}/' 2> /dev/null)
 $(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null)
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@@ -569,10 +569,12 @@ else
 		EXTLIBS += -lnewt -lslang
 		LIB_OBJS += $(OUTPUT)util/newt.o
 		LIB_OBJS += $(OUTPUT)util/ui/browser.o
+		LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o
 		LIB_OBJS += $(OUTPUT)util/ui/helpline.o
 		LIB_OBJS += $(OUTPUT)util/ui/progress.o
 		LIB_H += util/ui/browser.h
 		LIB_H += util/ui/helpline.h
+		LIB_H += util/ui/libslang.h
 		LIB_H += util/ui/progress.h
 	endif
 endif
@@ -977,6 +979,9 @@ $(OUTPUT)util/newt.o: util/newt.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)util/ui/browser.o: util/ui/browser.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
+$(OUTPUT)util/ui/browsers/annotate.o: util/ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
tools/perf/util/debug.h +1 -0
index a929b06..ba4892e 100644
@@ -30,6 +30,7 @@ static inline void ui_progress__update(struct ui_progress *self __used,
 
 static inline void ui_progress__delete(struct ui_progress *self __used) {}
 #else
+extern char browser__last_msg[];
 int browser__show_help(const char *format, va_list ap);
 #include "ui/progress.h"
 #endif
tools/perf/util/newt.c +2 -130

162 lines not on this page · raw message

tools/perf/util/ui/browser.h +1 -0
index 8eed24c..856e343 100644
@@ -3,6 +3,7 @@
 
 #include <stdbool.h>
 #include <newt.h>
+#include <sys/types.h>
 #include "../types.h"
 
 #define HE_COLORSET_TOP		50
tools/perf/util/ui/browsers/annotate.c new file +114 -0

114 lines not on this page · raw message

tools/perf/util/ui/libslang.h new file +27 -0
new file mode 100644
index 0000000..5623da8
@@ -0,0 +1,27 @@
+#ifndef _PERF_UI_SLANG_H_
+#define _PERF_UI_SLANG_H_ 1
+/*
+ * slang versions <= 2.0.6 have a "#if HAVE_LONG_LONG" that breaks
+ * the build if it isn't defined. Use the equivalent one that glibc
+ * has on features.h.
+ */
+#include <features.h>
+#ifndef HAVE_LONG_LONG
+#define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG
+#endif
+#include <slang.h>
+
+#if SLANG_VERSION < 20104
+#define slsmg_printf(msg, args...) \
+	SLsmg_printf((char *)msg, ##args)
+#define slsmg_write_nstring(msg, len) \
+	SLsmg_write_nstring((char *)msg, len)
+#define sltt_set_color(obj, name, fg, bg) \
+	SLtt_set_color(obj,(char *)name, (char *)fg, (char *)bg)
+#else
+#define slsmg_printf SLsmg_printf
+#define slsmg_write_nstring SLsmg_write_nstring
+#define sltt_set_color SLtt_set_color
+#endif
+
+#endif /* _PERF_UI_SLANG_H_ */