From 3e77f3cf13473d4c76802faa52f09429c8efef54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Mon, 15 Aug 2005 00:09:47 +0000 Subject: [PATCH] Do not add irq, softirq and iowait to idle. * cpu.c: (glibtop_get_cpu_s): Do not add irq, softirq and iowait to idle. --- sysdeps/linux/ChangeLog | 6 ++++++ sysdeps/linux/cpu.c | 20 +++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sysdeps/linux/ChangeLog b/sysdeps/linux/ChangeLog index 9a933d5b..8a2d7985 100644 --- a/sysdeps/linux/ChangeLog +++ b/sysdeps/linux/ChangeLog @@ -1,3 +1,9 @@ +2005-08-15 Benoît Dejean + + * cpu.c: (glibtop_get_cpu_s): + + Do not add irq, softirq and iowait to idle. + 2005-08-04 Benoît Dejean * open.c: (set_linux_version), (glibtop_open_s): diff --git a/sysdeps/linux/cpu.c b/sysdeps/linux/cpu.c index e84ae2b9..eb13ab9d 100644 --- a/sysdeps/linux/cpu.c +++ b/sysdeps/linux/cpu.c @@ -91,6 +91,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->nice = strtoull (p, &p, 0); buf->sys = strtoull (p, &p, 0); buf->idle = strtoull (p, &p, 0); + buf->total = buf->user + buf->nice + buf->sys + buf->idle; /* 2.6 kernel */ if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0)) @@ -99,12 +100,9 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->irq = strtoull(p, &p, 0); buf->softirq = strtoull(p, &p, 0); - buf->idle += buf->iowait; - buf->sys += buf->irq + buf->softirq; + buf->total += buf->iowait + buf->irq + buf->softirq; } - buf->total = buf->user + buf->nice + buf->sys + buf->idle; - buf->frequency = 100; buf->flags = _glibtop_sysdeps_cpu; @@ -125,6 +123,10 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->xcpu_nice [i] = strtoull (p, &p, 0); buf->xcpu_sys [i] = strtoull (p, &p, 0); buf->xcpu_idle [i] = strtoull (p, &p, 0); + buf->xcpu_total[i] = buf->xcpu_user [i] \ + + buf->xcpu_nice [i] \ + + buf->xcpu_sys [i] \ + + buf->xcpu_idle [i]; /* 2.6 kernel */ if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0)) @@ -133,14 +135,10 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->xcpu_irq [i] = strtoull(p, &p, 0); buf->xcpu_softirq [i] = strtoull(p, &p, 0); - buf->xcpu_idle [i] += buf->xcpu_iowait [i]; - buf->xcpu_sys [i] += buf->xcpu_irq [i] + buf->xcpu_softirq [i]; + buf->xcpu_total [i] += buf->xcpu_iowait [i] \ + + buf->xcpu_irq [i] \ + + buf->xcpu_softirq [i]; } - - buf->xcpu_total[i] = buf->xcpu_user [i] \ - + buf->xcpu_nice [i] \ - + buf->xcpu_sys [i] \ - + buf->xcpu_idle [i]; } if(i >= 2) /* ok, that's a real SMP */