This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

performance monitoring support for 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]