Do not add irq, softirq and iowait to idle.

* cpu.c: (glibtop_get_cpu_s):

	Do not add irq, softirq and iowait to idle.
This commit is contained in:
Benoît Dejean
2005-08-15 00:09:47 +00:00
parent 22a1120348
commit 3e77f3cf13
2 changed files with 15 additions and 11 deletions

View File

@@ -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> 2005-08-04 Benoît Dejean <TazForEver@dlfp.org>
* open.c: (set_linux_version), (glibtop_open_s): * open.c: (set_linux_version), (glibtop_open_s):

View File

@@ -91,6 +91,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
buf->nice = strtoull (p, &p, 0); buf->nice = strtoull (p, &p, 0);
buf->sys = strtoull (p, &p, 0); buf->sys = strtoull (p, &p, 0);
buf->idle = strtoull (p, &p, 0); buf->idle = strtoull (p, &p, 0);
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
/* 2.6 kernel */ /* 2.6 kernel */
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0)) 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->irq = strtoull(p, &p, 0);
buf->softirq = strtoull(p, &p, 0); buf->softirq = strtoull(p, &p, 0);
buf->idle += buf->iowait; buf->total += buf->iowait + buf->irq + buf->softirq;
buf->sys += buf->irq + buf->softirq;
} }
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
buf->frequency = 100; buf->frequency = 100;
buf->flags = _glibtop_sysdeps_cpu; 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_nice [i] = strtoull (p, &p, 0);
buf->xcpu_sys [i] = strtoull (p, &p, 0); buf->xcpu_sys [i] = strtoull (p, &p, 0);
buf->xcpu_idle [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 */ /* 2.6 kernel */
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0)) 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_irq [i] = strtoull(p, &p, 0);
buf->xcpu_softirq [i] = strtoull(p, &p, 0); buf->xcpu_softirq [i] = strtoull(p, &p, 0);
buf->xcpu_idle [i] += buf->xcpu_iowait [i]; buf->xcpu_total [i] += buf->xcpu_iowait [i] \
buf->xcpu_sys [i] += buf->xcpu_irq [i] + buf->xcpu_softirq [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 */ if(i >= 2) /* ok, that's a real SMP */