Set .rtime. At last !
* proctime.c: (glibtop_get_proc_time_s): Set .rtime. At last !
This commit is contained in:
@@ -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>
|
2004-09-24 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
* loadavg.c: (glibtop_get_loadavg_s):
|
* loadavg.c: (glibtop_get_loadavg_s):
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
static const unsigned long _glibtop_sysdeps_proc_time =
|
static const unsigned long _glibtop_sysdeps_proc_time =
|
||||||
(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_CUTIME) +
|
(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_STIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) +
|
||||||
(1L << GLIBTOP_PROC_TIME_FREQUENCY) + (1L << GLIBTOP_PROC_TIME_TIMEOUT) +
|
(1L << GLIBTOP_PROC_TIME_FREQUENCY) + (1L << GLIBTOP_PROC_TIME_TIMEOUT) +
|
||||||
(1L << GLIBTOP_PROC_TIME_IT_REAL_VALUE) + (1L << GLIBTOP_PROC_TIME_START_TIME);
|
(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) */
|
/* clock_t (1/100 s) */
|
||||||
buf->utime = strtoull (p, &p, 0);
|
buf->utime = strtoull (p, &p, 0);
|
||||||
buf->stime = strtoull (p, &p, 0);
|
buf->stime = strtoull (p, &p, 0);
|
||||||
|
buf->rtime = buf->utime + buf->stime;
|
||||||
|
|
||||||
buf->cutime = strtoull (p, &p, 0);
|
buf->cutime = strtoull (p, &p, 0);
|
||||||
buf->cstime = 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)
|
if (!server->ncpu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* FIXME: doesn't work with 2.6 */
|
||||||
if (proc_file_to_buffer (buffer, "/proc/%d/cpu", pid))
|
if (proc_file_to_buffer (buffer, "/proc/%d/cpu", pid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = skip_token (buffer);
|
p = skip_multiple_token (p, 3);
|
||||||
buf->utime = strtoull (p, &p, 0);
|
|
||||||
buf->stime = strtoull (p, &p, 0);
|
|
||||||
|
|
||||||
for (i = 0; i < GLIBTOP_NCPU; i++) {
|
for (i = 0; i < GLIBTOP_NCPU; i++) {
|
||||||
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
|
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
|
||||||
|
Reference in New Issue
Block a user