library <stat>: standardized new category calculations

This commit arose out of the discussion (and research)
surrounding the issue cited below. It is an attempt to
consolidate and standardize the calculation of jiffies
categories (e.g. 'idle', 'busy', etc.) once & for all.

Also included is the enum STAT_TIC_NUM_CONTRIBUTORS in
case anyone, in the future, decides to calculate usage
based upon elapsed time * Hz (like top does in process
level %CPU stats). In such an event, a total number of
CPUs or NUMA Nodes would be needed for proper scaling.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/48

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-12-27 08:08:08 -06:00
committed by Craig Small
parent 12e070dd5f
commit 2c86c4984a
2 changed files with 79 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ enum stat_item {
STAT_TIC_ID, // s_int
STAT_TIC_NUMA_NODE, // s_int
STAT_TIC_NUM_CONTRIBUTORS, // s_int
STAT_TIC_USER, // ull_int
STAT_TIC_NICE, // ull_int
STAT_TIC_SYSTEM, // ull_int
@@ -40,6 +41,12 @@ enum stat_item {
STAT_TIC_GUEST, // ull_int
STAT_TIC_GUEST_NICE, // ull_int
STAT_TIC_SUM_TOTAL, // ull_int
STAT_TIC_SUM_BUSY, // ull_int
STAT_TIC_SUM_IDLE, // ull_int
STAT_TIC_SUM_USER, // ull_int
STAT_TIC_SUM_SYSTEM, // ull_int
STAT_TIC_DELTA_USER, // sl_int
STAT_TIC_DELTA_NICE, // sl_int
STAT_TIC_DELTA_SYSTEM, // sl_int
@@ -51,6 +58,12 @@ enum stat_item {
STAT_TIC_DELTA_GUEST, // sl_int
STAT_TIC_DELTA_GUEST_NICE, // sl_int
STAT_TIC_DELTA_SUM_TOTAL, // sl_int
STAT_TIC_DELTA_SUM_BUSY, // sl_int
STAT_TIC_DELTA_SUM_IDLE, // sl_int
STAT_TIC_DELTA_SUM_USER, // sl_int
STAT_TIC_DELTA_SUM_SYSTEM, // sl_int
STAT_SYS_CTX_SWITCHES, // ul_int
STAT_SYS_INTERRUPTS, // ul_int
STAT_SYS_PROC_BLOCKED, // ul_int