From fdf313cdf618ab7ef971b73cecc0fd1162ef162b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Tue, 26 Oct 2004 20:26:25 +0000 Subject: Set .rtime. At last ! * proctime.c: (glibtop_get_proc_time_s): Set .rtime. At last ! --- sysdeps/linux/ChangeLog | 4 ++++ sysdeps/linux/proctime.c | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sysdeps/linux/ChangeLog b/sysdeps/linux/ChangeLog index 2a65c200..a55771c5 100644 --- a/sysdeps/linux/ChangeLog +++ b/sysdeps/linux/ChangeLog @@ -1,3 +1,7 @@ +2004-10-26 Benoît Dejean + + * proctime.c: (glibtop_get_proc_time_s): Set .rtime. At last ! + 2004-09-24 Benoît Dejean * loadavg.c: (glibtop_get_loadavg_s): diff --git a/sysdeps/linux/proctime.c b/sysdeps/linux/proctime.c index d7e14e94..9e7b6910 100644 --- a/sysdeps/linux/proctime.c +++ b/sysdeps/linux/proctime.c @@ -28,6 +28,7 @@ static const unsigned long _glibtop_sysdeps_proc_time = (1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_CUTIME) + +(1L << GLIBTOP_PROC_TIME_RTIME) + (1L << GLIBTOP_PROC_TIME_STIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) + (1L << GLIBTOP_PROC_TIME_FREQUENCY) + (1L << GLIBTOP_PROC_TIME_TIMEOUT) + (1L << GLIBTOP_PROC_TIME_IT_REAL_VALUE) + (1L << GLIBTOP_PROC_TIME_START_TIME); @@ -69,6 +70,8 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid) /* clock_t (1/100 s) */ buf->utime = strtoull (p, &p, 0); buf->stime = strtoull (p, &p, 0); + buf->rtime = buf->utime + buf->stime; + buf->cutime = strtoull (p, &p, 0); buf->cstime = strtoull (p, &p, 0); @@ -117,12 +120,11 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid) if (!server->ncpu) return; + /* FIXME: doesn't work with 2.6 */ if (proc_file_to_buffer (buffer, "/proc/%d/cpu", pid)) return; - p = skip_token (buffer); - buf->utime = strtoull (p, &p, 0); - buf->stime = strtoull (p, &p, 0); + p = skip_multiple_token (p, 3); for (i = 0; i < GLIBTOP_NCPU; i++) { if (strncmp (p+1, "cpu", 3) || !isdigit (p [4])) -- cgit v1.2.1