linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Ashay Rane <ashay.r@gmail.com>
Cc: linux-perf-users@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	Stephane Eranian <eranian@google.com>,
	David Daney <david.daney@cavium.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] perf report: Correct display of samples and events in header
Date: Wed, 21 Mar 2012 12:35:27 -0300	[thread overview]
Message-ID: <20120321153527.GA25820@infradead.org> (raw)
In-Reply-To: <1332292828-22656-1-git-send-email-ashay.r@gmail.com>

Em Tue, Mar 20, 2012 at 08:20:28PM -0500, Ashay Rane escreveu:
> 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.r@gmail.com>

Patches that are not bug fixes should be done on tip/perf/core, please
do that and resubmit.

git remote add tip git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git remote update tip
git checkout -b perf/core tip/perf/core

:-)

- Arnaldo

 ---
>  tools/perf/builtin-report.c         |   11 +++++++----
>  tools/perf/util/ui/browsers/hists.c |    9 ++++++---
>  2 files changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 8e91c6e..2ee7783 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -295,12 +295,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");
>  }
>  
> diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
> index fa530fc..d9ec415 100644
> --- a/tools/perf/util/ui/browsers/hists.c
> +++ b/tools/perf/util/ui/browsers/hists.c
> @@ -837,10 +837,13 @@ 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_events = convert_unit(nr_events, &unit);
> -	printed = scnprintf(bf, size, "Events: %lu%c %s", nr_events, unit, ev_name);
> +	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);
>  
>  	if (self->uid_filter_str)
>  		printed += snprintf(bf + printed, size - printed,
> -- 
> 1.7.9.3

      reply	other threads:[~2012-03-21 15:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21  1:20 [PATCH 1/1] perf report: Correct display of samples and events in header Ashay Rane
2012-03-21 15:35 ` Arnaldo Carvalho de Melo [this message]

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=20120321153527.GA25820@infradead.org \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ashay.r@gmail.com \
    --cc=david.daney@cavium.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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).