Measuring daemon CPU utilization over a portion of it's wall clock run time

Posted by WhirlWind on Stack Overflow See other posts from Stack Overflow or by WhirlWind
Published on 2010-05-27T03:26:18Z Indexed on 2010/05/27 3:31 UTC
Read the original article Hit count: 286

Filed under:
|
|
|
|

I am dealing with a network-related daemon: it takes data in, processes it, and spits it out. I would like to increase the performance of this daemon by profiling it and reducing it's CPU utilization. I can do this easily on Linux with gprof. However, I would also like to use something like "time" to measure it's total CPU utilization over a period of time. If possible, I would like to time it over a period that is less than its total run time: thus, I would like to start the daemon, wait awhile, generate CPU statistics, stop generating them, then stop the daemon at some later time.

The "time" command would work well for me, but it seems to require that I start and stop the daemon as a child of time. Is there a way to measure CPU utilization for only a portion of the daemon's wall clock time?

© Stack Overflow or respective owner

Related posts about c

    Related posts about linux