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'.
This commit is contained in:
Martin Baulig
1998-08-10 08:08:51 +00:00
committed by Martin Baulig
parent 0bb5215f84
commit 8b8ceec1bf
6 changed files with 60 additions and 31 deletions

View File

@@ -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> 1998-08-09 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/prockernel.h (glibtop_proc_kernel): Renamed * include/glibtop/prockernel.h (glibtop_proc_kernel): Renamed

View File

@@ -31,6 +31,8 @@
#include <glibtop/union.h> #include <glibtop/union.h>
#include <glibtop/sysdeps.h> #include <glibtop/sysdeps.h>
#include <sys/resource.h>
#ifndef PROFILE_COUNT #ifndef PROFILE_COUNT
#define PROFILE_COUNT 1 #define PROFILE_COUNT 1
#endif #endif
@@ -42,6 +44,8 @@ main (int argc, char *argv [])
glibtop_sysdeps sysdeps; glibtop_sysdeps sysdeps;
unsigned c, method, count, port, i, *ptr; unsigned c, method, count, port, i, *ptr;
char buffer [BUFSIZ]; char buffer [BUFSIZ];
struct rlimit rlim;
struct rusage ru;
pid_t pid, ppid; pid_t pid, ppid;
count = PROFILE_COUNT; count = PROFILE_COUNT;
@@ -236,6 +240,13 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++) for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, pid); 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): " printf ("Proc_Mem PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", pid, "%lu %lu %lu %lu %lu %lu\n", pid,
(unsigned long) data.proc_mem.flags, (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,
(unsigned long) data.proc_mem.rss_rlim); (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++) for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, pid); glibtop_get_proc_time (&data.proc_time, pid);
printf ("Proc_Time PID %5u (0x%08lx): " 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.flags,
(unsigned long) data.proc_time.start_time, (unsigned long) data.proc_time.start_time,
(unsigned long) data.proc_time.rtime,
(unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.utime,
(unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.stime,
(unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cutime,
(unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.cstime,
(unsigned long) data.proc_time.timeout, (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++) for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, pid); 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); glibtop_get_proc_time (&data.proc_time, ppid);
printf ("Proc_Time PPID %5u (0x%08lx): " 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.flags,
(unsigned long) data.proc_time.start_time, (unsigned long) data.proc_time.start_time,
(unsigned long) data.proc_time.rtime,
(unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.utime,
(unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.stime,
(unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cutime,
(unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.cstime,
(unsigned long) data.proc_time.timeout, (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++) for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, ppid); 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); glibtop_get_proc_time (&data.proc_time, 1);
printf ("Proc_Time INIT %5u (0x%08lx): " 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.flags,
(unsigned long) data.proc_time.start_time, (unsigned long) data.proc_time.start_time,
(unsigned long) data.proc_time.rtime,
(unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.utime,
(unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.stime,
(unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cutime,
(unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.cstime,
(unsigned long) data.proc_time.timeout, (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++) for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, 1); glibtop_get_proc_signal (&data.proc_signal, 1);

View File

@@ -118,15 +118,17 @@ main (int argc, char *argv [])
glibtop_get_proc_time (&data.proc_time, pid); glibtop_get_proc_time (&data.proc_time, pid);
printf ("Proc_Time PID %5u (0x%08lx): " 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.flags,
(unsigned long) data.proc_time.start_time, (unsigned long) data.proc_time.start_time,
(unsigned long) data.proc_time.rtime,
(unsigned long) data.proc_time.utime, (unsigned long) data.proc_time.utime,
(unsigned long) data.proc_time.stime, (unsigned long) data.proc_time.stime,
(unsigned long) data.proc_time.cutime, (unsigned long) data.proc_time.cutime,
(unsigned long) data.proc_time.cstime, (unsigned long) data.proc_time.cstime,
(unsigned long) data.proc_time.timeout, (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); glibtop_get_proc_signal (&data.proc_signal, pid);

View File

@@ -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_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_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_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_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_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) void|proc_segment|long(trs,lrs,drs,dt):ulong(start_code,end_code,start_stack)|pid_t(pid)

View File

@@ -28,14 +28,16 @@
__BEGIN_DECLS __BEGIN_DECLS
#define GLIBTOP_PROC_TIME_START_TIME 0 #define GLIBTOP_PROC_TIME_START_TIME 0
#define GLIBTOP_PROC_TIME_UTIME 1 #define GLIBTOP_PROC_TIME_RTIME 1
#define GLIBTOP_PROC_TIME_STIME 2 #define GLIBTOP_PROC_TIME_UTIME 2
#define GLIBTOP_PROC_TIME_CUTIME 3 #define GLIBTOP_PROC_TIME_STIME 3
#define GLIBTOP_PROC_TIME_CSTIME 4 #define GLIBTOP_PROC_TIME_CUTIME 4
#define GLIBTOP_PROC_TIME_TIMEOUT 5 #define GLIBTOP_PROC_TIME_CSTIME 5
#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 6 #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; typedef struct _glibtop_proc_time glibtop_proc_time;
@@ -46,6 +48,7 @@ struct _glibtop_proc_time
u_int64_t flags, u_int64_t flags,
start_time, /* start time of process -- start_time, /* start time of process --
* seconds since 1-1-70 */ * seconds since 1-1-70 */
rtime, /* real time accumulated by process */
utime, /* user-mode CPU time accumulated by process */ utime, /* user-mode CPU time accumulated by process */
stime, /* kernel-mode CPU time accumulated by process */ stime, /* kernel-mode CPU time accumulated by process */
cutime, /* cumulative utime of process and cutime, /* cumulative utime of process and
@@ -54,9 +57,10 @@ struct _glibtop_proc_time
* reaped children */ * reaped children */
timeout, /* The time (in jiffies) of the process's timeout, /* The time (in jiffies) of the process's
* next timeout */ * 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 * next SIGALRM is sent to the process
* due to an interval timer. */ * 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) #define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time_l(glibtop_global_server, p1, p2)

View File

@@ -22,43 +22,38 @@
#include <glibtop.h> #include <glibtop.h>
#include <glibtop/proctime.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] = const char *glibtop_names_proc_time [GLIBTOP_MAX_PROC_TIME] =
{ {
"start_time", "utime", "stime", "cutime", "cstime", "start_time", "rtime", "utime", "stime", "cutime", "cstime",
"timeout", "it_real_value" "timeout", "it_real_value", "timeout"
}; };
const unsigned glibtop_types_proc_time [GLIBTOP_MAX_PROC_TIME] = 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, 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] = const char *glibtop_labels_proc_time [GLIBTOP_MAX_PROC_TIME] =
{ {
N_("Start_Time"), N_("UTime"), N_("STime"), N_("CUTime"), N_("Start_Time"), N_("RTime"), N_("UTime"), N_("STime"),
N_("CSTime"), N_("TimeOut"), N_("It_Real_Value") N_("CUTime"), N_("CSTime"), N_("TimeOut"), N_("It_Real_Value"),
N_("Frequency")
}; };
const char *glibtop_descriptions_proc_time [GLIBTOP_MAX_PROC_TIME] = const char *glibtop_descriptions_proc_time [GLIBTOP_MAX_PROC_TIME] =
{ {
N_("Start time of process in seconds since the epoch"), 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_("user-mode CPU time accumulated by process"),
N_("kernel-mode CPU time accumulated by process"), N_("kernel-mode CPU time accumulated by process"),
N_("cumulative utime of process and reaped children"), N_("cumulative utime of process and reaped children"),
N_("cumulative stime 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) of the process's next timeout"),
N_("The time (in jiffies) before the next SIGALRM is sent " 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")
}; };