Instrumenting context switches
Perry Cheng
perryche@us.ibm.com
Thu Nov 30 01:35:00 GMT 2006
Using some example code, I tried to instrument context switching by adding
a probe to the method __switch_to. Some documentation had suggested that
certain versions of the systemtap could not handle instrumenting
context_switch. In the past I have gotten this to work but now the use of
_stp_printf seems to cause the machine to freeze hard. If I leave out the
printing of switchCount but leave in the increment, things work fine. Is
this a known problem or a known historical problem and if so what are the
workarounds?
probe kernel.function("__switch_to")
{
doSwitchTo(gettimeofday_us(), $prev_p, $next_p);
}
function doSwitchTo(timeus:long, prev:long, next:long)
%{
_stp_printf("SWITCHCOUNT = %ld\n", switchCount);
<------------------------------ BAD LINE
switchCount++;
}%
Perry
More information about the Systemtap
mailing list