aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-06-08 02:24:07 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-06-08 02:24:07 -0400
commita292241cccb7e20e8b997a9a44177e7c98141859 (patch)
treea0b0bb95e7dce3233a2d8b203f9e326cdec7a00e /tools/perf/util/annotate.c
parentd49cb7aeebb974713f9f7ab2991352d3050b095b (diff)
parent68807a0c2015cb40df4869e16651f0ce5cc14d52 (diff)
Merge branch 'next' into for-linus
Prepare input updates for 3.16.
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 469eb679fb9d..809b4c50beae 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -8,6 +8,8 @@
8 */ 8 */
9 9
10#include "util.h" 10#include "util.h"
11#include "ui/ui.h"
12#include "sort.h"
11#include "build-id.h" 13#include "build-id.h"
12#include "color.h" 14#include "color.h"
13#include "cache.h" 15#include "cache.h"
@@ -489,7 +491,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
489{ 491{
490 struct annotation *notes; 492 struct annotation *notes;
491 493
492 if (sym == NULL || use_browser != 1 || !sort__has_sym) 494 if (sym == NULL)
493 return 0; 495 return 0;
494 496
495 notes = symbol__annotation(sym); 497 notes = symbol__annotation(sym);
@@ -1234,6 +1236,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
1234 struct dso *dso = map->dso; 1236 struct dso *dso = map->dso;
1235 char *filename; 1237 char *filename;
1236 const char *d_filename; 1238 const char *d_filename;
1239 const char *evsel_name = perf_evsel__name(evsel);
1237 struct annotation *notes = symbol__annotation(sym); 1240 struct annotation *notes = symbol__annotation(sym);
1238 struct disasm_line *pos, *queue = NULL; 1241 struct disasm_line *pos, *queue = NULL;
1239 u64 start = map__rip_2objdump(map, sym->start); 1242 u64 start = map__rip_2objdump(map, sym->start);
@@ -1241,7 +1244,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
1241 int more = 0; 1244 int more = 0;
1242 u64 len; 1245 u64 len;
1243 int width = 8; 1246 int width = 8;
1244 int namelen; 1247 int namelen, evsel_name_len, graph_dotted_len;
1245 1248
1246 filename = strdup(dso->long_name); 1249 filename = strdup(dso->long_name);
1247 if (!filename) 1250 if (!filename)
@@ -1254,14 +1257,17 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
1254 1257
1255 len = symbol__size(sym); 1258 len = symbol__size(sym);
1256 namelen = strlen(d_filename); 1259 namelen = strlen(d_filename);
1260 evsel_name_len = strlen(evsel_name);
1257 1261
1258 if (perf_evsel__is_group_event(evsel)) 1262 if (perf_evsel__is_group_event(evsel))
1259 width *= evsel->nr_members; 1263 width *= evsel->nr_members;
1260 1264
1261 printf(" %-*.*s| Source code & Disassembly of %s\n", 1265 printf(" %-*.*s| Source code & Disassembly of %s for %s\n",
1262 width, width, "Percent", d_filename); 1266 width, width, "Percent", d_filename, evsel_name);
1263 printf("-%-*.*s-------------------------------------\n", 1267
1264 width+namelen, width+namelen, graph_dotted_line); 1268 graph_dotted_len = width + namelen + evsel_name_len;
1269 printf("-%-*.*s-----------------------------------------\n",
1270 graph_dotted_len, graph_dotted_len, graph_dotted_line);
1265 1271
1266 if (verbose) 1272 if (verbose)
1267 symbol__annotate_hits(sym, evsel); 1273 symbol__annotate_hits(sym, evsel);
@@ -1399,3 +1405,8 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize)
1399{ 1405{
1400 return symbol__annotate(he->ms.sym, he->ms.map, privsize); 1406 return symbol__annotate(he->ms.sym, he->ms.map, privsize);
1401} 1407}
1408
1409bool ui__has_annotation(void)
1410{
1411 return use_browser == 1 && sort__has_sym;
1412}