From cc68628096b813010f30f69fcf7d1832d18fa767 Mon Sep 17 00:00:00 2001 From: Ashay Rane Date: Thu, 5 Apr 2012 21:01:01 -0500 Subject: perf report: Correct display of samples and events in header This patch prints the number of samples and the count of performance events separately. This allows comparing performance of different applications with each other. Previously, the sample count was displayed against an 'Events:' heading. With this patch, the header now reads (for example): Samples: 5K of event 'instructions' Event count (approx.): 2993026545 The patch covers both the stdio and the browser interface. Signed-off-by: Ashay Rane [ committer note: Fixed wrt e7f01d1 ] Link: http://lkml.kernel.org/n/tip-h4nfjm8msedlk8gxkzivfh5y@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/ui/browsers/hists.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tools/perf/util/ui/browsers/hists.c') diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index 2f83e5dc9967..1b820ed2a049 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c @@ -840,10 +840,14 @@ static int hists__browser_title(struct hists *self, char *bf, size_t size, int printed; const struct dso *dso = self->dso_filter; const struct thread *thread = self->thread_filter; - unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE]; + unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE]; + u64 nr_events = self->stats.total_period; + + nr_samples = convert_unit(nr_samples, &unit); + printed = scnprintf(bf, size, + "Samples: %lu%c of event '%s', Event count (approx.): %lu", + nr_samples, unit, ev_name, nr_events); - nr_events = convert_unit(nr_events, &unit); - printed = scnprintf(bf, size, "Events: %lu%c %s", nr_events, unit, ev_name); if (self->uid_filter_str) printed += snprintf(bf + printed, size - printed, -- cgit v1.2.3-59-g8ed1b