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: Cor-paul Bezemer - EWI <C dot Bezemer at tudelft dot nl>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: Wed, 23 Oct 2013 07:30:12 +0000
- 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>
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?
--CP
________________________________________
From: Frank Ch. Eigler [fche@redhat.com]
Sent: Tuesday, October 22, 2013 8:48 PM
To: Cor-paul Bezemer - EWI
Cc: systemtap@sourceware.org
Subject: Re: Monitoring cpu time in us (or even ns?)
c.bezemer wrote:
> I am probably completely overlooking this in the docs, but how can I
> monitor the time spent within a function?
One general approach is to have a function.return probe that measures
elapsed time with something like
probe FOO.function(BAR).return {
time_spent_within_function = gettimeofday_us()-
@entry(gettimeofday_us())
/* ... */
}
> I have tried using task_utime() and task_stime() but these appear to
> give results in ms
Those functions return the values as stored by the kernel; systemtap
is not rounding them off.
> [...] How can I get these times in us or even ns?
(At times so small, the probe effect (q.v.) will impact measurements.)
- FChE