From fac5e6fea01548c1de0551ef3b7a3516453ae987 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Wed, 11 May 2016 18:18:18 -0500 Subject: [PATCH] library: allow negative delta values for 2, api A recent buglet in the 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 --- proc/stat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/proc/stat.c b/proc/stat.c index c43cbace..b3b70914 100644 --- a/proc/stat.c +++ b/proc/stat.c @@ -136,11 +136,11 @@ struct procps_statinfo { (void)T; R->result. t = ( S->new . x - S->old. x ); \ if (R->result. t < 0) R->result. t = 0; } -setDECL(noop) { (void)R; (void)S; (void)T; } -setDECL(extra) { (void)R; (void)S; (void)T; } +setDECL(noop) { (void)R; (void)S; (void)T; } +setDECL(extra) { (void)R; (void)S; (void)T; } -setDECL(TIC_ID) { (void)S; R->result.s_int = T->id; } -setDECL(TIC_NUMA_NODE) { (void)S; R->result.s_int = T->numa_node; } +setDECL(TIC_ID) { (void)S; R->result.s_int = T->id; } +setDECL(TIC_NUMA_NODE) { (void)S; R->result.s_int = T->numa_node; } TIC_set(TIC_USER, ull_int, user) TIC_set(TIC_NICE, ull_int, nice) TIC_set(TIC_SYSTEM, ull_int, system) @@ -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 ||||||||||||||||||||||||||||||||||||||||||||||||||||||