aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-08-04 09:05:13 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-08-08 14:55:50 -0400
commit796ca33d5ceb621f238021c34cff8cfaa1100623 (patch)
tree1a8db3c6c68f6642adff116a0cc4fda98195f024 /tools/perf/util/annotate.c
parente58684df912906d944967e2ce0f3ed5d5140d1e5 (diff)
perf annotate: Add percent_type to struct annotation_options
It will be used to carry user selection of percent type for annotation output. Passing the percent_type to the annotation_line__print function as the first step and making it default to current percentage type (PERCENT_HITS_LOCAL) value. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20180804130521.11408-13-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index e890164592b0..91528a065768 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -49,6 +49,7 @@ struct annotation_options annotation__default_options = {
49 .jump_arrows = true, 49 .jump_arrows = true,
50 .annotate_src = true, 50 .annotate_src = true,
51 .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, 51 .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS,
52 .percent_type = PERCENT_HITS_LOCAL,
52}; 53};
53 54
54static regex_t file_lineno; 55static regex_t file_lineno;
@@ -1297,7 +1298,8 @@ static int disasm_line__print(struct disasm_line *dl, u64 start, int addr_fmt_wi
1297static int 1298static int
1298annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start, 1299annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start,
1299 struct perf_evsel *evsel, u64 len, int min_pcnt, int printed, 1300 struct perf_evsel *evsel, u64 len, int min_pcnt, int printed,
1300 int max_lines, struct annotation_line *queue, int addr_fmt_width) 1301 int max_lines, struct annotation_line *queue, int addr_fmt_width,
1302 int percent_type)
1301{ 1303{
1302 struct disasm_line *dl = container_of(al, struct disasm_line, al); 1304 struct disasm_line *dl = container_of(al, struct disasm_line, al);
1303 static const char *prev_line; 1305 static const char *prev_line;
@@ -1313,7 +1315,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start
1313 double percent; 1315 double percent;
1314 1316
1315 percent = annotation_data__percent(&al->data[i], 1317 percent = annotation_data__percent(&al->data[i],
1316 PERCENT_HITS_LOCAL); 1318 percent_type);
1317 1319
1318 if (percent > max_percent) 1320 if (percent > max_percent)
1319 max_percent = percent; 1321 max_percent = percent;
@@ -1333,7 +1335,8 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start
1333 if (queue == al) 1335 if (queue == al)
1334 break; 1336 break;
1335 annotation_line__print(queue, sym, start, evsel, len, 1337 annotation_line__print(queue, sym, start, evsel, len,
1336 0, 0, 1, NULL, addr_fmt_width); 1338 0, 0, 1, NULL, addr_fmt_width,
1339 percent_type);
1337 } 1340 }
1338 } 1341 }
1339 1342
@@ -1357,7 +1360,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start
1357 struct annotation_data *data = &al->data[i]; 1360 struct annotation_data *data = &al->data[i];
1358 double percent; 1361 double percent;
1359 1362
1360 percent = annotation_data__percent(data, PERCENT_HITS_LOCAL); 1363 percent = annotation_data__percent(data, percent_type);
1361 color = get_percent_color(percent); 1364 color = get_percent_color(percent);
1362 1365
1363 if (symbol_conf.show_total_period) 1366 if (symbol_conf.show_total_period)
@@ -2075,7 +2078,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
2075 2078
2076 err = annotation_line__print(pos, sym, start, evsel, len, 2079 err = annotation_line__print(pos, sym, start, evsel, len,
2077 opts->min_pcnt, printed, opts->max_lines, 2080 opts->min_pcnt, printed, opts->max_lines,
2078 queue, addr_fmt_width); 2081 queue, addr_fmt_width, opts->percent_type);
2079 2082
2080 switch (err) { 2083 switch (err) {
2081 case 0: 2084 case 0: