perf ui browser: Add 's' key to filter by symbol name
authorNamhyung Kim <namhyung.kim@lge.com>
Fri, 16 Mar 2012 08:50:53 +0000 (17:50 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 16 Mar 2012 19:34:13 +0000 (16:34 -0300)
Now user can enter symbol name interested via ui_browser__input_window,
and perf can process it using hists__filter_by_symbol(). Giving empty
symbol (by pressing 's' followed by ENTER) will disable the filtering.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1331887855-874-3-git-send-email-namhyung.kim@lge.com
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/ui/browsers/hists.c

index de8ece8bcce30598b104c0e2cb0738093be25c43..c4173c9733bbf44d5e152a9514be49d2475eea92 100644 (file)
@@ -879,6 +879,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
        char *options[16];
        int nr_options = 0;
        int key = -1;
+       char buf[64];
 
        if (browser == NULL)
                return -1;
@@ -933,6 +934,16 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
                        goto zoom_dso;
                case 't':
                        goto zoom_thread;
+               case 's':
+                       if (ui_browser__input_window("Symbol to show",
+                                       "Please enter the name of symbol you want to see",
+                                       buf, "ENTER: OK, ESC: Cancel",
+                                       delay_secs * 2) == K_ENTER) {
+                               self->symbol_filter_str = *buf ? buf : NULL;
+                               hists__filter_by_symbol(self);
+                               hist_browser__reset(browser);
+                       }
+                       continue;
                case K_F1:
                case 'h':
                case '?':
@@ -950,7 +961,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
                                        "C             Collapse all callchains\n"
                                        "E             Expand all callchains\n"
                                        "d             Zoom into current DSO\n"
-                                       "t             Zoom into current Thread");
+                                       "t             Zoom into current Thread\n"
+                                       "s             Filter symbol by name");
                        continue;
                case K_ENTER:
                case K_RIGHT: