views:

85

answers:

1

Hi Chaps,

Im trying to monitor the CPU usage of a process I've been updating to do a bit more work. However reading the /proc/pid/stat file, the jiffie counts (of utime,stime, etc) of the process will not increase. (It is definately doing some work, I can see it with strace etc).

The amount of work the process is doing is relatively tiny (reads /proc/stat 10 times per second, does a scanf, a few add/deletes, and updates some shared memory). Is it possible that an amount of work can be so low that it does not manage to increment the jiffie count? Does a process have to hold onto the processor for a complete jiffie in order to increment the count?

Any thoughts would be most appreciated

Cheers Joe.

+1  A: 

The counters you are looking at are updated during a timer tick. Only the process running when the tick occurs is updated. If your process does a lot of waiting, then chances are it won't be running when the timer fires.

Mike K