public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@elte.hu, ak@linux.intel.com, acme@redhat.com,
	namhyung.kim@lge.com
Subject: Re: [PATCH v2 1/3] perf stat: refactor aggregation code
Date: Thu, 7 Mar 2013 22:38:44 +0100	[thread overview]
Message-ID: <20130307213844.GB24191@krava.redhat.com> (raw)
In-Reply-To: <1360846649-6411-2-git-send-email-eranian@google.com>

On Thu, Feb 14, 2013 at 01:57:27PM +0100, Stephane Eranian wrote:

SNIP

> -		if (aggr_socket)
> +		switch (aggr_mode) {
> +		case AGGR_SOCKET:
>  			fprintf(output, "#           time socket cpus             counts events\n");
> -		else if (no_aggr)
> +			break;
> +		case AGGR_NONE:
>  			fprintf(output, "#           time CPU                 counts events\n");
> -		else
> +			break;
> +		case AGGR_GLOBAL:
> +		default:
>  			fprintf(output, "#           time             counts events\n");
> +		}
>  	}
>  
>  	if (++num_print_interval == 25)
>  		num_print_interval = 0;
>  
> -	if (aggr_socket)
> -		print_aggr_socket(prefix);
> -	else if (no_aggr) {



this:

---
> +	switch (aggr_mode) {
> +	case AGGR_SOCKET:
> +		print_aggr(prefix);
> +		break;
> +	case AGGR_NONE:
>  		list_for_each_entry(counter, &evsel_list->entries, node)
>  			print_counter(counter, prefix);
> -	} else {
> +		break;
> +	case AGGR_GLOBAL:
> +	default:
>  		list_for_each_entry(counter, &evsel_list->entries, node)
>  			print_counter_aggr(counter, prefix);
>  	}
---



> @@ -356,12 +372,6 @@ static int __run_perf_stat(int argc __maybe_unused, const char **argv)
>  		ts.tv_nsec = 0;
>  	}

SNIP

> -	if (aggr_socket)
> -		print_aggr_socket(NULL);
> -	else if (no_aggr) {
> -		list_for_each_entry(counter, &evsel_list->entries, node)
> -			print_counter(counter, NULL);
> -	} else {


and this:
---
> +	switch (aggr_mode) {
> +	case AGGR_SOCKET:
> +		print_aggr(NULL);
> +		break;
> +	case AGGR_GLOBAL:
>  		list_for_each_entry(counter, &evsel_list->entries, node)
>  			print_counter_aggr(counter, NULL);
> +		break;
> +	case AGGR_NONE:
> +		list_for_each_entry(counter, &evsel_list->entries, node)
> +			print_counter(counter, NULL);
> +		break;
> +	default:
> +		break;
>  	}
---

could be in a single function with 'prefix' arg

Also in non interval mode no column headers are printed and the
output is sort of not user friendly, I think we could print the
header same as for the interval case.

[jolsa@krava perf]$ sudo ./perf stat -a --per-socket -e cycles /bin/true 

 Performance counter stats for '/bin/true':

S0        4          1,472,345 cycles                    #    0.000 GHz                    

^^^^^^^^^^^, versus:

[jolsa@krava perf]$ sudo ./perf stat -a --per-socket -I 100 -e cycles
sleep 10
#           time socket cpus             counts events
     0.100283713 S0        4         12,975,188 cycles                   
     0.200881622 S0        4         15,982,354 cycles                   

thanks,
jirka

  reply	other threads:[~2013-03-07 21:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 12:57 [PATCH v2 0/3] perf stat: add per-core count aggregation Stephane Eranian
2013-02-14 12:57 ` [PATCH v2 1/3] perf stat: refactor aggregation code Stephane Eranian
2013-03-07 21:38   ` Jiri Olsa [this message]
2013-03-25 16:22   ` Arnaldo Carvalho de Melo
2013-04-02  9:33   ` [tip:perf/core] perf stat: Refactor " tip-bot for Stephane Eranian
2013-02-14 12:57 ` [PATCH v2 2/3] perf stat: rename --aggr-socket to --per-socket Stephane Eranian
2013-04-02  9:34   ` [tip:perf/core] perf stat: Rename " tip-bot for Stephane Eranian
2013-02-14 12:57 ` [PATCH v2 3/3] perf stat: add per-core aggregation Stephane Eranian
2013-04-02  9:36   ` [tip:perf/core] perf stat: Add " tip-bot for Stephane Eranian
2013-03-07 16:22 ` [PATCH v2 0/3] perf stat: add per-core count aggregation Stephane Eranian
2013-03-25 13:57   ` Stephane Eranian

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=20130307213844.GB24191@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.com \
    --cc=peterz@infradead.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