summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-05-14 14:19:35 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-14 14:19:35 -0300
commitc82ee828aa20487d254a5225d256cd422acee459 (patch)
tree6f8132442237bc4f2393e04a5f30b3711a8f91ca /tools/perf/builtin-report.c
parentcee75ac7ecc27084accdb9d9d6fde65a09f047ae (diff)
downloadlinux-c82ee828aa20487d254a5225d256cd422acee459.tar.gz
linux-c82ee828aa20487d254a5225d256cd422acee459.tar.bz2
linux-c82ee828aa20487d254a5225d256cd422acee459.zip
perf report: Report number of events, not samples
Number of samples is meaningless after we switched to auto-freq, so report the number of events, i.e. not the sum of the different periods, but the number PERF_RECORD_SAMPLE emitted by the kernel. While doing this I noticed that naming "count" to the sum of all the event periods can be confusing, so rename it to .period, just like in struct sample.data, so that we become more consistent. This helps with the next step, that was to record in struct hist_entry the number of sample events for each instance, we need that because we use it to generate the number of events when applying filters to the tree of hist entries like it is being done in the TUI report browser. Suggested-by: Ingo Molnar <mingo@elte.hu> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b8f47ded6287..68265120ee07 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -188,14 +188,14 @@ static int process_sample_event(event_t *event, struct perf_session *session)
return 0;
if (perf_session__add_hist_entry(session, &al, &data)) {
- pr_debug("problem incrementing symbol count, skipping event\n");
+ pr_debug("problem incrementing symbol period, skipping event\n");
return -1;
}
attr = perf_header__find_attr(data.id, &session->header);
if (add_event_total(session, &data, attr)) {
- pr_debug("problem adding event count\n");
+ pr_debug("problem adding event period\n");
return -1;
}
@@ -269,11 +269,25 @@ static struct perf_event_ops event_ops = {
extern volatile int session_done;
-static void sig_handler(int sig __attribute__((__unused__)))
+static void sig_handler(int sig __used)
{
session_done = 1;
}
+static size_t hists__fprintf_nr_sample_events(struct hists *self,
+ const char *evname, FILE *fp)
+{
+ size_t ret;
+ char unit;
+ unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE];
+
+ nr_events = convert_unit(nr_events, &unit);
+ ret = fprintf(fp, "# Events: %lu%c", nr_events, unit);
+ if (evname != NULL)
+ ret += fprintf(fp, " %s", evname);
+ return ret + fprintf(fp, "\n#\n");
+}
+
static int __cmd_report(void)
{
int ret = -EINVAL;
@@ -319,14 +333,12 @@ static int __cmd_report(void)
if (use_browser)
hists__browse(hists, help, input_name);
else {
- if (rb_first(&session->hists.entries) ==
+ const char *evname = NULL;
+ if (rb_first(&session->hists.entries) !=
rb_last(&session->hists.entries))
- fprintf(stdout, "# Samples: %Ld\n#\n",
- hists->stats.total_period);
- else
- fprintf(stdout, "# Samples: %Ld %s\n#\n",
- hists->stats.total_period,
- __event_name(hists->type, hists->config));
+ evname = __event_name(hists->type, hists->config);
+
+ hists__fprintf_nr_sample_events(hists, evname, stdout);
hists__fprintf(hists, NULL, false, stdout);
fprintf(stdout, "\n\n");