]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
perf report: Correct display of samples and events in header
authorAshay Rane <ashay.rane@tacc.utexas.edu>
Fri, 6 Apr 2012 02:01:01 +0000 (21:01 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 7 Apr 2012 20:29:41 +0000 (17:29 -0300)
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 <ashay.rane@tacc.utexas.edu>
[ committer note: Fixed wrt e7f01d1 ]
Link: http://lkml.kernel.org/n/tip-h4nfjm8msedlk8gxkzivfh5y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c
tools/perf/util/ui/browsers/hists.c

index 2e317438980b4767bbca4fdc3512cbd55d4ad1d2..cec2b8cee80cada5db9957d7355e708324cf83a2 100644 (file)
@@ -296,12 +296,15 @@ static size_t hists__fprintf_nr_sample_events(struct hists *self,
 {
        size_t ret;
        char unit;
-       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_events = convert_unit(nr_events, &unit);
-       ret = fprintf(fp, "# Events: %lu%c", nr_events, unit);
+       nr_samples = convert_unit(nr_samples, &unit);
+       ret = fprintf(fp, "# Samples: %lu%c", nr_samples, unit);
        if (evname != NULL)
-               ret += fprintf(fp, " %s", evname);
+               ret += fprintf(fp, " of event '%s'", evname);
+
+       ret += fprintf(fp, "\n# Event count (approx.): %lu", nr_events);
        return ret + fprintf(fp, "\n#\n");
 }
 
index 2f83e5dc996706a005dcdc9c1cac3cb88d38b94d..1b820ed2a049ccdfeedb4454bd82f8a6c947c0b7 100644 (file)
@@ -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,