incorrect perf counters

Frank Ch. Eigler fche@redhat.com
Wed Jul 27 15:59:00 GMT 2016


riyakhanna1983 wrote:

> Is is possible to enable/disable counters on a function entry/exit?

Enabling/disabling is a relatively large amount of work.  If you just
want a *delta* between function entry/exit, you could accumulate that
thusly:

stap -e '
global counts
probe perf.sw.cpu_clock.counter("foo") {}
probe process.function("*").return { counts <<< @perf("foo") - @entry(@perf("foo")) }
' -c /bin/ls

... but actually it seems we're not implementing @entry(@perf(...))
correctly just now, so you may need to do this instead:

global counts, zoo%
probe perf.sw.cpu_clock.counter("foo") {}
probe process.function("main").call { zoo[tid()] = @perf("foo") }
probe process.function("main").return { counts <<< @perf("foo") - zoo[tid()] }
' -c /bin/ls

- FChE



More information about the Systemtap mailing list