library: normalize & minimize result types, <PIDS> api

This commit attempts to minimize the variety of types
currently used. Plus, the following were also changed:

. the MEM fields were switched to parallel the VM guys
. PIDS_MEM_VIRT -> PIDS_MEM_VIRT_PGS
. PIDS_MEM_VIRT_KIB -> PIDS_MEM_VIRT

. made NICE 's_int' so that it then parallels PRIORITY

. change RTPRIO & SCHED_CLASS from 'ul_int' to 's_int'

. removed Item_table 'oldflags' for an obsoleted field
. PIDS_WCHAN_ADDR

. added calculations like TICS_ALL_C for the following
. PIDS_TICS_USER_C
. PIDS_TICS_SYSTEM_C

. these three new 'TICS' fields have been incorporated
. PIDS_TICS_BLKIO - jiffies spent in block i/o
. PIDS_TICS_GUEST - jiffies spent as a guest
. PIDS_TICS_GUEST_C - as above, includes dead children

. that PIDS_TICS_DELTA was renamed PIDS_TICS_ALL_DELTA
( so it did not hide between TICS_BLKIO & TICS_GUEST )
( and to make clearer what's included: utime + stime )

. eliminated 'sl_int' entirely from that result struct

[ often, the <pids> module changes necessitated that ]
[ readproc header and source files had to change too ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-07-31 00:00:00 -05:00
committed by Craig Small
parent 01beb85f7d
commit c4aa6c0ab4
4 changed files with 179 additions and 176 deletions

View File

@ -21,13 +21,6 @@
__BEGIN_DECLS
// ld cutime, cstime, priority, nice, timeout, alarm, rss,
// c state,
// d ppid, pgrp, session, tty, tpgid,
// s signal, blocked, sigignore, sigcatch,
// lu flags, min_flt, cmin_flt, maj_flt, cmaj_flt, utime, stime,
// lu rss_rlim, start_code, end_code, start_stack, kstk_esp, kstk_eip,
// lu start_time, vsize, wchan,
// This is to help document a transition from pid to tgid/tid caused
// by the introduction of thread support. It is used in cases where
@ -44,11 +37,6 @@ typedef struct proc_t {
int
tid, // (special) task id, the POSIX thread ID (see also: tgid)
ppid; // stat,status pid of parent process
long // next 2 fields are NOT filled in by readproc
maj_delta, // stat (special) major page faults since last update
min_delta; // stat (special) minor page faults since last update
unsigned
pcpu; // stat (special) %CPU usage (is not filled in by readproc!!!)
char
state, // stat,status single-char code for process state (S=sleeping)
#ifdef FALSE_THREADS
@ -65,7 +53,14 @@ typedef struct proc_t {
// and so on...
cutime, // stat cumulative utime of process and reaped children
cstime, // stat cumulative stime of process and reaped children
start_time; // stat start time of process -- seconds since 1-1-70
start_time, // stat start time of process -- seconds since 1-1-70
blkio_tics, // stat time spent waiting for block IO
gtime, // stat guest time of the task in jiffies
cgtime; // stat guest time of the task children in jiffies
int // next 3 fields are NOT filled in by readproc
pcpu, // stat (special) elapsed tics for %CPU usage calculation
maj_delta, // stat (special) major page faults since last update
min_delta; // stat (special) minor page faults since last update
#ifdef SIGNAL_STRING
char
// Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding.
@ -89,12 +84,13 @@ typedef struct proc_t {
start_stack, // stat address of the bottom of stack for the process
kstk_esp, // stat kernel stack pointer
kstk_eip, // stat kernel instruction pointer
wchan; // stat (special) address of kernel wait channel proc is sleeping in
long
priority, // stat kernel scheduling priority
nice, // stat standard unix nice level of process
wchan, // stat (special) address of kernel wait channel proc is sleeping in
rss, // stat identical to 'resident'
alarm, // stat ?
alarm; // stat ?
int
priority, // stat kernel scheduling priority
nice; // stat standard unix nice level of process
unsigned long
// the next 7 members come from /proc/#/statm
size, // statm total virtual memory (as # pages)
resident, // statm resident non-swapped memory (as # pages)
@ -103,7 +99,7 @@ typedef struct proc_t {
lrs, // statm library resident set (always 0 w/ 2.6)
drs, // statm data+stack resident set (as # pages)
dt; // statm dirty pages (always 0 w/ 2.6)
long
unsigned long
vm_size, // status equals 'size' (as kb)
vm_lock, // status locked pages (as kb)
vm_rss, // status equals 'rss' and/or 'resident' (as kb)
@ -115,8 +111,6 @@ typedef struct proc_t {
vm_swap, // status based on linux-2.6.34 "swap ents" (as kb)
vm_exe, // status equals 'trs' (as kb)
vm_lib, // status total, not just used, library pages (as kb)
rtprio, // stat real-time priority
sched, // stat scheduling class
vsize, // stat number of pages of virtual memory ...
rss_rlim, // stat resident set size limit?
flags, // stat kernel flags for the process
@ -145,6 +139,8 @@ typedef struct proc_t {
*fgroup, // status filesystem group name
*cmd; // stat,status basename of executable file in call to exec(2)
int
rtprio, // stat real-time priority
sched, // stat scheduling class
pgrp, // stat process group id
session, // stat session id
nlwp, // stat,status number of threads, or 0 if no clue