Monitoring cpu time in us (or even ns?)
Frank Ch. Eigler
fche@redhat.com
Wed Oct 23 13:43:00 GMT 2013
C.Bezemer wrote:
> Thanks - I thought using the gettimeofday* functions for measuring
> cpu time are inappropriate as they represent the time the function
> uses the CPU plus the time the function is waiting for other
> functions?
The gettimeofday* functions snapshot estimates of then-current time.
What matters is when those snapshots are taken and the arithmetic
performed on them. If you want to measure elapsed time for a function
(including its callees), then subtract $before from $after, and that's
it.
If you want to exclude callees' time, it's a much more difficult
problem (many more events to track - many more time snapshots to
add/subtract), and you'd probably be better off using sampling-based
techniques.
- FChE
More information about the Systemtap
mailing list