From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
David Ahern <dsahern@gmail.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH 03/20] perf annotate: Get rid of annotation__scnprintf_samples_period
Date: Sat, 4 Aug 2018 15:05:04 +0200 [thread overview]
Message-ID: <20180804130521.11408-4-jolsa@kernel.org> (raw)
In-Reply-To: <20180804130521.11408-1-jolsa@kernel.org>
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.
Link: http://lkml.kernel.org/n/tip-62qw9sep9mqep1qtvlns0dww@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/annotate.c | 3 +--
tools/perf/util/annotate.c | 44 ++-----------------------------
tools/perf/util/annotate.h | 7 -----
3 files changed, 3 insertions(+), 51 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 3b4f1c10ff57..d264916d2648 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -624,8 +624,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
char title[256];
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)
return -1;
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 956c9b19d81c..0d40cee13f6b 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -2389,7 +2389,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map,
{
struct dso *dso = map->dso;
struct rb_root source_line = RB_ROOT;
- struct annotation *notes = symbol__annotation(sym);
+ struct hists *hists = evsel__hists(evsel);
char buf[1024];
if (symbol__annotate2(sym, map, evsel, opts, NULL) < 0)
@@ -2401,7 +2401,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map,
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);
symbol__annotate_fprintf2(sym, stdout);
@@ -2689,46 +2689,6 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *ev
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) \
{ .name = #n, .value = &annotation__default_options.n, }
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index a93502d0c582..d06f14c656c6 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -177,13 +177,6 @@ int __annotation__scnprintf_samples_period(struct annotation *notes,
struct perf_evsel *evsel,
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);
size_t disasm__fprintf(struct list_head *head, FILE *fp);
void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel);
--
2.17.1
next prev parent reply other threads:[~2018-08-04 13:05 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-04 13:05 [PATCH 00/20] perf annotate: Make symbol__annotate_fprintf2 local Jiri Olsa
2018-08-04 13:05 ` [PATCH 01/20] " Jiri Olsa
2018-08-06 15:00 ` Arnaldo Carvalho de Melo
2018-08-18 11:25 ` [tip:perf/urgent] perf annotate: Make symbol__annotate_fprintf2() local tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 02/20] perf annotate: Make annotation_line__max_percent static Jiri Olsa
2018-08-06 15:01 ` Arnaldo Carvalho de Melo
2018-08-18 11:26 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` Jiri Olsa [this message]
2018-08-06 15:07 ` [PATCH 03/20] perf annotate: Get rid of annotation__scnprintf_samples_period Arnaldo Carvalho de Melo
2018-08-18 11:26 ` [tip:perf/urgent] perf annotate: Get rid of annotation__scnprintf_samples_period() tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 04/20] perf annotate: Rename struct annotation_line::samples* to data* Jiri Olsa
2018-08-06 15:08 ` Arnaldo Carvalho de Melo
2018-08-18 11:27 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 05/20] perf annotate: Rename local sample variables to data Jiri Olsa
2018-08-06 15:09 ` Arnaldo Carvalho de Melo
2018-08-18 11:27 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 06/20] perf annotate: Rename hist to sym_hist in annotation__calc_percent Jiri Olsa
2018-08-06 15:10 ` Arnaldo Carvalho de Melo
2018-08-18 11:28 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 07/20] perf annotate: Loop group events directly " Jiri Olsa
2018-08-06 15:12 ` Arnaldo Carvalho de Melo
2018-08-18 11:28 ` [tip:perf/urgent] perf annotate: Loop group events directly in annotation__calc_percent() tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 08/20] perf annotate: Switch struct annotation_data::percent to array Jiri Olsa
2018-08-06 15:14 ` Arnaldo Carvalho de Melo
2018-08-18 11:29 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 09/20] perf annotate: Add PERCENT_HITS_GLOBAL percent value Jiri Olsa
2018-08-06 15:15 ` Arnaldo Carvalho de Melo
2018-08-18 11:29 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 10/20] perf annotate: Add PERCENT_PERIOD_LOCAL " Jiri Olsa
2018-08-06 15:16 ` Arnaldo Carvalho de Melo
2018-08-18 11:30 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 11/20] perf annotate: Add PERCENT_PERIOD_GLOBAL " Jiri Olsa
2018-08-06 15:16 ` Arnaldo Carvalho de Melo
2018-08-18 11:30 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 12/20] perf annotate: Add percent_type to struct annotation_options Jiri Olsa
2018-08-06 15:17 ` Arnaldo Carvalho de Melo
2018-08-18 11:31 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 13/20] perf annotate: Pass struct annotation_options to symbol__calc_lines Jiri Olsa
2018-08-06 15:18 ` Arnaldo Carvalho de Melo
2018-08-18 11:32 ` [tip:perf/urgent] perf annotate: Pass struct annotation_options to symbol__calc_lines() tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 14/20] perf annotate: Pass struct annotation_options to map_symbol__annotation_dump Jiri Olsa
2018-08-06 13:45 ` Namhyung Kim
2018-08-06 14:24 ` Jiri Olsa
2018-08-06 15:22 ` Arnaldo Carvalho de Melo
2018-08-06 15:29 ` Jiri Olsa
2018-08-18 11:32 ` [tip:perf/urgent] perf annotate: Pass 'struct annotation_options' to map_symbol__annotation_dump() tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 15/20] perf annotate: Pass browser percent_type in annotate_browser__calc_percent Jiri Olsa
2018-08-06 15:23 ` Arnaldo Carvalho de Melo
2018-08-18 11:33 ` [tip:perf/urgent] perf annotate: Pass browser percent_type in annotate_browser__calc_percent() tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 16/20] perf annotate: Add support to togle percent type Jiri Olsa
2018-08-06 18:24 ` Arnaldo Carvalho de Melo
2018-08-18 11:33 ` [tip:perf/urgent] perf annotate: Add support to toggle " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 17/20] perf annotate: Make local period the default " Jiri Olsa
2018-08-06 18:26 ` Arnaldo Carvalho de Melo
2018-08-18 11:34 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 18/20] perf annotate: Display percent type in stdio output Jiri Olsa
2018-08-06 18:27 ` Arnaldo Carvalho de Melo
2018-08-18 11:34 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 19/20] perf annotate: Add --percent-type option Jiri Olsa
2018-08-06 13:49 ` Namhyung Kim
2018-08-06 14:26 ` Jiri Olsa
2018-08-06 18:33 ` Arnaldo Carvalho de Melo
2018-08-06 18:32 ` Arnaldo Carvalho de Melo
2018-08-18 11:35 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-08-04 13:05 ` [PATCH 20/20] perf report: " Jiri Olsa
2018-08-06 18:48 ` Arnaldo Carvalho de Melo
2018-08-18 11:35 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180804130521.11408-4-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).