top: added fields for 'start time' & 'cpu utilization'

This patch will exploit some new library capabilities.

[ one will raise eyebrows, the other likely will not ]

A new 'STARTED' field was added which shows the time a
process started after system boot. As such the largest
interval represents the most recently started process.

This is the field that will likely be questioned since
it's somewhat counterintuitive. But were we to instead
use TIME_ELAPSED, the value will change with every top
refresh. This will defeat any PUFF macro optimization.

The new '%CUU' field will probably be better received.
It represents the cpu usage over the life of the task.
When a process was showing high %CPU usage, this field
can be used to determine if it's an anomaly or normal.

[ and as with %CPU, %CUU shows a '?' when running in ]
[ a namespace when /proc was mounted with subset=pid ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2022-02-25 00:00:00 -06:00
committed by Craig Small
parent c69104b2b8
commit 7647e96b0a
3 changed files with 44 additions and 16 deletions

View File

@@ -202,6 +202,7 @@ enum pflag {
EU_RSS, EU_PSS, EU_PZA, EU_PZF, EU_PZS, EU_USS,
EU_IRB, EU_IRO, EU_IWB, EU_IWO,
EU_AGI, EU_AGN,
EU_TM3, EU_CUU,
#ifdef USE_X_COLHDR
// not really pflags, used with tbl indexing
EU_MAXPFLGS
@@ -622,7 +623,7 @@ typedef struct WIN_t {
//atic inline const char *make_str_utf8 (const char *str, int width, int justr, int col);
//atic const char *scale_mem (int target, float num, int width, int justr);
//atic const char *scale_num (float num, int width, int justr);
//atic const char *scale_pcnt (float num, int width, int justr);
//atic const char *scale_pcnt (float num, int width, int justr, int xtra);
//atic const char *scale_tics (TIC_t tics, int width, int justr);
/*------ Fields Management support -------------------------------------*/
/*atic struct Fieldstab[] = { ... } */