From 331e128116126a2bc4c93f370f2bae45b99e01ab Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Sun, 11 Jul 1999 18:28:18 +0000 Subject: [PATCH] Applied patch from Damon Chaplin to avoid a compiler problem. --- sysdeps/linux/cpu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sysdeps/linux/cpu.c b/sysdeps/linux/cpu.c index a362dc0f..012670ad 100644 --- a/sysdeps/linux/cpu.c +++ b/sysdeps/linux/cpu.c @@ -55,6 +55,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) { char buffer [BUFSIZ], *p; int fd, len, i; + u_int64_t total; glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0); @@ -79,7 +80,11 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->sys = strtoul (p, &p, 0); buf->idle = strtoul (p, &p, 0); - buf->total = buf->user + buf->nice + buf->sys + buf->idle; + total = buf->user; + total += buf->nice; + total += buf->sys; + total += buf->idle; + buf->total = total; buf->frequency = 100; buf->flags = _glibtop_sysdeps_cpu; @@ -94,8 +99,12 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) buf->xcpu_sys [i] = strtoul (p, &p, 0); buf->xcpu_idle [i] = strtoul (p, &p, 0); - buf->xcpu_total [i] = buf->xcpu_user [i] + buf->xcpu_nice [i] + - buf->xcpu_sys [i] + buf->xcpu_idle [i]; + total = buf->xcpu_user [i]; + total += buf->xcpu_nice [i]; + total += buf->xcpu_sys [i]; + total += buf->xcpu_idle [i]; + + buf->xcpu_total [i] = total; } buf->flags |= _glibtop_sysdeps_cpu_smp;