summaryrefslogtreecommitdiff
path: root/src/top/top.c
diff options
context:
space:
mode:
authorhdzhoujie <zhoujie133@huawei.com>2023-05-05 20:00:25 +0800
committerCraig Small <csmall@dropbear.xyz>2023-05-07 20:25:23 +1000
commit786335b9673f9c3af0b3897799b30b205e99748a (patch)
treefaf8321829de8370d685fe1b23863f6457aba5dc /src/top/top.c
parenta4e9a8508c7a7ac9553e7e7893595611a1237e8b (diff)
downloadprocps-ng-786335b9673f9c3af0b3897799b30b205e99748a.tar.gz
top: lessen summary cpu distortions with first display
When the cpu utilization is displayed for the first time, the reading of the /proc/stat file is very close to each other, resulting in large fluctuations. The version before refactoring, such as v3.3.17, has a delay before reading the /proc/stat file for the second time, and the same delay is added here. signed-off-by: zhoujie <zhoujie133@huawei.com> signed-off-by: he jingxian <hejingxian@huawei.com> Signed-off-by: Jim Warner <james.warner@comcast.net>
Diffstat (limited to 'src/top/top.c')
-rw-r--r--src/top/top.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/top/top.c b/src/top/top.c
index 757b8d3..98444fd 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -3735,6 +3735,9 @@ static void before (char *me) {
Graph_cpus = alloc_c(sizeof(struct graph_parms));
Graph_mems = alloc_c(sizeof(struct graph_parms));
#undef doALL
+
+ // don't distort startup cpu(s) display ...
+ usleep(LIB_USLEEP);
} // end: before