incorrect perf counters
riya khanna
riyakhanna1983@gmail.com
Mon Jul 25 19:15:00 GMT 2016
Hi,
I'm trying to collect perf counters using systemtap. I followed
systemtap/EXAMPLES/profiling/perf.stp to create a script to monitor a
user process, enable counters on function entry, and spew out counters
on function return. Please find the script (perf.stp) attached.
I use the stap script described above to monitor function func()'s
entry and exit.
void func(void)
{
printf("Measuring instruction count for this printf\n");
}
Just to verify systemtap reported counters, I created a program
(test.c) that uses perf_event_open() syscall to monitor func()'s
entry/exit and spew out counters. Please find it attached as well.
However, the counters reported by perf.stp are very different from
what is reported by test.c. For example, instruction count reported by
test.c and perf.stp are 593 and 10610-10690.
This is how I launch perf.stp to monitor func() in test.c:
sudo /usr/local/bin/stap -s1 perf.stp test func
Why such a difference? Am I missing something?
Thanks,
Riya
-------------- next part --------------
A non-text attachment was scrubbed...
Name: perf.stp
Type: application/octet-stream
Size: 1929 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20160725/208b112b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 3115 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20160725/208b112b/attachment.bin>
More information about the Systemtap
mailing list