All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
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,
	jolsa@redhat.com, namhyung.kim@lge.com
Subject: Re: [PATCH 1/2] perf stat: refactor aggregation code
Date: Wed, 13 Feb 2013 16:50:50 +0900	[thread overview]
Message-ID: <874nhgps85.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1360678168-6974-2-git-send-email-eranian@google.com> (Stephane Eranian's message of "Tue, 12 Feb 2013 15:09:27 +0100")

Hi Stephane,

On Tue, 12 Feb 2013 15:09:27 +0100, Stephane Eranian wrote:
> Refactor aggregation code by introducing
> a single aggr_mode variable and an enum
> for aggregation.
>
> Also refactor cpumap code having to do
> with cpu to socket mappings. All in preparation
> for extended modes, such as cpu -> core.
>
> Also fix socket aggregation and ensure
> that sockets are printed in increasing order.
[snip]
> -static void print_aggr_socket(char *prefix)
> +static void print_aggr(char *prefix)
>  {
>  	struct perf_evsel *counter;
> +	int cpu, s, s2, id, nr;
>  	u64 ena, run, val;
> -	int cpu, s, s2, sock, nr;
>  
> -	if (!sock_map)
> +	if (!(aggr_map || aggr_get_id))
>  		return;
>  
> -	for (s = 0; s < sock_map->nr; s++) {
> -		sock = cpu_map__socket(sock_map, s);
> +	for (s = 0; s < aggr_map->nr; s++) {
> +		id = aggr_map->map[s];
>  		list_for_each_entry(counter, &evsel_list->entries, node) {
>  			val = ena = run = 0;
>  			nr = 0;
...
> @@ -1073,14 +1081,20 @@ static void print_stat(int argc, const char **argv)
>  		fprintf(output, ":\n\n");
>  	}
>  
> -	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 {
> +	switch (aggr_mode) {
> +	case AGGR_SOCKET:
> +		print_aggr(NULL);
> +		break;

This line should look like this IMHO:

		list_for_each_entry(counter, &evsel_list->entries, node)
			print_aggr(counter, NULL);

and the equivalent loop in the print_aggr() should be removed.  This is
for consistency with other formats if multiple events counted.

For instance, it'd sorting on events first and then sockets like:

  #      time socket cpus     counts events
           t0 S0     4        XXXXXX cycles
           t0 S1     4        XXXXXX cycles
           t0 S0     4          YYYY cache-misses
           t0 S1     4          YYYY cache-misses
           t1 S0     4        ZZZZZZ cycles
  ...

But current code looks like sorting on sockets first instead.

  #      time socket cpus     counts events
           t0 S0     4        XXXXXX cycles
           t0 S0     4          YYYY cache-misses
           t0 S1     4        XXXXXX cycles
           t0 S1     4          YYYY cache-misses
           t1 S0     4        ZZZZZZ cycles
  ...

Thanks,
Namhyung


> +	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;
>  	}

  parent reply	other threads:[~2013-02-13  7:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 14:09 [PATCH 0/2] perf stat: add per-core count aggregation Stephane Eranian
2013-02-12 14:09 ` [PATCH 1/2] perf stat: refactor aggregation code Stephane Eranian
2013-02-12 17:26   ` Andi Kleen
2013-02-13  7:50   ` Namhyung Kim [this message]
2013-02-13  9:38     ` Stephane Eranian
2013-02-12 14:09 ` [PATCH 2/2] perf stat: add per-core aggregation Stephane Eranian
2013-02-12 17:23 ` [PATCH 0/2] perf stat: add per-core count aggregation Andi Kleen
2013-02-12 17:26   ` Stephane Eranian
2013-02-12 17:29     ` Andi Kleen
2013-02-12 17:33       ` 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=874nhgps85.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.