Question regarding /proc/stat (cpu load measurement)
I am working on an embedded Linux project and need to measure cpu load programmatically. General advice seems to be to use /proc/stat for this purpose. I understand the algorithm to do that. However, I am confused by the results I am seeing.
I am running one user process and 'top' shows that it is consuming 12% of the cpu.
However, if I repeatedly execute 'cat /proc/stat' from the command line, the first number after 'cpu', which should be the number of 'user' jiffies, barely changes. The 'idle' value (4th number) does change appreciably.
Why is the 'user' value not changing?
As I understand it, the value shown by top is a percentage of the non-idle time, whereas the numbers you see in /proc/stat are absolute times.
|All times are GMT -5. The time now is 12:06 AM.|