This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Monitoring cpu time in us (or even ns?)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]