procps/proc
Jim Warner 253ac7f709 library: improve <STAT> cpus offline/online management
When those standardized 'derived' TIC enumerators were
introduced, a problem with potential DELTA distortions
was also introduced when toggling cpus offline/online.

It has always been true that the 1st (summary) line in
/proc/stat will experience a decrease in total tics if
a new cpu is brought online. Such decreases are mostly
due to reductions in 'idle' and 'iowait' tics. Exactly
why such a counterintuitive phenomenon should occur is
a mystery, but this has been acknowledged in proc.txt.

A separate potential distortion arises with individual
cpus. And, here it extends to both bringing processors
online plus taking them offline too. When that happens
the order of the cpus array tracking is upset, placing
the 'new' values in some other processor's array slot.
But even if we were to occupy the same slot, the issue
regarding reductions in 'idle' & 'iowait' still apply.

In all cases, when a DELTA field was found to be minus
it was forced to zero via the 'TICsetH' macro. However
the 'derived' calculations are subject to new forms of
distortion with their own DELTA values. For example we
could find DELTA_SUM_USER + DELTA_SUM_SYSTEM exceeding
DELTA_SUM_TOTAL, an illogical/inappropriate condition.

So this commit moves former protections for individual
cpus to the stat_derive_unique() function and modifies
it to also extend protections to the 'derived' values.
In the process we now protect the cpu 'summary' counts
which were unfortunately previously overlooked (oops).

Reference(s):
. 'derived' types introduced
commit 2c86c4984a
2017-03-29 22:10:56 +11:00
..
.gitignore tests: update template and add pids 2016-04-19 21:33:02 +10:00
alloc.c library: cleanup of library includes 2016-04-16 17:03:57 +10:00
alloc.h library: cleanup of library includes 2016-04-16 17:03:57 +10:00
COPYING miscellaneous: clean up trailing whitespace once again 2013-04-07 18:05:01 +10:00
devname.c library: find tty device name of process quicker 2016-07-03 10:47:25 +10:00
devname.h library: cleanup of readproc functions 2016-04-17 14:14:27 +10:00
diskstats.c library: eliminate distorted history 1st time switches 2017-01-05 06:48:38 +11:00
diskstats.h library: strictly cosmetic, absolutely no code changes 2016-10-09 21:31:29 +11:00
escape.c library: revert one ancient 'escape_str_utf8' deletion 2016-08-23 21:11:09 +10:00
escape.h library: re-arrange escape commands 2016-04-17 14:45:19 +10:00
libprocps.pc.in Renaming libprocfs to libprocps 2011-12-23 09:18:43 +11:00
libprocps.sym library: provide for validating result type references 2016-08-07 21:40:48 +10:00
meminfo.c library: eliminate distorted history 1st time switches 2017-01-05 06:48:38 +11:00
meminfo.h library: strictly cosmetic, absolutely no code changes 2016-10-09 21:31:29 +11:00
namespace.c library: ensure 'namespace' types treated consistently 2017-01-04 08:29:44 +11:00
namespace.h library: ensure 'namespace' types treated consistently 2017-01-04 08:29:44 +11:00
pids.c library: protect against possible 'refcount' underflow 2016-12-07 22:06:59 +11:00
pids.h library <stat>: remove that PIDS_WCHAN_ADDR enumerator 2016-10-16 08:23:38 +11:00
procps-private.h library: please keep procps-private.h free of #include 2016-06-11 11:50:37 +10:00
procps.h library: provide for validating result type references 2016-08-07 21:40:48 +10:00
pwcache.c library: rename clashing pwcache functions 2016-06-18 08:17:45 +10:00
pwcache.h library: rename clashing pwcache functions 2016-06-18 08:17:45 +10:00
readproc.c library: normalize & minimize result types, <PIDS> api 2016-08-01 20:09:18 +10:00
readproc.h library: normalize & minimize result types, <PIDS> api 2016-08-01 20:09:18 +10:00
slabinfo.c library <slabinfo>: make read function name consistent 2017-01-05 06:48:38 +11:00
slabinfo.h library: strictly cosmetic, absolutely no code changes 2016-10-09 21:31:29 +11:00
stat.c library: improve <STAT> cpus offline/online management 2017-03-29 22:10:56 +11:00
stat.h library <stat>: standardized new category calculations 2017-01-04 08:29:44 +11:00
sysinfo.c misc: just eliminate several 'unused' warning messages 2016-07-26 07:59:48 +10:00
sysinfo.h library: remove an obsolete 'jiffs' typedef in sysinfo 2016-05-08 21:12:22 +10:00
test_namespace.c tests: update template and add pids 2016-04-19 21:33:02 +10:00
test_pids.c related: change for lost 'PROCPS_' enumerator prefixes 2016-07-26 20:49:44 +10:00
test_sysinfo.c tests: update template and add pids 2016-04-19 21:33:02 +10:00
test_uptime.c library: procps_uptime() return value is a status 2016-05-01 16:50:25 +10:00
test_version.c library: Fix LINUX_VERSION macro 2016-05-01 17:46:25 +10:00
uptime.c library: procps_uptime() return value is a status 2016-05-01 16:50:25 +10:00
uptime.h library: cleanup of library includes 2016-04-16 17:03:57 +10:00
version.c miscellaneous: remove some trailing whitespace buildup 2015-06-20 07:46:23 +10:00
version.h library: Fix LINUX_VERSION macro 2016-05-01 17:46:25 +10:00
vmstat.c library: eliminate distorted history 1st time switches 2017-01-05 06:48:38 +11:00
vmstat.h library: strictly cosmetic, absolutely no code changes 2016-10-09 21:31:29 +11:00
wchan.c library: don't strip off prefixes from the wchan names 2016-12-07 22:07:00 +11:00
wchan.h library: cleanup of library includes 2016-04-16 17:03:57 +10:00
xtra-procps-debug.h library: strengthen the VAL macro validation functions 2016-08-08 22:01:37 +10:00