]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
perf tools: Remove dependency on libnewt
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 28 Mar 2013 14:34:10 +0000 (11:34 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 1 Apr 2013 15:23:21 +0000 (12:23 -0300)
Now that the map browser shares the input routine with the hists
browser, there is no need for using any libnewt routine, so remove all
traces except for honouring NO_NEWT=1 on the makefile command line as an
indication that TUI support is not needed, in fact it just sets
NO_SLANG=1.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-wae5o7xca9m52bj1re28jc5j@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
12 files changed:
tools/perf/Makefile
tools/perf/builtin-report.c
tools/perf/config/feature-tests.mak
tools/perf/ui/browser.c
tools/perf/ui/browser.h
tools/perf/ui/browsers/annotate.c
tools/perf/ui/browsers/hists.c
tools/perf/ui/browsers/scripts.c
tools/perf/ui/tui/setup.c
tools/perf/ui/ui.h
tools/perf/util/annotate.h
tools/perf/util/hist.h

index 8b4c9529e22a58aef77b1df7efbf4b93a3f62da3..b0f164b133d9bd2b749290851a5d3bddf4a86688 100644 (file)
@@ -35,7 +35,9 @@ include config/utilities.mak
 #
 # Define WERROR=0 to disable treating any warnings as errors.
 #
-# Define NO_NEWT if you do not want TUI support.
+# Define NO_NEWT if you do not want TUI support. (deprecated)
+#
+# Define NO_SLANG if you do not want TUI support.
 #
 # Define NO_GTK2 if you do not want GTK+ GUI support.
 #
@@ -104,6 +106,10 @@ ifdef PARSER_DEBUG
        PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
 endif
 
+ifdef NO_NEWT
+       NO_SLANG=1
+endif
+
 CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
 EXTLIBS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
@@ -680,15 +686,15 @@ ifndef NO_LIBAUDIT
        endif
 endif
 
-ifndef NO_NEWT
-       FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
-       ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT),libnewt),y)
-               msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
+ifndef NO_SLANG
+       FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
+       ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
+               msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
        else
                # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
                BASIC_CFLAGS += -I/usr/include/slang
-               BASIC_CFLAGS += -DNEWT_SUPPORT
-               EXTLIBS += -lnewt -lslang
+               BASIC_CFLAGS += -DSLANG_SUPPORT
+               EXTLIBS += -lslang
                LIB_OBJS += $(OUTPUT)ui/browser.o
                LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
                LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
index a20550c9cd68515f2419e6ddb5147957dc5c7f91..bd0ca81eeaca9616277e4af6c30a8be892b0eb45 100644 (file)
@@ -111,7 +111,7 @@ static int perf_report__add_mem_hist_entry(struct perf_tool *tool,
                return -ENOMEM;
 
        /*
-        * In the newt browser, we are doing integrated annotation,
+        * In the TUI browser, we are doing integrated annotation,
         * so we don't allocate the extra space needed because the stdio
         * code will not use it.
         */
@@ -263,7 +263,7 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel,
                        return err;
        }
        /*
-        * Only in the newt browser we are doing integrated annotation,
+        * Only in the TUI browser we are doing integrated annotation,
         * so we don't allocated the extra space needed because the stdio
         * code will not use it.
         */
@@ -877,7 +877,7 @@ repeat:
                usage_with_options(report_usage, options);
 
        /*
-        * Only in the newt browser we are doing integrated annotation,
+        * Only in the TUI browser we are doing integrated annotation,
         * so don't allocate extra space that won't be used in the stdio
         * implementation.
         */
index b4eabb44e381c8d74f95362fb6ece61bdc32bf50..708fb8e9822a3ed43bd192470c5da6f01c236c38 100644 (file)
@@ -61,15 +61,13 @@ int main(void)
 }
 endef
 
-ifndef NO_NEWT
-define SOURCE_NEWT
-#include <newt.h>
+ifndef NO_SLANG
+define SOURCE_SLANG
+#include <slang.h>
 
 int main(void)
 {
-       newtInit();
-       newtCls();
-       return newtFinished();
+       return SLsmg_init_smg();
 }
 endef
 endif
@@ -235,4 +233,4 @@ int main(void)
        numa_available();
        return 0;
 }
-endef
\ No newline at end of file
+endef
index 809ea4632a34fc0f90e766eb3cf16175904cbefa..bbc782e364b0831f04b12ce417b22ae6b5948b16 100644 (file)
@@ -2,7 +2,6 @@
 #include "../cache.h"
 #include "../../perf.h"
 #include "libslang.h"
-#include <newt.h>
 #include "ui.h"
 #include "util.h"
 #include <linux/compiler.h>
@@ -234,7 +233,7 @@ void ui_browser__reset_index(struct ui_browser *browser)
 void __ui_browser__show_title(struct ui_browser *browser, const char *title)
 {
        SLsmg_gotorc(0, 0);
-       ui_browser__set_color(browser, NEWT_COLORSET_ROOT);
+       ui_browser__set_color(browser, HE_COLORSET_ROOT);
        slsmg_write_nstring(title, browser->width + 1);
 }
 
