[m_linux.c] faulty reporting of CPU states
Brought to you by:
wnl
my specific envt is Redhat Enterprise Linux 4 running RHEL4 kernel 2.6.9-42 - seen in top 3.8b1, 3.7b2, and 3.5 binaries
The specific problem occurs when the counters in /proc/stat are too big. machine/m_linux.c expects these numbers to be longs, but the numbers are actually unsigned long longs. (kernel source fs/proc/proc_misc.c, include/linux/kernel_stat.h) This results in odd calculated percentages of cpu states in the top display. Swapping the strtoul() with strtoull() calls produces expected output.
I presume this is not Redhat Enterprise 4 specific, but did not investigate further.
/proc/stat snapshot #1
/proc/stat snapshot #2, a few seconds later