public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jaswinder Singh Rajput <jaswinder@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip] perf_counter tools: shorten names for events
Date: Thu, 25 Jun 2009 11:33:46 +0200	[thread overview]
Message-ID: <20090625093346.GD23547@elte.hu> (raw)
In-Reply-To: <1245876060.3038.7.camel@localhost.localdomain>


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> After :
> 
>  Performance counter stats for 'ls -lR /usr/include/':
> 
>       283542921  dL1-loads             (scaled from 23.28%)
>         1848314  dL1-load-misses       (scaled from 22.94%)
>          168963  dL1-stores            (scaled from 22.94%)
>          739249  dL1-prefetches        (scaled from 22.45%)
>          501021  dL1-prefetch-misses   (scaled from 22.25%)
>       275037259  iL1-loads             (scaled from 23.40%)
>         6030825  iL1-load-misses       (scaled from 23.26%)
>          166760  iL1-prefetches        (scaled from 24.31%)
>         7224781  LLC-loads             (scaled from 24.76%)
>          821097  LLC-load-misses       (scaled from 24.07%)
>         7070549  LLC-stores            (scaled from 24.45%)
>       251586242  dTLB-loads            (scaled from 24.65%)
>         5127780  dTLB-load-misses      (scaled from 23.99%)
>       276782014  iTLB-loads            (scaled from 23.77%)
>           16787  iTLB-load-misses      (scaled from 23.72%)
>       123408502  branches              (scaled from 22.88%)
>         5843856  branch-misses         (scaled from 22.87%)
> 
>     1.417039891  seconds time elapsed.

ok, this output looks pretty good and intuitive to me (please 
integrate suggestions from Thomas), but the patch itself needs 
another iteration i think:

>  static char *hw_cache[][MAX_ALIASES] = {
> -	{ "L1-data",		"l1-d",		"l1d"			},
> -	{ "L1-instruction",	"l1-i",		"l1i"			},
> -	{ "L2",			"l2"					},
> -	{ "Data-TLB",		"dtlb",		"d-tlb"			},
> -	{ "Instruction-TLB",	"itlb",		"i-tlb"			},
> -	{ "Branch",		"bpu" ,		"btb",		"bpc"	},
> + { "dL1",	"L1-d",		"l1d",					},
> + { "iL1",	"L1-i",		"l1i",					},
> + { "LLC",	"L2",							},
> + { "dTLB",	"d-tlb",						},
> + { "iTLB",	"i-tlb",						},
> + { "branch",	"branches",	"bpu",		"btb",		"bpc",	},
>  };
>  
>  static char *hw_cache_op[][MAX_ALIASES] = {
> -	{ "Load",		"read"					},
> -	{ "Store",		"write"					},
> -	{ "Prefetch",		"speculative-read", "speculative-load"	},
> + { "load",	"loads",	"read",					},
> + { "store",	"stores",	"write",				},
> + { "prefetch",	"prefetches",	"speculative-read", "speculative-load",	},
>  };
>  
>  static char *hw_cache_result[][MAX_ALIASES] = {
> -	{ "Reference",		"ops",		"access"		},
> -	{ "Miss"							},
> + { "refs",	"ops",		"access",				},
> + { "misses",	"miss",							},
>  };
>  
>  char *event_name(int counter)
> @@ -123,10 +123,25 @@ char *event_name(int counter)
>  		if (cache_result > PERF_COUNT_HW_CACHE_RESULT_MAX)
>  			return "unknown-ext-hardware-cache-result";
>  
> -		sprintf(name, "%s-Cache-%s-%ses",
> -			hw_cache[cache_type][0],
> -			hw_cache_op[cache_op][0],
> -			hw_cache_result[cache_result][0]);
> +		/*
> +		 * special handling for branches
> +		 * we are only interested in BPU, READ
> +		 */ 
> +		if (cache_type == PERF_COUNT_HW_CACHE_BPU && cache_op)
> +			return "unknown";
> +		else if (cache_type == PERF_COUNT_HW_CACHE_BPU) {
> +			if (cache_result)
> +				sprintf(name, "%s-%s", hw_cache[cache_type][0],
> +					hw_cache_result[cache_result][0]);
> +			else
> +				sprintf(name, "%s", hw_cache[cache_type][1]);
> +		} else if (cache_result)
> +			sprintf(name, "%s-%s-%s", hw_cache[cache_type][0],
> +				hw_cache_op[cache_op][0],
> +				hw_cache_result[cache_result][0]);
> +		else
> +			sprintf(name, "%s-%s", hw_cache[cache_type][0],
> +				hw_cache_op[cache_op][1]);
>  
>  		return name;

