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:

> 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


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