perf annotate: Put dso name in symbol annotation title
authorAdrian Hunter <[email protected]>
Wed, 7 Aug 2013 11:38:55 +0000 (14:38 +0300)
committerArnaldo Carvalho de Melo <[email protected]>
Wed, 7 Aug 2013 20:35:35 +0000 (17:35 -0300)
Currently the symbol name is displayed at the top when displaying symbol
annotation.  Add to this the dso long name.

Suggested-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/ui/browsers/annotate.c

index cc64d3f7fc36e37b490f7e8501239a3ffa2cdd2d..0f88a77788fa250b9c020d811fb219b9f77f76e9 100644 (file)
@@ -428,6 +428,14 @@ static void annotate_browser__init_asm_mode(struct annotate_browser *browser)
        browser->b.nr_entries = browser->nr_asm_entries;
 }
 
+#define SYM_TITLE_MAX_SIZE (PATH_MAX + 64)
+
+static int sym_title(struct symbol *sym, struct map *map, char *title,
+                    size_t sz)
+{
+       return snprintf(title, sz, "%s  %s", sym->name, map->dso->long_name);
+}
+
 static bool annotate_browser__callq(struct annotate_browser *browser,
                                    struct perf_evsel *evsel,
                                    struct hist_browser_timer *hbt)
@@ -438,6 +446,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
        struct annotation *notes;
        struct symbol *target;
        u64 ip;
+       char title[SYM_TITLE_MAX_SIZE];
 
        if (!ins__is_call(dl->ins))
                return false;
@@ -461,7 +470,8 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
 
        pthread_mutex_unlock(&notes->lock);
        symbol__tui_annotate(target, ms->map, evsel, hbt);
-       ui_browser__show_title(&browser->b, sym->name);
+       sym_title(sym, ms->map, title, sizeof(title));
+       ui_browser__show_title(&browser->b, title);
        return true;
 }
 
@@ -653,8 +663,10 @@ static int annotate_browser__run(struct annotate_browser *browser,
        const char *help = "Press 'h' for help on key bindings";
        int delay_secs = hbt ? hbt->refresh : 0;
        int key;
+       char title[SYM_TITLE_MAX_SIZE];
 
-       if (ui_browser__show(&browser->b, sym->name, help) < 0)
+       sym_title(sym, ms->map, title, sizeof(title));
+       if (ui_browser__show(&browser->b, title, help) < 0)
                return -1;
 
        annotate_browser__calc_percent(browser, evsel);