@@ -513,6 +512,12 @@ static struct ui_browser_colorset {
                .fg       = "magenta",
                .bg       = "default",
        },
+       {
+               .colorset = HE_COLORSET_ROOT,
+               .name     = "root",
+               .fg       = "white",
+               .bg       = "blue",
+       },
        {
                .name = NULL,
        }
index af70314605e54e2468fe774822cdeecd2945cc7c..404ff66a3e367a84e67c4b0896a28318b829e867 100644 (file)
@@ -11,6 +11,7 @@
 #define HE_COLORSET_SELECTED   53
 #define HE_COLORSET_CODE       54
 #define HE_COLORSET_ADDR       55
+#define HE_COLORSET_ROOT       56
 
 struct ui_browser {
        u64           index, top_idx;
index f56247a03a228dbd80632ff5da43fd492a57da87..cc64d3f7fc36e37b490f7e8501239a3ffa2cdd2d 100644 (file)
@@ -10,7 +10,6 @@
 #include "../../util/symbol.h"
 #include "../../util/evsel.h"
 #include <pthread.h>
-#include <newt.h>
 
 struct browser_disasm_line {
        struct rb_node  rb_node;
index a5843fd6ab5106493e464853c8da5fde205f7cbd..d88a2d0acb6dd119fb0346ddacb8c412fc620689 100644 (file)
@@ -2,7 +2,6 @@
 #include "../libslang.h"
 #include <stdlib.h>
 #include <string.h>
-#include <newt.h>
 #include <linux/rbtree.h>
 
 #include "../../util/evsel.h"
index cbbd44b0d93e025a93ab892d9259b3c58b2feb69..12f009e61e94a7c60a6b2dbb1a9a959b690b9ad1 100644 (file)
@@ -1,5 +1,4 @@
 #include <elf.h>
-#include <newt.h>
 #include <inttypes.h>
 #include <sys/ttydefaults.h>
 #include <string.h>
index 81efa192e86c4860b0062b923ef2c015f62da5be..b9401482d110bad0f5d39946c04b881cd9b779d9 100644 (file)
@@ -1,4 +1,3 @@
-#include <newt.h>
 #include <signal.h>
 #include <stdbool.h>
 
@@ -88,13 +87,6 @@ int ui__getch(int delay_secs)
        return SLkp_getkey();
 }
 
-static void newt_suspend(void *d __maybe_unused)
-{
-       newtSuspend();
-       raise(SIGTSTP);
-       newtResume();
-}
-
 static void ui__signal(int sig)
 {
        ui__exit(false);
@@ -106,7 +98,17 @@ int ui__init(void)
 {
        int err;
 
-       newtInit();
+       SLutf8_enable(-1);
+       SLtt_get_terminfo();
+       SLtt_get_screen_size();
+
+       err = SLsmg_init_smg();
+       if (err < 0)
+               goto out;
+       err = SLang_init_tty(0, 0, 0);
+       if (err < 0)
+               goto out;
+
        err = SLkp_init();
        if (err < 0) {
                pr_err("TUI initialization failed.\n");
@@ -115,7 +117,6 @@ int ui__init(void)
 
        SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB);
 
-       newtSetSuspendCallback(newt_suspend, NULL);
        ui_helpline__init();
        ui_browser__init();
        ui_progress__init();
index d86359c99907b1bbe9140a989e0f8a55c453508a..70cb0d4eb8aa390c008a4d84c575662c2515280d 100644 (file)
@@ -12,7 +12,7 @@ extern int use_browser;
 void setup_browser(bool fallback_to_pager);
 void exit_browser(bool wait_for_ok);
 
-#ifdef NEWT_SUPPORT
+#ifdef SLANG_SUPPORT
 int ui__init(void);
 void ui__exit(bool wait_for_ok);
 #else
index 6f3c16f01ab412292ceba16d941b8f612486dafa..af755156d2785b7963d834adcd5e1ee3cc07b4be 100644 (file)
@@ -150,7 +150,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
                         struct perf_evsel *evsel, bool print_lines,
                         bool full_paths, int min_pcnt, int max_lines);
 
-#ifdef NEWT_SUPPORT
+#ifdef SLANG_SUPPORT
 int symbol__tui_annotate(struct symbol *sym, struct map *map,
                         struct perf_evsel *evsel,
                         struct hist_browser_timer *hbt);
index fd6313416476e38d871ff72916b3849b9fc6ab1b..14c2fe20aa628cc53fc969d69ebc9466ca4274f2 100644 (file)
@@ -192,7 +192,7 @@ struct hist_browser_timer {
        int refresh;
 };
 
-#ifdef NEWT_SUPPORT
+#ifdef SLANG_SUPPORT
 #include "../ui/keysyms.h"
 int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
                             struct hist_browser_timer *hbt);