Skip to content

Commit 05d3f1a

Browse files
olsajiriacmel
authored andcommitted
perf tools: Move symbol__calc_percent() call to outside symbol__disassemble()
We need to call symbol__calc_percent() periodicaly for top, so it's no longer convenient to keep it in symbol__disassemble(). Let's separate the symbol__disassemble() to allocate and init the symbol annotation structs and symbol__calc_percent() to compute the lines percentages based on symbol hists data. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-gtnp8t4tb00q6lag07psn5nq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 9e4e0a9 commit 05d3f1a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tools/perf/ui/browsers/annotate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
11261126
goto out_free_offsets;
11271127
}
11281128

1129+
symbol__calc_percent(sym, evsel);
1130+
11291131
ui_helpline__push("Press ESC to exit");
11301132

11311133
notes = symbol__annotation(sym);

tools/perf/ui/gtk/annotate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
177177
return -1;
178178
}
179179

180+
symbol__calc_percent(sym, evsel);
181+
180182
if (perf_gtk__is_active_context(pgctx)) {
181183
window = pgctx->main_window;
182184
notebook = pgctx->notebook;

tools/perf/util/annotate.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,12 +1653,7 @@ int symbol__annotate(struct symbol *sym, struct map *map,
16531653
}
16541654
}
16551655

1656-
err = symbol__disassemble(sym, &args);
1657-
if (!err)
1658-
symbol__calc_percent(sym, evsel);
1659-
1660-
return err;
1661-
1656+
return symbol__disassemble(sym, &args);
16621657
}
16631658

16641659
static void insert_source_line(struct rb_root *root, struct annotation_line *al)
@@ -2005,6 +2000,8 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
20052000
if (symbol__annotate(sym, map, evsel, 0, NULL, NULL) < 0)
20062001
return -1;
20072002

2003+
symbol__calc_percent(sym, evsel);
2004+
20082005
if (print_lines) {
20092006
srcline_full_filename = full_paths;
20102007
symbol__calc_lines(sym, map, &source_line);

0 commit comments

Comments
 (0)