diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2004-10-26 20:26:25 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2004-10-26 20:26:25 +0000 |
commit | fdf313cdf618ab7ef971b73cecc0fd1162ef162b (patch) | |
tree | a9748225b9e8353df4743c24548382bf18f2b441 | |
parent | 9a6bb02fb1a0bf1f9da06d9a5cc8f84186820454 (diff) | |
download | libgtop-GNOME_2_8_ANCHOR.tar.gz |
Set .rtime. At last !LIBGTOP_2_8_1GNOME_2_8_ANCHOR
* proctime.c: (glibtop_get_proc_time_s): Set .rtime. At last !
-rw-r--r-- | sysdeps/linux/ChangeLog | 4 | ||||
-rw-r--r-- | 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 <tazforever@dlfp.org> + + * proctime.c: (glibtop_get_proc_time_s): Set .rtime. At last ! + 2004-09-24 Benoît Dejean <tazforever@dlfp.org> * 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])) |