public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* performance monitoring support for systemtap
@ 2006-08-08 20:45 William Cohen
  0 siblings, 0 replies; only message in thread
From: William Cohen @ 2006-08-08 20:45 UTC (permalink / raw)
  To: systemtap

Hi all,

The current state of the performance monitoring support for systemtap in 
  the latest patch added the systemtap bz#909 today. I would like to be 
able to code up something like the following in the scripting language:

global h1, h2
global startt, starti

probe perfmon.counter("CPU_CLK_UNHALTED") { h1=$counter; }
probe perfmon.counter("RETIRED_INSTRUCTIONS") { h2=$counter; }

probe kernel.function("functionx"){
	startt=read_counter(h1);
	starti=read_counter(h2);
}

probe kernel.function("functionx").return {
	stopt=read_counter(h1);
	stopi=read_counter(h2);

	printf ("time = %d", stopt-startt);
	printf ("instructions = %d", stopi-starti);
}


The $counter is a handle used to identify the counter. Due to the 
constraints in performance monitoring hardware the performace counters 
may be put in paricular registers. There is no guarantee that 
CPU_CLK_UNHALTED would be put in the register 0. This certainly the case 
on P4 where certain registers measure certain types of events.

One thing in the perfmon tapset that is very different from the other 
tapsets is that the code generation to determine the magic bit pattern 
for the performance monitoring hw can't be done piece meal. The entire 
set of events need to be set up at once. This is done by tracking the 
number perfmon events allocated vs the number of perfmon events visited.

The next task I need to do is generate the code for the $counter. This 
might be compilicated by way that the code initialization is done in the 
last perfmon_derived_probe::emit_registerations(). I would be 
interesting in suggestions of what sections of systemtap I should be 
looking at to figure out how to implement the $counter.

-Will

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-08 20:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-08 20:45 performance monitoring support for systemtap William Cohen

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 read-only IMAP folder(s) and NNTP newsgroup(s).