library: allow negative delta values for 2, <STAT> api

A recent buglet in the <meminfo> interface, where many
delta values could legitimately be negative, suggested
a review of this module where a minus was forced to 0.

As it turns out, there are two delta items that indeed
could be negative. They involve the current processes.

So henceforth, DELTA_PROC_BLOCKED & DELTA_PROC_RUNNING
will now be allowed to go negative. I believe that all
other items can only grow. But, if we find more later,
at least the adaptation approach has been established.

[ this whole business of checking for less than zero ]
[ harks back to an old kernel anomaly where negative ]
[ tics were sometimes experienced. top was affected. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-05-11 18:18:18 -05:00 committed by Craig Small
parent 78043f6751
commit fac5e6fea0

View File

@ -170,9 +170,9 @@ SYS_set(SYS_PROC_RUNNING, ul_int, procs_running)
SYS_set(SYS_TIME_OF_BOOT, ul_int, btime)
SYS_hst(SYS_DELTA_CTX_SWITCHES, s_int, ctxt)
SYS_hst(SYS_DELTA_INTERRUPTS, s_int, intr)
SYS_hst(SYS_DELTA_PROC_BLOCKED, s_int, procs_blocked)
setDECL(SYS_DELTA_PROC_BLOCKED) { (void)T; R->result.s_int = S->new.procs_blocked - S->old.procs_blocked; }
SYS_hst(SYS_DELTA_PROC_CREATED, s_int, procs_created)
SYS_hst(SYS_DELTA_PROC_RUNNING, s_int, procs_running)
setDECL(SYS_DELTA_PROC_RUNNING) { (void)T; R->result.s_int = S->new.procs_running - S->old.procs_running; }
// ___ Controlling Table ||||||||||||||||||||||||||||||||||||||||||||||||||||||