perf tools: Move symbol__calc_percent() call to outside symbol__disassemble()
authorJiri Olsa <jolsa@kernel.org>
Wed, 15 Nov 2017 11:20:08 +0000 (12:20 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 17 Nov 2017 15:16:26 +0000 (12:16 -0300)
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>
tools/perf/ui/browsers/annotate.c
tools/perf/ui/gtk/annotate.c
tools/perf/util/annotate.c

index 5a2f37a91feb2d28341e3b5909b8daadd662dc71..03b7363a49c9ae646ac731078fe3fc52a8c5450f 100644 (file)
@@ -1126,6 +1126,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
                goto out_free_offsets;
        }
 
+       symbol__calc_percent(sym, evsel);
+
        ui_helpline__push("Press ESC to exit");
 
        notes = symbol__annotation(sym);
index 5e0a56df0b4c7256f7444c40cbc217aca7a2be3c..cdb5ecf91666b354348a6cecc9e960c899ded5ae 100644 (file)
@@ -177,6 +177,8 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
                return -1;
        }
 
+       symbol__calc_percent(sym, evsel);
+
        if (perf_gtk__is_active_context(pgctx)) {
                window = pgctx->main_window;
                notebook = pgctx->notebook;
index 846abb4955acc6c77f135e0710e35d0ca499dcf3..22ea7936d92f4c7068868a337ceade1cde987d7e 100644 (file)
@@ -1653,12 +1653,7 @@ int symbol__annotate(struct symbol *sym, struct map *map,
                }
        }
 
-       err = symbol__disassemble(sym, &args);
-       if (!err)
-               symbol__calc_percent(sym, evsel);
-
-       return err;
-
+       return symbol__disassemble(sym, &args);
 }
 
 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,
        if (symbol__annotate(sym, map, evsel, 0, NULL, NULL) < 0)
                return -1;
 
+       symbol__calc_percent(sym, evsel);
+
        if (print_lines) {
                srcline_full_filename = full_paths;
                symbol__calc_lines(sym, map, &source_line);