library: tweak those system cpu statistics, <stat> api
This patch may be a little misleading in terms of size since most of the changes just reorder a little logic. The most significant changes involve two GUEST values. My original implementation excluded such tics from the TOTAL calculation and, therefore, the BUSY figure too. That decision was erroneously based on some code found in ./kernel/sched/cputime.c which in hindsight applies only to processes, not those system level cpu figures. [ another likely oops classified STOLEN tics as IDLE ] So, this patch attempts to bring those SUM values into better agreement with the calculations performed for a root cgroup (see ./kernel/cgroup/rstat.c source file). [ we differ from those above in that we also include ] [ the IDLE plus IOWAIT tics in our TOTAL calculation ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
14
proc/stat.h
14
proc/stat.h
@ -54,17 +54,17 @@ enum stat_item {
|
||||
STAT_TIC_DELTA_GUEST, // sl_int "
|
||||
STAT_TIC_DELTA_GUEST_NICE, // 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_SYSTEM, // ull_int derived from SYSTEM + IRQ + SOFTIRQ tics
|
||||
STAT_TIC_SUM_IDLE, // ull_int derived from IDLE + IOWAIT 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_TOTAL, // ull_int derived from sum of all 10 tics
|
||||
|
||||
STAT_TIC_SUM_DELTA_TOTAL, // sl_int derived 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_USER, // sl_int derived from above
|
||||
STAT_TIC_SUM_DELTA_SYSTEM, // sl_int "
|
||||
STAT_TIC_SUM_DELTA_IDLE, // sl_int "
|
||||
STAT_TIC_SUM_DELTA_BUSY, // sl_int "
|
||||
STAT_TIC_SUM_DELTA_TOTAL, // sl_int "
|
||||
|
||||
STAT_SYS_CTX_SWITCHES, // ul_int /proc/stat
|
||||
STAT_SYS_INTERRUPTS, // ul_int "
|
||||
|
Reference in New Issue
Block a user