ps: plus for symmetry 'UTILIZATION_C' is newest format
This commit just compliments a change referenced below by providing the value which includes reaped children. [ as an aside, it looks like ps only includes reaped ] [ children values under an obscure BSD or GNU option ] [ so, this change is possibly of even more relevance ] Reference(s): . Mar, 2022 - added %CUU commit 2ac72e2e801e015532b555ae0f2272c8ecef2c8b Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
cfa5538832
commit
53917334d0
@ -165,6 +165,7 @@ makEXT(TTY)
|
|||||||
makEXT(TTY_NAME)
|
makEXT(TTY_NAME)
|
||||||
makEXT(TTY_NUMBER)
|
makEXT(TTY_NUMBER)
|
||||||
makEXT(UTILIZATION)
|
makEXT(UTILIZATION)
|
||||||
|
makEXT(UTILIZATION_C)
|
||||||
makEXT(VM_DATA)
|
makEXT(VM_DATA)
|
||||||
makEXT(VM_RSS_LOCKED)
|
makEXT(VM_RSS_LOCKED)
|
||||||
makEXT(VM_RSS)
|
makEXT(VM_RSS)
|
||||||
|
@ -146,6 +146,7 @@ makREL(TTY)
|
|||||||
makREL(TTY_NAME)
|
makREL(TTY_NAME)
|
||||||
makREL(TTY_NUMBER)
|
makREL(TTY_NUMBER)
|
||||||
makREL(UTILIZATION)
|
makREL(UTILIZATION)
|
||||||
|
makREL(UTILIZATION_C)
|
||||||
makREL(VM_DATA)
|
makREL(VM_DATA)
|
||||||
makREL(VM_RSS_LOCKED)
|
makREL(VM_RSS_LOCKED)
|
||||||
makREL(VM_RSS)
|
makREL(VM_RSS)
|
||||||
|
14
ps/output.c
14
ps/output.c
@ -1339,7 +1339,7 @@ setREL1(EXE)
|
|||||||
return max_rightward-rightward;
|
return max_rightward-rightward;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* %cpu utilization over task lifetime */
|
/* %cpu utilization over task lifetime, as ##.### format */
|
||||||
static int pr_utilization(char *restrict const outbuf, const proc_t *restrict const pp){
|
static int pr_utilization(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||||
double cu;
|
double cu;
|
||||||
setREL1(UTILIZATION)
|
setREL1(UTILIZATION)
|
||||||
@ -1350,6 +1350,17 @@ setREL1(UTILIZATION)
|
|||||||
return snprintf(outbuf, COLWID, "%#.3f", cu);
|
return snprintf(outbuf, COLWID, "%#.3f", cu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* %cpu utilization (plus dead children) over task lifetime, as ##.### format */
|
||||||
|
static int pr_utilization_c(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||||
|
double cu;
|
||||||
|
setREL1(UTILIZATION_C)
|
||||||
|
cu = rSv(UTILIZATION_C, real, pp);
|
||||||
|
/* this check is really just for us (the ps program) since we will be very
|
||||||
|
short lived and the library might reflect 100% or even more utilization */
|
||||||
|
if (cu > 99.0) cu = 99.999;
|
||||||
|
return snprintf(outbuf, COLWID, "%#.3f", cu);
|
||||||
|
}
|
||||||
|
|
||||||
/************************* Systemd stuff ********************************/
|
/************************* Systemd stuff ********************************/
|
||||||
static int pr_sd_unit(char *restrict const outbuf, const proc_t *restrict const pp){
|
static int pr_sd_unit(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||||
setREL1(SD_UNIT)
|
setREL1(SD_UNIT)
|
||||||
@ -1635,6 +1646,7 @@ static const format_struct format_array[] = { /*
|
|||||||
{"cputime", "TIME", pr_time, PIDS_TIME_ALL, 8, DEC, ET|RIGHT}, /*time*/
|
{"cputime", "TIME", pr_time, PIDS_TIME_ALL, 8, DEC, ET|RIGHT}, /*time*/
|
||||||
{"cputimes", "TIME", pr_times, PIDS_TIME_ALL, 8, LNX, ET|RIGHT}, /*time*/
|
{"cputimes", "TIME", pr_times, PIDS_TIME_ALL, 8, LNX, ET|RIGHT}, /*time*/
|
||||||
{"ctid", "CTID", pr_nop, PIDS_noop, 5, SUN, ET|RIGHT}, // resource contracts?
|
{"ctid", "CTID", pr_nop, PIDS_noop, 5, SUN, ET|RIGHT}, // resource contracts?
|
||||||
|
{"cuc", "%CUC", pr_utilization_c, PIDS_UTILIZATION_C, 6, XXX, AN|RIGHT},
|
||||||
{"cursig", "CURSIG", pr_nop, PIDS_noop, 6, DEC, AN|RIGHT},
|
{"cursig", "CURSIG", pr_nop, PIDS_noop, 6, DEC, AN|RIGHT},
|
||||||
{"cutime", "-", pr_nop, PIDS_TICS_USER_C, 1, LNX, AN|RIGHT},
|
{"cutime", "-", pr_nop, PIDS_TICS_USER_C, 1, LNX, AN|RIGHT},
|
||||||
{"cuu", "%CUU", pr_utilization, PIDS_UTILIZATION, 6, XXX, AN|RIGHT},
|
{"cuu", "%CUU", pr_utilization, PIDS_UTILIZATION, 6, XXX, AN|RIGHT},
|
||||||
|
11
ps/ps.1
11
ps/ps.1
@ -1211,12 +1211,23 @@ cumulative CPU time in seconds (alias
|
|||||||
.BR times ).
|
.BR times ).
|
||||||
T}
|
T}
|
||||||
|
|
||||||
|
cuc %CUC T{
|
||||||
|
The CPU utilization of a process, including dead children, in an extended "##.###" format.
|
||||||
|
(see also
|
||||||
|
.BR %cpu ,
|
||||||
|
.BR c ,
|
||||||
|
.BR cp ,
|
||||||
|
.BR cuu ,
|
||||||
|
.BR pcpu ).
|
||||||
|
T}
|
||||||
|
|
||||||
cuu %CUU T{
|
cuu %CUU T{
|
||||||
The CPU utilization of a process in an extended "##.###" format.
|
The CPU utilization of a process in an extended "##.###" format.
|
||||||
(see also
|
(see also
|
||||||
.BR %cpu ,
|
.BR %cpu ,
|
||||||
.BR c ,
|
.BR c ,
|
||||||
.BR cp ,
|
.BR cp ,
|
||||||
|
.BR cuc ,
|
||||||
.BR pcpu ).
|
.BR pcpu ).
|
||||||
T}
|
T}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user