summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoît Dejean <bdejean@src.gnome.org>2005-08-15 00:09:47 +0000
committerBenoît Dejean <bdejean@src.gnome.org>2005-08-15 00:09:47 +0000
commit3e77f3cf13473d4c76802faa52f09429c8efef54 (patch)
treefd2d1a954a02f5c4e93d665a8104a6ca86b56a51
parent22a1120348bad561b8f730b8e1f0416542086c9b (diff)
downloadlibgtop-3e77f3cf13473d4c76802faa52f09429c8efef54.tar.gz
Do not add irq, softirq and iowait to idle.
* cpu.c: (glibtop_get_cpu_s): Do not add irq, softirq and iowait to idle.
-rw-r--r--sysdeps/linux/ChangeLog6
-rw-r--r--sysdeps/linux/cpu.c20
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 <benoit@placenet.org>
+
+ * cpu.c: (glibtop_get_cpu_s):
+
+ Do not add irq, softirq and iowait to idle.
+
2005-08-04 Benoît Dejean <TazForEver@dlfp.org>
* 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 */