Firstly, please run your patches through checkpatch - it will report 
a real problem in your patch.

Secondly, this special-casing of the BPU isnt very clean in this 
form. The BPU isnt 'special' because it deals with instructions - 
it's special because it's for all practical purposes read-only.

So we should extend our table with a read-only flag, and the BPU and 
the iTLB should be listed as read-only. (iTLB-store-miss is another 
thing that makes no sense) For those we should skip the 'store' 
bits.

That way the generic code does not have this special-case wart 
dependent on PERF_COUNT_HW_CACHE_BPU.

	Ingo

  parent reply	other threads:[~2009-06-25  9:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-23 12:28 [PATCH -tip] perf_counter tools: shorten names for events Jaswinder Singh Rajput
2009-06-23 13:52 ` Jaswinder Singh Rajput
2009-06-23 19:56 ` Ingo Molnar
2009-06-23 22:12   ` Jaswinder Singh Rajput
2009-06-23 22:59     ` Jaswinder Singh Rajput
2009-06-24  8:40     ` Ingo Molnar
2009-06-24 17:59       ` Jaswinder Singh Rajput
2009-06-24 18:07         ` Ingo Molnar
2009-06-24 18:18           ` Jaswinder Singh Rajput
2009-06-24 20:41   ` Jaswinder Singh Rajput
2009-06-24 21:00     ` Thomas Gleixner
2009-06-25  4:29       ` Jaswinder Singh Rajput
2009-06-25  4:34         ` Roland Dreier
2009-06-25  9:22           ` Ingo Molnar
2009-06-25  9:24       ` Ingo Molnar
2009-06-25 12:48         ` Thomas Gleixner
2009-06-25 13:23           ` Jaswinder Singh Rajput
2009-06-25 15:05             ` Roland Dreier
2009-06-25 15:11               ` Jaswinder Singh Rajput
2009-06-25 15:03         ` Roland Dreier
2009-06-25 15:24           ` Ingo Molnar
2009-06-25  9:33     ` Ingo Molnar [this message]
2009-06-25 12:55       ` Jaswinder Singh Rajput
2009-06-25 15:09         ` Roland Dreier
2009-06-25 15:26           ` Ingo Molnar
2009-06-25 15:34           ` Ingo Molnar
2009-06-26 16:06             ` Jaswinder Singh Rajput
2009-06-26 18:47               ` Ingo Molnar
2009-07-05  0:25           ` Anton Blanchard
2009-07-05  0:32             ` Ingo Molnar
2009-07-06 12:01               ` [PATCH] perf_counter tools: Rename cache events to remove $ Anton Blanchard
2009-07-10 10:39                 ` [tip:perfcounters/core] " tip-bot for Anton Blanchard
2009-06-25 15:33         ` [tip:perfcounters/urgent] perf_counter tools: Shorten names for events tip-bot for Jaswinder Singh Rajput
2009-06-25 15:57           ` Jaswinder Singh Rajput
2009-06-25 19:55             ` Ingo Molnar
2009-06-25 19:57             ` [tip:perfcounters/urgent] perf_counter tools: Add alias for 'l1d' and 'l1i' tip-bot for Jaswinder Singh Rajput

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=20090625093346.GD23547@elte.hu \
    --to=mingo@elte.hu \
    --cc=jaswinder@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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