library: ain't like your father's delta, <MEMINFO> api

When the code for DELTA values (among other stuff) was
stolen from the recently revised <stat> interface, the
concept of ever growing values was propagated too. But
here we must manage both growing and shrinking values.

Thus former protections against a negative delta don't
have any place in this module and are hereby banished.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-05-11 17:17:17 -05:00 committed by Craig Small
parent 201208cbc1
commit 93a60022dc

View File

@ -124,8 +124,7 @@ struct procps_meminfo {
// regular assignment
#define MEM_set(e,t,x) setDECL(e) { R->result. t = H->new . x; }
// delta assignment
#define HST_set(e,t,x) setDECL(e) { R->result. t = ( H->new . x - H->old. x ); \
if (R->result. t < 0) R->result. t = 0; }
#define HST_set(e,t,x) setDECL(e) { R->result. t = ( H->new . x - H->old. x ); }
setDECL(noop) { (void)R; (void)H; }
setDECL(extra) { (void)R; (void)H; }
@ -233,8 +232,7 @@ MEM_set(SWAP_USED, ul_int, derived_swap_used)
// regular get
#define MEM_get(e,x) getDECL(e) { return I->mem_hist.new. x; }
// delta get
#define HST_get(e,x) getDECL(e) { int n = I->mem_hist.new. x - I->mem_hist.old. x; \
return ( n < 0 ? 0 : n ); }
#define HST_get(e,x) getDECL(e) { return ( I->mem_hist.new. x - I->mem_hist.old. x ); }
getDECL(noop) { (void)I; return 0; }
getDECL(extra) { (void)I; return 0; }