!71 first time display delay

From: @hd-zhoujie 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
This commit is contained in:
openeuler-ci-bot 2023-06-13 11:42:06 +00:00 committed by Gitee
commit edd2807bad
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From 786335b9673f9c3af0b3897799b30b205e99748a Mon Sep 17 00:00:00 2001
From: hdzhoujie <zhoujie133@huawei.com>
Date: Fri, 5 May 2023 20:00:25 +0800
Subject: [PATCH] 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>
---
src/top/top.c | 3 +++
src/top/top.h | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/top/top.c b/src/top/top.c
index 757b8d3b..98444fd4 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
diff --git a/src/top/top.h b/src/top/top.h
index d633f3e1..03de1ca3 100644
--- a/src/top/top.h
+++ b/src/top/top.h
@@ -121,7 +121,7 @@ char *strcasestr(const char *haystack, const char *needle);
/* Length of time a message is displayed and the duration
of a 'priming' wait during library startup (in microseconds) */
#define MSG_USLEEP 1250000
-#define LIB_USLEEP 150000
+#define LIB_USLEEP 100000
/* Specific process id monitoring support (command line only) */
#define MONPIDMAX 20
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: procps-ng Name: procps-ng
Version: 4.0.2 Version: 4.0.2
Release: 3 Release: 4
Summary: Utilities that provide system information. Summary: Utilities that provide system information.
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
URL: https://sourceforge.net/projects/procps-ng/ URL: https://sourceforge.net/projects/procps-ng/
@ -15,6 +15,7 @@ Patch3: skill-Restore-the-p-flag-functionality.patch
Patch4: backport-top-address-the-missing-guest-tics-for-summary-area.patch Patch4: backport-top-address-the-missing-guest-tics-for-summary-area.patch
Patch5: backport-0001-ps-address-missing-or-corrupted-fields-with-m-option.patch Patch5: backport-0001-ps-address-missing-or-corrupted-fields-with-m-option.patch
Patch6: backport-0002-ps-trade-previous-fix-for-final-solution-to-m-option.patch Patch6: backport-0002-ps-trade-previous-fix-for-final-solution-to-m-option.patch
Patch7: backport-top-lessen-summary-cpu-distortions-with-first-displa.patch
BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel
@ -97,6 +98,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%{_mandir}/man* %{_mandir}/man*
%changelog %changelog
* Tue Jun 13 2023 zhoujie <zhoujie133@huawei.com> - 4.0.2-4
- top: first time display delay
* Tue May 30 2023 zhoujie <zhoujie133@huawei.com> - 4.0.2-3 * Tue May 30 2023 zhoujie <zhoujie133@huawei.com> - 4.0.2-3
- ps: fix ps -lm dump problem - ps: fix ps -lm dump problem