top: provide more accurate cpu usage stats for startup

The top program already incorporated a modest delay at
startup so that some minimal process cpu history could
be established. However, Summary Area system level cpu
statistic history reflected usage since boot. As such,
unchanging % values would be shown with every restart.

This commit just adopts the same approach used in task
%CPU history for the Summary Area statistics. In other
words, it introduces a 'priming read' at startup as is
found in the newlib implementation for the <stat> API.

Reference(s):
https://gitlab.com/procps-ng/procps/merge_requests/42

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2017-03-23 00:00:00 -05:00
committed by Craig Small
parent 909b37d755
commit 56d79b9d13
2 changed files with 21 additions and 23 deletions

View File

@@ -730,7 +730,7 @@ typedef struct WIN_t {
//atic inline void widths_resize (void);
//atic void zap_fieldstab (void);
/*------ Library Interface ---------------------------------------------*/
//atic CPU_t *cpus_refresh (CPU_t *cpus);
//atic void cpus_refresh (void);
#ifdef OFF_HST_HASH
//atic inline HST_t *hstbsrch (HST_t *hst, int max, int pid);
#else