Commit 0683d13c authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf annotate: Get rid of annotation__scnprintf_samples_period()

We have more current function tto get the title for annotation,
which is hists__scnprintf_title. They both have same output as
far as the annotation's header line goes.

They differ in counting of the nr_samples, hists__scnprintf_title
provides more accurate number based on the setup of the
symbol_conf.filter_relative variable.

Plus it also displays any uid/thread/dso/socket filters/zooms
if there are set any, which annotation__scnprintf_samples_period
does not.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
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-4-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5ecf7d30
...@@ -624,8 +624,7 @@ static int annotate_browser__run(struct annotate_browser *browser, ...@@ -624,8 +624,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
char title[256]; char title[256];
int key; int key;
annotation__scnprintf_samples_period(notes, title, sizeof(title), evsel); hists__scnprintf_title(hists, title, sizeof(title));
if (annotate_browser__show(&browser->b, title, help) < 0) if (annotate_browser__show(&browser->b, title, help) < 0)
return -1; return -1;
......
...@@ -2389,7 +2389,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map, ...@@ -2389,7 +2389,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map,
{ {
struct dso *dso = map->dso; struct dso *dso = map->dso;
struct rb_root source_line = RB_ROOT; struct rb_root source_line = RB_ROOT;
struct annotation *notes = symbol__annotation(sym); struct hists *hists = evsel__hists(evsel);
char buf[1024]; char buf[1024];
if (symbol__annotate2(sym, map, evsel, opts, NULL) < 0) if (symbol__annotate2(sym, map, evsel, opts, NULL) < 0)
...@@ -2401,7 +2401,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map, ...@@ -2401,7 +2401,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map,
print_summary(&source_line, dso->long_name); print_summary(&source_line, dso->long_name);
} }
annotation__scnprintf_samples_period(notes, buf, sizeof(buf), evsel); hists__scnprintf_title(hists, buf, sizeof(buf));
fprintf(stdout, "%s\n%s() %s\n", buf, sym->name, dso->long_name); fprintf(stdout, "%s\n%s() %s\n", buf, sym->name, dso->long_name);
symbol__annotate_fprintf2(sym, stdout); symbol__annotate_fprintf2(sym, stdout);
...@@ -2689,46 +2689,6 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *ev ...@@ -2689,46 +2689,6 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *ev
return -1; return -1;
} }
int __annotation__scnprintf_samples_period(struct annotation *notes,
char *bf, size_t size,
struct perf_evsel *evsel,
bool show_freq)
{
const char *ev_name = perf_evsel__name(evsel);
char buf[1024], ref[30] = " show reference callgraph, ";
char sample_freq_str[64] = "";
unsigned long nr_samples = 0;
int nr_members = 1;
bool enable_ref = false;
u64 nr_events = 0;
char unit;
int i;
if (perf_evsel__is_group_event(evsel)) {
perf_evsel__group_desc(evsel, buf, sizeof(buf));
ev_name = buf;
nr_members = evsel->nr_members;
}
for (i = 0; i < nr_members; i++) {
struct sym_hist *ah = annotation__histogram(notes, evsel->idx + i);
nr_samples += ah->nr_samples;
nr_events += ah->period;
}
if (symbol_conf.show_ref_callgraph && strstr(ev_name, "call-graph=no"))
enable_ref = true;
if (show_freq)
scnprintf(sample_freq_str, sizeof(sample_freq_str), " %d Hz,", evsel->attr.sample_freq);
nr_samples = convert_unit(nr_samples, &unit);
return scnprintf(bf, size, "Samples: %lu%c of event%s '%s',%s%sEvent count (approx.): %" PRIu64,
nr_samples, unit, evsel->nr_members > 1 ? "s" : "",
ev_name, sample_freq_str, enable_ref ? ref : " ", nr_events);
}
#define ANNOTATION__CFG(n) \ #define ANNOTATION__CFG(n) \
{ .name = #n, .value = &annotation__default_options.n, } { .name = #n, .value = &annotation__default_options.n, }
......
...@@ -177,13 +177,6 @@ int __annotation__scnprintf_samples_period(struct annotation *notes, ...@@ -177,13 +177,6 @@ int __annotation__scnprintf_samples_period(struct annotation *notes,
struct perf_evsel *evsel, struct perf_evsel *evsel,
bool show_freq); bool show_freq);
static inline int annotation__scnprintf_samples_period(struct annotation *notes,
char *bf, size_t size,
struct perf_evsel *evsel)
{
return __annotation__scnprintf_samples_period(notes, bf, size, evsel, true);
}
int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw); int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw);
size_t disasm__fprintf(struct list_head *head, FILE *fp); size_t disasm__fprintf(struct list_head *head, FILE *fp);
void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel); void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment