From: Marko Rauhamaa <marko@pa...> - 2013-07-26 20:13:59
I have had a recurring LXDE CPU monitor problem: it displays all green
as though the CPU was busy 100% of the time. However, uptime, top etc
indicated everything was fine.
I have now tracked down the root cause in cpu.c (lxpanel-0.5.12.tar.gz)
int fscanf_result = fscanf(stat, "cpu %lu %lu %lu %lu", &cpu.u, &cpu.n, &cpu.s, &cpu.i);
The idle jiffie count has exceeded the unsigned long integer range (my
machine is 32-bit) and instead of wrapping nicely, fscanf() places
ULONG_MAX into the idle counter. That makes LXPanel believe the idle
jiffie count hasn't advanced at all; that is, cpu_delta.i = 0 in:
c->stats_cpu[c->ring_cursor] = cpu_uns / (cpu_uns + cpu_delta.i);
The simple fix is to specify:
typedef unsigned long long CPUTick; /* Value from /proc/stat */
and use %llu in fscanf().