From 201e816b26ddaccc923ec40977c92037cdd0c34e Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 13 Jan 2019 00:00:00 -0600 Subject: [PATCH] library: improve header file item comments, api This patch just polishes the 'origin' comments for the header file. In particular those derived/unique items (the 'SUM' guys) will now be properly explained. [ in order to employ the 'derived from above' phrase ] [ with their DELTA versions, all SUM items had to be ] [ relocated (and some renamed). in turn, that had an ] [ impact on many portions of the .c source file too. ] Reference(s): . summary calculations introduced commit 2c86c4984a15c9ab912402838c6651f466a3d2ed . origins added to header files commit 96d59cbf46b3ff687bd29fad4708074a0e1cea14 Signed-off-by: Jim Warner --- proc/stat.c | 48 ++++++++++++++++++++++++------------------------ proc/stat.h | 25 +++++++++++++------------ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/proc/stat.c b/proc/stat.c index a8f8e24b..cec38dbc 100644 --- a/proc/stat.c +++ b/proc/stat.c @@ -163,12 +163,6 @@ TIC_set(TIC_STOLEN, ull_int, stolen) TIC_set(TIC_GUEST, ull_int, guest) TIC_set(TIC_GUEST_NICE, ull_int, gnice) -TIC_set(TIC_SUM_TOTAL, ull_int, xtot) -TIC_set(TIC_SUM_BUSY, ull_int, xbsy) -TIC_set(TIC_SUM_IDLE, ull_int, xidl) -TIC_set(TIC_SUM_USER, ull_int, xusr) -TIC_set(TIC_SUM_SYSTEM, ull_int, xsys) - TICsetH(TIC_DELTA_USER, sl_int, user) TICsetH(TIC_DELTA_NICE, sl_int, nice) TICsetH(TIC_DELTA_SYSTEM, sl_int, system) @@ -180,11 +174,17 @@ TICsetH(TIC_DELTA_STOLEN, sl_int, stolen) TICsetH(TIC_DELTA_GUEST, sl_int, guest) TICsetH(TIC_DELTA_GUEST_NICE, sl_int, gnice) -TICsetH(TIC_DELTA_SUM_TOTAL, sl_int, xtot) -TICsetH(TIC_DELTA_SUM_BUSY, sl_int, xbsy) -TICsetH(TIC_DELTA_SUM_IDLE, sl_int, xidl) -TICsetH(TIC_DELTA_SUM_USER, sl_int, xusr) -TICsetH(TIC_DELTA_SUM_SYSTEM, sl_int, xsys) +TIC_set(TIC_SUM_TOTAL, ull_int, xtot) +TIC_set(TIC_SUM_IDLE, ull_int, xidl) +TIC_set(TIC_SUM_USER, ull_int, xusr) +TIC_set(TIC_SUM_BUSY, ull_int, xbsy) +TIC_set(TIC_SUM_SYSTEM, ull_int, xsys) + +TICsetH(TIC_SUM_DELTA_TOTAL, sl_int, xtot) +TICsetH(TIC_SUM_DELTA_IDLE, sl_int, xidl) +TICsetH(TIC_SUM_DELTA_USER, sl_int, xusr) +TICsetH(TIC_SUM_DELTA_BUSY, sl_int, xbsy) +TICsetH(TIC_SUM_DELTA_SYSTEM, sl_int, xsys) SYS_set(SYS_CTX_SWITCHES, ul_int, ctxt) SYS_set(SYS_INTERRUPTS, ul_int, intr) @@ -292,12 +292,6 @@ static struct { { RS(TIC_GUEST), QS(ull_int), TS(ull_int) }, { RS(TIC_GUEST_NICE), QS(ull_int), TS(ull_int) }, - { RS(TIC_SUM_TOTAL), QS(ull_int), TS(ull_int) }, - { RS(TIC_SUM_BUSY), QS(ull_int), TS(ull_int) }, - { RS(TIC_SUM_IDLE), QS(ull_int), TS(ull_int) }, - { RS(TIC_SUM_USER), QS(ull_int), TS(ull_int) }, - { RS(TIC_SUM_SYSTEM), QS(ull_int), TS(ull_int) }, - { RS(TIC_DELTA_USER), QS(sl_int), TS(sl_int) }, { RS(TIC_DELTA_NICE), QS(sl_int), TS(sl_int) }, { RS(TIC_DELTA_SYSTEM), QS(sl_int), TS(sl_int) }, @@ -309,11 +303,17 @@ static struct { { RS(TIC_DELTA_GUEST), QS(sl_int), TS(sl_int) }, { RS(TIC_DELTA_GUEST_NICE), QS(sl_int), TS(sl_int) }, - { RS(TIC_DELTA_SUM_TOTAL), QS(sl_int), TS(sl_int) }, - { RS(TIC_DELTA_SUM_BUSY), QS(sl_int), TS(sl_int) }, - { RS(TIC_DELTA_SUM_IDLE), QS(sl_int), TS(sl_int) }, - { RS(TIC_DELTA_SUM_USER), QS(sl_int), TS(sl_int) }, - { RS(TIC_DELTA_SUM_SYSTEM), QS(sl_int), TS(sl_int) }, + { RS(TIC_SUM_TOTAL), QS(ull_int), TS(ull_int) }, + { RS(TIC_SUM_IDLE), QS(ull_int), TS(ull_int) }, + { RS(TIC_SUM_USER), QS(ull_int), TS(ull_int) }, + { RS(TIC_SUM_BUSY), QS(ull_int), TS(ull_int) }, + { RS(TIC_SUM_SYSTEM), QS(ull_int), TS(ull_int) }, + + { RS(TIC_SUM_DELTA_TOTAL), QS(sl_int), TS(sl_int) }, + { RS(TIC_SUM_DELTA_IDLE), QS(sl_int), TS(sl_int) }, + { RS(TIC_SUM_DELTA_USER), QS(sl_int), TS(sl_int) }, + { RS(TIC_SUM_DELTA_BUSY), QS(sl_int), TS(sl_int) }, + { RS(TIC_SUM_DELTA_SYSTEM), QS(sl_int), TS(sl_int) }, { RS(SYS_CTX_SWITCHES), QS(ul_int), TS(ul_int) }, { RS(SYS_INTERRUPTS), QS(ul_int), TS(ul_int) }, @@ -1060,8 +1060,8 @@ PROCPS_EXPORT struct stat_reaped *procps_stat_reap ( break; case STAT_REAP_CPUS_AND_NODES: /* note: if we're doing numa at all, we must do this numa history | - before we build (fetch) the cpu stacks since the read_stat guy | - will have marked (temporarily) all the cpu node ids as invalid | */ + before we build (fetch) cpu stacks since that stat_read_failed | + guy always marks (temporarily) all the cpu node ids as invalid | */ if (0 > stat_make_numa_hist(info)) return NULL; if (0 > stat_stacks_fetch(info, &info->nodes)) diff --git a/proc/stat.h b/proc/stat.h index 064228ed..f2cb895f 100644 --- a/proc/stat.h +++ b/proc/stat.h @@ -30,7 +30,8 @@ enum stat_item { // ------- ------------------- STAT_TIC_ID, // s_int /proc/stat STAT_TIC_NUMA_NODE, // s_int [ ID based, see: numa(3) ] - STAT_TIC_NUM_CONTRIBUTORS, // s_int [ ID based, see: numa(3) ] + STAT_TIC_NUM_CONTRIBUTORS, // s_int [ total CPUs contributing to TIC counts ] + STAT_TIC_USER, // ull_int /proc/stat STAT_TIC_NICE, // ull_int " STAT_TIC_SYSTEM, // ull_int " @@ -42,12 +43,6 @@ 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 dervied from above STAT_TIC_DELTA_NICE, // sl_int " STAT_TIC_DELTA_SYSTEM, // sl_int " @@ -59,11 +54,17 @@ 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_TIC_SUM_TOTAL, // ull_int derived from all except GUEST tics + STAT_TIC_SUM_IDLE, // ull_int derived from IDLE + IOWAIT + STOLEN tics + STAT_TIC_SUM_USER, // ull_int derived from USER + NICE tics + STAT_TIC_SUM_BUSY, // ull_int derived from SUM_TOTAL - SUM_IDLE tics + STAT_TIC_SUM_SYSTEM, // ull_int derived from SUM_BUSY - SUM_USER tics + + STAT_TIC_SUM_DELTA_TOTAL, // sl_int dervied from above + STAT_TIC_SUM_DELTA_IDLE, // sl_int " + STAT_TIC_SUM_DELTA_USER, // sl_int " + STAT_TIC_SUM_DELTA_BUSY, // sl_int " + STAT_TIC_SUM_DELTA_SYSTEM, // sl_int " STAT_SYS_CTX_SWITCHES, // ul_int /proc/stat STAT_SYS_INTERRUPTS, // ul_int "