diff options
author | Martin Baulig <martin@home-of-linux.org> | 1998-08-10 08:08:51 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1998-08-10 08:08:51 +0000 |
commit | 8b8ceec1bfe3d7040ee4054906fefa2bfb759a08 (patch) | |
tree | 9b5a63eea4eda923185d692d76b0be7c1ac2a291 | |
parent | 0bb5215f8471343ead00c6a589cbccce2e9b5326 (diff) | |
download | libgtop-8b8ceec1bfe3d7040ee4054906fefa2bfb759a08.tar.gz |
Added new fields `rtime' and `frequency'.
1998-08-10 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/proctime.h (glibtop_proc_time): Added new
fields `rtime' and `frequency'.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | examples/first.c | 35 | ||||
-rw-r--r-- | examples/second.c | 6 | ||||
-rw-r--r-- | features.def | 2 | ||||
-rw-r--r-- | include/glibtop/proctime.h | 20 | ||||
-rw-r--r-- | sysdeps/names/proctime.c | 23 |
6 files changed, 60 insertions, 31 deletions
@@ -1,3 +1,8 @@ +1998-08-10 Martin Baulig <martin@home-of-linux.org> + + * include/glibtop/proctime.h (glibtop_proc_time): Added new + fields `rtime' and `frequency'. + 1998-08-09 Martin Baulig <martin@home-of-linux.org> * include/glibtop/prockernel.h (glibtop_proc_kernel): Renamed diff --git a/examples/first.c b/examples/first.c index ebe2b4d4..cd83dbcf 100644 --- a/examples/first.c +++ b/examples/first.c @@ -31,6 +31,8 @@ #include <glibtop/union.h> #include <glibtop/sysdeps.h> +#include <sys/resource.h> + #ifndef PROFILE_COUNT #define PROFILE_COUNT 1 #endif @@ -42,6 +44,8 @@ main (int argc, char *argv []) glibtop_sysdeps sysdeps; unsigned c, method, count, port, i, *ptr; char buffer [BUFSIZ]; + struct rlimit rlim; + struct rusage ru; pid_t pid, ppid; count = PROFILE_COUNT; @@ -236,6 +240,13 @@ main (int argc, char *argv []) for (c = 0; c < PROFILE_COUNT; c++) glibtop_get_proc_mem (&data.proc_mem, pid); + getrlimit (RLIMIT_RSS, &rlim); + + fprintf (stderr, "GETRLIM: %lu - %lu - %lu\n", + (unsigned long) rlim.rlim_cur, + (unsigned long) rlim.rlim_max, + (unsigned long) ((1 << 63) - 1)); + printf ("Proc_Mem PID %5u (0x%08lx): " "%lu %lu %lu %lu %lu %lu\n", pid, (unsigned long) data.proc_mem.flags, @@ -246,19 +257,27 @@ main (int argc, char *argv []) (unsigned long) data.proc_mem.rss, (unsigned long) data.proc_mem.rss_rlim); + getrusage (RUSAGE_SELF, &ru); + + fprintf (stderr, "GETRUSAGE: (%ld, %ld) - (%ld, %ld)\n", + ru.ru_utime.tv_sec, ru.ru_utime.tv_usec, + ru.ru_stime.tv_sec, ru.ru_stime.tv_usec); + for (c = 0; c < PROFILE_COUNT; c++) glibtop_get_proc_time (&data.proc_time, pid); printf ("Proc_Time PID %5u (0x%08lx): " - "%lu %lu %lu %lu %lu %lu %lu\n", pid, + "%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", pid, (unsigned long) data.proc_time.flags, (unsigned long) data.proc_time.start_time, + (unsigned long) data.proc_time.rtime, (unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.timeout, - (unsigned long) data.proc_time.it_real_value); + (unsigned long) data.proc_time.it_real_value, + (unsigned long) data.proc_time.frequency); for (c = 0; c < PROFILE_COUNT; c++) glibtop_get_proc_signal (&data.proc_signal, pid); @@ -341,15 +360,17 @@ main (int argc, char *argv []) glibtop_get_proc_time (&data.proc_time, ppid); printf ("Proc_Time PPID %5u (0x%08lx): " - "%lu %lu %lu %lu %lu %lu %lu\n", ppid, + "%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", ppid, (unsigned long) data.proc_time.flags, (unsigned long) data.proc_time.start_time, + (unsigned long) data.proc_time.rtime, (unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.timeout, - (unsigned long) data.proc_time.it_real_value); + (unsigned long) data.proc_time.it_real_value, + (unsigned long) data.proc_time.frequency); for (c = 0; c < PROFILE_COUNT; c++) glibtop_get_proc_signal (&data.proc_signal, ppid); @@ -431,15 +452,17 @@ main (int argc, char *argv []) glibtop_get_proc_time (&data.proc_time, 1); printf ("Proc_Time INIT %5u (0x%08lx): " - "%lu %lu %lu %lu %lu %lu %lu\n", 1, + "%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", 1, (unsigned long) data.proc_time.flags, (unsigned long) data.proc_time.start_time, + (unsigned long) data.proc_time.rtime, (unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.timeout, - (unsigned long) data.proc_time.it_real_value); + (unsigned long) data.proc_time.it_real_value, + (unsigned long) data.proc_time.frequency); for (c = 0; c < PROFILE_COUNT; c++) glibtop_get_proc_signal (&data.proc_signal, 1); diff --git a/examples/second.c b/examples/second.c index 296e0584..6963bf98 100644 --- a/examples/second.c +++ b/examples/second.c @@ -118,15 +118,17 @@ main (int argc, char *argv []) glibtop_get_proc_time (&data.proc_time, pid); printf ("Proc_Time PID %5u (0x%08lx): " - "%lu %lu %lu %lu %lu %lu %lu\n", pid, + "%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", pid, (unsigned long) data.proc_time.flags, (unsigned long) data.proc_time.start_time, + (unsigned long) data.proc_time.rtime, (unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.timeout, - (unsigned long) data.proc_time.it_real_value); + (unsigned long) data.proc_time.it_real_value, + (unsigned long) data.proc_time.frequency); glibtop_get_proc_signal (&data.proc_signal, pid); diff --git a/features.def b/features.def index 20de6e05..97098458 100644 --- a/features.def +++ b/features.def @@ -10,7 +10,7 @@ unsigned *|proclist|ulong(number,size,total)|long(which,arg) void|proc_state|str(cmd):char(state):ulong(uid,gid)|pid_t(pid) void|proc_uid|long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)|pid_t(pid) void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid) -void|proc_time|long(start_time,utime,stime,cutime,cstime,timeout,it_real_value)|pid_t(pid) +void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency)|pid_t(pid) void|proc_signal|ulong(signal,blocked,sigignore,sigcatch)|pid_t(pid) void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid) void|proc_segment|long(trs,lrs,drs,dt):ulong(start_code,end_code,start_stack)|pid_t(pid) diff --git a/include/glibtop/proctime.h b/include/glibtop/proctime.h index c9dc3776..42521ae8 100644 --- a/include/glibtop/proctime.h +++ b/include/glibtop/proctime.h @@ -28,14 +28,16 @@ __BEGIN_DECLS #define GLIBTOP_PROC_TIME_START_TIME 0 -#define GLIBTOP_PROC_TIME_UTIME 1 -#define GLIBTOP_PROC_TIME_STIME 2 -#define GLIBTOP_PROC_TIME_CUTIME 3 -#define GLIBTOP_PROC_TIME_CSTIME 4 -#define GLIBTOP_PROC_TIME_TIMEOUT 5 -#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 6 +#define GLIBTOP_PROC_TIME_RTIME 1 +#define GLIBTOP_PROC_TIME_UTIME 2 +#define GLIBTOP_PROC_TIME_STIME 3 +#define GLIBTOP_PROC_TIME_CUTIME 4 +#define GLIBTOP_PROC_TIME_CSTIME 5 +#define GLIBTOP_PROC_TIME_TIMEOUT 6 +#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 7 +#define GLIBTOP_PROC_TIME_FREQUENCY 8 -#define GLIBTOP_MAX_PROC_TIME 7 +#define GLIBTOP_MAX_PROC_TIME 9 typedef struct _glibtop_proc_time glibtop_proc_time; @@ -46,6 +48,7 @@ struct _glibtop_proc_time u_int64_t flags, start_time, /* start time of process -- * seconds since 1-1-70 */ + rtime, /* real time accumulated by process */ utime, /* user-mode CPU time accumulated by process */ stime, /* kernel-mode CPU time accumulated by process */ cutime, /* cumulative utime of process and @@ -54,9 +57,10 @@ struct _glibtop_proc_time * reaped children */ timeout, /* The time (in jiffies) of the process's * next timeout */ - it_real_value; /* The time (in jiffies) before the + it_real_value, /* The time (in jiffies) before the * next SIGALRM is sent to the process * due to an interval timer. */ + frequency; /* Tick frequency. */ }; #define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time_l(glibtop_global_server, p1, p2) diff --git a/sysdeps/names/proctime.c b/sysdeps/names/proctime.c index 125d674e..42dc17ef 100644 --- a/sysdeps/names/proctime.c +++ b/sysdeps/names/proctime.c @@ -22,43 +22,38 @@ #include <glibtop.h> #include <glibtop/proctime.h> -#define GLIBTOP_PROC_TIME_START_TIME 0 -#define GLIBTOP_PROC_TIME_UTIME 1 -#define GLIBTOP_PROC_TIME_STIME 2 -#define GLIBTOP_PROC_TIME_CUTIME 3 -#define GLIBTOP_PROC_TIME_CSTIME 4 -#define GLIBTOP_PROC_TIME_TIMEOUT 5 -#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 6 - const char *glibtop_names_proc_time [GLIBTOP_MAX_PROC_TIME] = { - "start_time", "utime", "stime", "cutime", "cstime", - "timeout", "it_real_value" + "start_time", "rtime", "utime", "stime", "cutime", "cstime", + "timeout", "it_real_value", "timeout" }; const unsigned glibtop_types_proc_time [GLIBTOP_MAX_PROC_TIME] = { GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG, - GLIBTOP_TYPE_LONG + GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG }; const char *glibtop_labels_proc_time [GLIBTOP_MAX_PROC_TIME] = { - N_("Start_Time"), N_("UTime"), N_("STime"), N_("CUTime"), - N_("CSTime"), N_("TimeOut"), N_("It_Real_Value") + N_("Start_Time"), N_("RTime"), N_("UTime"), N_("STime"), + N_("CUTime"), N_("CSTime"), N_("TimeOut"), N_("It_Real_Value"), + N_("Frequency") }; const char *glibtop_descriptions_proc_time [GLIBTOP_MAX_PROC_TIME] = { N_("Start time of process in seconds since the epoch"), + N_("Read time accumulated by process (should be utime + stime)"), N_("user-mode CPU time accumulated by process"), N_("kernel-mode CPU time accumulated by process"), N_("cumulative utime of process and reaped children"), N_("cumulative stime of process and reaped children"), N_("The time (in jiffies) of the process's next timeout"), N_("The time (in jiffies) before the next SIGALRM is sent " - "to the process due to an interval timer.") + "to the process due to an interval timer."), + N_("Tick frequency") }; |