I am running a linux process which does the following
- Reads all the numeric file names from /proc
- For each, it reads the
utime
andstime
from /proc/pid/stat
Now the complete loop takes say starts at t0
time and finishes at t1
time.
t1-t0
can be of an order of seconds on a slow processor if number of processes are more...
So Is it right to extrapolate utime
and stime
? If yes how should I go about?
Or is there any better way? I dont know how top
command does it?
I am trying to create something like a top command.