From 89e79ee51ff89355375496a4b779248977f1b305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Wed, 10 Mar 2004 00:15:39 +0000 Subject: [PATCH] fixup CPU usage calculation on 2.6 kernels (patch by Benoit Dejean * cpu.c: (glibtop_get_cpu_s): fixup CPU usage calculation on 2.6 kernels (patch by Benoit Dejean ) (Closes: #134252) (again) --- sysdeps/linux/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysdeps/linux/cpu.c b/sysdeps/linux/cpu.c index 80088a2d..36d1b507 100644 --- a/sysdeps/linux/cpu.c +++ b/sysdeps/linux/cpu.c @@ -104,6 +104,11 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->xcpu_sys [i] = strtoull (p, &p, 0); buf->xcpu_idle [i] = strtoull (p, &p, 0); + /* 2.6 kernel */ + buf->xcpu_idle [i] += strtoull(p, &p, 0); /* "iowait" */ + buf->xcpu_sys [i] += strtoull(p, &p, 0); /* "irq" */ + buf->xcpu_sys [i] += strtoull(p, &p, 0); /* "softirq" */ + total = buf->xcpu_user [i]; total += buf->xcpu_nice [i]; total += buf->xcpu_sys [i];