From f3be4b50a9c1bfc2489ac5352108d95977d2d4bb Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 9 Mar 2004 23:44:12 +0000 Subject: [PATCH] fixup CPU usage calculation on 2.6 kernels (patch by Benoit Dejean 2004-03-09 Bastien Nocera * cpu.c: (glibtop_get_cpu_s): fixup CPU usage calculation on 2.6 kernels (patch by Benoit Dejean ) (Closes: #134252) --- sysdeps/linux/ChangeLog | 5 +++++ sysdeps/linux/cpu.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sysdeps/linux/ChangeLog b/sysdeps/linux/ChangeLog index 5be66700..e71ba1d4 100644 --- a/sysdeps/linux/ChangeLog +++ b/sysdeps/linux/ChangeLog @@ -1,3 +1,8 @@ +2004-03-09 Bastien Nocera + + * cpu.c: (glibtop_get_cpu_s): fixup CPU usage calculation on 2.6 + kernels (patch by Benoit Dejean ) (Closes: #134252) + 2004-03-04 Bastien Nocera * ppp.c: use a config.h define instead of copying the values in diff --git a/sysdeps/linux/cpu.c b/sysdeps/linux/cpu.c index 4669f6f3..80088a2d 100644 --- a/sysdeps/linux/cpu.c +++ b/sysdeps/linux/cpu.c @@ -80,6 +80,11 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->sys = strtoull (p, &p, 0); buf->idle = strtoull (p, &p, 0); + /* 2.6 kernel */ + buf->idle += strtoull(p, &p, 0); /* "iowait" */ + buf->sys += strtoull(p, &p, 0); /* "irq" */ + buf->sys += strtoull(p, &p, 0); /* "softirq" */ + total = buf->user; total += buf->nice; total += buf->sys;