Measuring system call times, elapsed and cpu

Mike Mason mmlnx@us.ibm.com
Tue Sep 18 23:02:00 GMT 2007


I'm writing a script that attempts to measure how long it takes system calls to finish.  It uses gettimeofday_ns() to get the time at entry and exit, then calculates the delta.  Simple.  It occurred me, however, that a system call can start on one cpu and finish on another.  Now I'm wondering if I can rely on gettimeofday_ns() for this type of measurement.  If not, is there a better way to do this?

I'd also like to break down the system call latency into cpu and wait times.  I thought of calculating the delta of utime+stime from task_struct to get cpu time, then subtracting that from the overall delta to get wait time.  Should this work or am I missing something?

Thanks,
Mike



More information about the Systemtap mailing list