diff options
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index bcd5d3e17b85..abcc7e24c365 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1985,8 +1985,8 @@ static int annotated_source__addr_fmt_width(struct list_head *lines, u64 start) | |||
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | int symbol__annotate_printf(struct symbol *sym, struct map *map, | 1987 | int symbol__annotate_printf(struct symbol *sym, struct map *map, |
1988 | struct perf_evsel *evsel, bool full_paths, | 1988 | struct perf_evsel *evsel, |
1989 | int min_pcnt, int max_lines, int context) | 1989 | struct annotation_options *opts) |
1990 | { | 1990 | { |
1991 | struct dso *dso = map->dso; | 1991 | struct dso *dso = map->dso; |
1992 | char *filename; | 1992 | char *filename; |
@@ -1998,6 +1998,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
1998 | u64 start = map__rip_2objdump(map, sym->start); | 1998 | u64 start = map__rip_2objdump(map, sym->start); |
1999 | int printed = 2, queue_len = 0, addr_fmt_width; | 1999 | int printed = 2, queue_len = 0, addr_fmt_width; |
2000 | int more = 0; | 2000 | int more = 0; |
2001 | bool context = opts->context; | ||
2001 | u64 len; | 2002 | u64 len; |
2002 | int width = symbol_conf.show_total_period ? 12 : 8; | 2003 | int width = symbol_conf.show_total_period ? 12 : 8; |
2003 | int graph_dotted_len; | 2004 | int graph_dotted_len; |
@@ -2007,7 +2008,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
2007 | if (!filename) | 2008 | if (!filename) |
2008 | return -ENOMEM; | 2009 | return -ENOMEM; |
2009 | 2010 | ||
2010 | if (full_paths) | 2011 | if (opts->full_path) |
2011 | d_filename = filename; | 2012 | d_filename = filename; |
2012 | else | 2013 | else |
2013 | d_filename = basename(filename); | 2014 | d_filename = basename(filename); |
@@ -2042,7 +2043,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
2042 | } | 2043 | } |
2043 | 2044 | ||
2044 | err = annotation_line__print(pos, sym, start, evsel, len, | 2045 | err = annotation_line__print(pos, sym, start, evsel, len, |
2045 | min_pcnt, printed, max_lines, | 2046 | opts->min_pcnt, printed, opts->max_lines, |
2046 | queue, addr_fmt_width); | 2047 | queue, addr_fmt_width); |
2047 | 2048 | ||
2048 | switch (err) { | 2049 | switch (err) { |
@@ -2375,20 +2376,19 @@ static void symbol__calc_lines(struct symbol *sym, struct map *map, | |||
2375 | } | 2376 | } |
2376 | 2377 | ||
2377 | int symbol__tty_annotate2(struct symbol *sym, struct map *map, | 2378 | int symbol__tty_annotate2(struct symbol *sym, struct map *map, |
2378 | struct perf_evsel *evsel, bool print_lines, | 2379 | struct perf_evsel *evsel, |
2379 | bool full_paths) | 2380 | struct annotation_options *opts) |
2380 | { | 2381 | { |
2381 | struct dso *dso = map->dso; | 2382 | struct dso *dso = map->dso; |
2382 | struct rb_root source_line = RB_ROOT; | 2383 | struct rb_root source_line = RB_ROOT; |
2383 | struct annotation_options opts = annotation__default_options; | ||
2384 | struct annotation *notes = symbol__annotation(sym); | 2384 | struct annotation *notes = symbol__annotation(sym); |
2385 | char buf[1024]; | 2385 | char buf[1024]; |
2386 | 2386 | ||
2387 | if (symbol__annotate2(sym, map, evsel, &opts, NULL) < 0) | 2387 | if (symbol__annotate2(sym, map, evsel, opts, NULL) < 0) |
2388 | return -1; | 2388 | return -1; |
2389 | 2389 | ||
2390 | if (print_lines) { | 2390 | if (opts->print_lines) { |
2391 | srcline_full_filename = full_paths; | 2391 | srcline_full_filename = opts->full_path; |
2392 | symbol__calc_lines(sym, map, &source_line); | 2392 | symbol__calc_lines(sym, map, &source_line); |
2393 | print_summary(&source_line, dso->long_name); | 2393 | print_summary(&source_line, dso->long_name); |
2394 | } | 2394 | } |
@@ -2403,8 +2403,8 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map, | |||
2403 | } | 2403 | } |
2404 | 2404 | ||
2405 | int symbol__tty_annotate(struct symbol *sym, struct map *map, | 2405 | int symbol__tty_annotate(struct symbol *sym, struct map *map, |
2406 | struct perf_evsel *evsel, bool print_lines, | 2406 | struct perf_evsel *evsel, |
2407 | bool full_paths, int min_pcnt, int max_lines) | 2407 | struct annotation_options *opts) |
2408 | { | 2408 | { |
2409 | struct dso *dso = map->dso; | 2409 | struct dso *dso = map->dso; |
2410 | struct rb_root source_line = RB_ROOT; | 2410 | struct rb_root source_line = RB_ROOT; |
@@ -2414,14 +2414,13 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, | |||
2414 | 2414 | ||
2415 | symbol__calc_percent(sym, evsel); | 2415 | symbol__calc_percent(sym, evsel); |
2416 | 2416 | ||
2417 | if (print_lines) { | 2417 | if (opts->print_lines) { |
2418 | srcline_full_filename = full_paths; | 2418 | srcline_full_filename = opts->full_path; |
2419 | symbol__calc_lines(sym, map, &source_line); | 2419 | symbol__calc_lines(sym, map, &source_line); |
2420 | print_summary(&source_line, dso->long_name); | 2420 | print_summary(&source_line, dso->long_name); |
2421 | } | 2421 | } |
2422 | 2422 | ||
2423 | symbol__annotate_printf(sym, map, evsel, full_paths, | 2423 | symbol__annotate_printf(sym, map, evsel, opts); |
2424 | min_pcnt, max_lines, 0); | ||
2425 | 2424 | ||
2426 | annotated_source__purge(symbol__annotation(sym)->src); | 2425 | annotated_source__purge(symbol__annotation(sym)->src); |
2427 | 2426 | ||