This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Instrumenting context switches
- From: Perry Cheng <perryche at us dot ibm dot com>
- To: systemtap at sourceware dot org
- Date: Wed, 29 Nov 2006 18:25:59 -0500
- Subject: Instrumenting context switches
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