library: allow negative system DELTA stats, <STAT> api
All TIC delta fields are checked for possible negative results and set to zero when found. This is done so as to protect against potential anomalies which depend on kernel version and/or toggling cpus offline or online. [ it's probably unnecessary with the latest kernels, ] [ except for iowait. documentation suggests it might ] [ decrease which would then create a negative delta. ] The same approach is employed for most of the 'system' deltas (ctxt, intr & procs_created). However, with two of the fields (procs_blocked & procs_running) negative results were allowed. But it now seems such a division is unwise so this patch will allow all to go negative. [ rather than force any 'system' delta value to show ] [ what's logical, we'll now let all reflect reality. ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
5c37e2d42d
commit
12b6452135
@ -154,8 +154,7 @@ struct stat_info {
|
||||
(void)S; R->result. t = ( T->new. x - T->old. x ); \
|
||||
if (R->result. t < 0) R->result. t = 0; }
|
||||
#define SYSsetH(e,t,x) setDECL(e) { \
|
||||
(void)T; R->result. t = ( S->new. x - S->old. x ); \
|
||||
if (R->result. t < 0) R->result. t = 0; }
|
||||
(void)T; R->result. t = ( S->new. x - S->old. x ); }
|
||||
|
||||
setDECL(noop) { (void)R; (void)S; (void)T; }
|
||||
setDECL(extra) { (void)S; (void)T; R->result.ull_int = 0; }
|
||||
@ -207,9 +206,9 @@ SYS_set(SYS_TIME_OF_BOOT, ul_int, btime)
|
||||
|
||||
SYSsetH(SYS_DELTA_CTX_SWITCHES, s_int, ctxt)
|
||||
SYSsetH(SYS_DELTA_INTERRUPTS, s_int, intr)
|
||||
setDECL(SYS_DELTA_PROC_BLOCKED) { (void)T; R->result.s_int = S->new.procs_blocked - S->old.procs_blocked; }
|
||||
SYSsetH(SYS_DELTA_PROC_BLOCKED, s_int, procs_blocked)
|
||||
SYSsetH(SYS_DELTA_PROC_CREATED, s_int, procs_created)
|
||||
setDECL(SYS_DELTA_PROC_RUNNING) { (void)T; R->result.s_int = S->new.procs_running - S->old.procs_running; }
|
||||
SYSsetH(SYS_DELTA_PROC_RUNNING, s_int, procs_running)
|
||||
|
||||
#undef setDECL
|
||||
#undef TIC_set
|
||||
|
Loading…
Reference in New Issue
Block a user