From 813661c2995d4f4ddd00e705a2ffeced1f485284 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 6 Mar 2022 00:00:00 -0600 Subject: [PATCH] library: introduced a 'UTILIZATION_C' item, api Some items in the API carry a '_C' suffix which implies such values include reaped children. So, we'll now extend this practice to that new UTILIZATION item. Reference(s): . Mar, 2022 - tweak PIDS_UTILIZATION commit 9c0e8e9429d232a85baef3d6fa8269963fd80741 . Feb, 2022 - added PIDS_UTILIZATION commit c69104b2b835176f9801dfd1a1d893579879a5b6 Signed-off-by: Jim Warner --- proc/pids.c | 2 ++ proc/pids.h | 1 + 2 files changed, 3 insertions(+) diff --git a/proc/pids.c b/proc/pids.c index e9bae0fa..77e4deea 100644 --- a/proc/pids.c +++ b/proc/pids.c @@ -287,6 +287,7 @@ REG_set(TTY, s_int, tty) setDECL(TTY_NAME) { char buf[64]; freNAME(str)(R); dev_to_tty(buf, sizeof(buf), P->tty, P->tid, ABBREV_DEV); if (!(R->result.str = strdup(buf))) I->seterr = 1; } setDECL(TTY_NUMBER) { char buf[64]; freNAME(str)(R); dev_to_tty(buf, sizeof(buf), P->tty, P->tid, ABBREV_DEV|ABBREV_TTY|ABBREV_PTS); if (!(R->result.str = strdup(buf))) I->seterr = 1; } setDECL(UTILIZATION) { double t; if (I->boot_seconds > 0) { t = I->boot_seconds - ((double)P->start_time / I->hertz); if (t > 0) R->result.real = ((P->utime + P->stime) * 100.0f / I->hertz) / t; }} +setDECL(UTILIZATION_C) { double t; if (I->boot_seconds > 0) { t = I->boot_seconds - ((double)P->start_time / I->hertz); if (t > 0) R->result.real = ((P->utime + P->stime + P->cutime + P->cstime) * 100.0f / I->hertz) / t; }} REG_set(VM_DATA, ul_int, vm_data) REG_set(VM_EXE, ul_int, vm_exe) REG_set(VM_LIB, ul_int, vm_lib) @@ -575,6 +576,7 @@ static struct { { RS(TTY_NAME), f_stat, FF(str), QS(strvers), 0, TS(str) }, { RS(TTY_NUMBER), f_stat, FF(str), QS(strvers), 0, TS(str) }, { RS(UTILIZATION), f_stat, NULL, QS(real), 0, TS(real) }, + { RS(UTILIZATION_C), f_stat, NULL, QS(real), 0, TS(real) }, { RS(VM_DATA), f_status, NULL, QS(ul_int), 0, TS(ul_int) }, { RS(VM_EXE), f_status, NULL, QS(ul_int), 0, TS(ul_int) }, { RS(VM_LIB), f_status, NULL, QS(ul_int), 0, TS(ul_int) }, diff --git a/proc/pids.h b/proc/pids.h index 043ec838..3aa29cc2 100644 --- a/proc/pids.h +++ b/proc/pids.h @@ -170,6 +170,7 @@ enum pids_item { PIDS_TTY_NAME, // str derived from TTY PIDS_TTY_NUMBER, // str derived from TTY as str PIDS_UTILIZATION, // real derived from TIME_ALL / TIME_ELAPSED, as percentage + PIDS_UTILIZATION_C, // real derived from TIME_ALL_C / TIME_ELAPSED, as percentage PIDS_VM_DATA, // ul_int status: VmData PIDS_VM_EXE, // ul_int status: VmExe PIDS_VM_LIB, // ul_int status: VmLib