This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Monitoring cpu time in us (or even ns?)
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: Cor-paul Bezemer - EWI <C dot Bezemer at tudelft dot nl>
- Cc: "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: Wed, 23 Oct 2013 09:42:56 -0400
- Subject: Re: Monitoring cpu time in us (or even ns?)
- Authentication-results: sourceware.org; auth=none
- References: <1382451127616-248214 dot post at n7 dot nabble dot com> <y0my55lta4l dot fsf at fche dot csb> <46C9AEB13B3AC04C82D760CC81752171460DA9B4 at SRV361 dot tudelft dot net>
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