diff --git a/0100-pidstat-Report-CPU-usage-for-a-process-as-the-sum-of.patch b/0100-pidstat-Report-CPU-usage-for-a-process-as-the-sum-of.patch deleted file mode 100644 index 7dbd60a891c2e8fcb0eece9fd236a59aaf279d3d..0000000000000000000000000000000000000000 --- a/0100-pidstat-Report-CPU-usage-for-a-process-as-the-sum-of.patch +++ /dev/null @@ -1,88 +0,0 @@ -From a63e87996fd5a214ca7e7c511c713877d8d94300 Mon Sep 17 00:00:00 2001 -From: Sebastien GODARD -Date: Sat, 31 Mar 2018 10:15:04 +0200 -Subject: [PATCH] pidstat: Report CPU usage for a process as the sum of all - threads - -Commit 52977c4 introduced a new macro (SP_VALUE_100()) to limit CPU -usage value displayed by pidstat to 100%. This was intended to be a -workaround for some corner cases where inaccurate statistics could be -provided by the kernel. -Yet this macro also limits the value to 100% even when a process uses -more than 100% of a core, e.g. when it starts several threads loading -the system. This patch reverts commit 52977c4 and reports CPU usage -for a process as the sum of CPU usage for all its threads. - -Signed-off-by: Sebastien GODARD - ---- - common.h | 3 --- - pidstat.c | 20 ++++++++++---------- - 2 files changed, 10 insertions(+), 13 deletions(-) - -diff --git a/common.h b/common.h -index e78c8de..3200eb7 100644 ---- a/common.h -+++ b/common.h -@@ -106,12 +106,9 @@ - * - * NB: Define SP_VALUE() to normalize to %; - * HZ is 1024 on IA64 and % should be normalized to 100. -- * SP_VALUE_100() will not output value bigger than 100; this is needed for some -- * corner cases, should be used with care. - */ - #define S_VALUE(m,n,p) (((double) ((n) - (m))) / (p) * HZ) - #define SP_VALUE(m,n,p) (((double) ((n) - (m))) / (p) * 100) --#define SP_VALUE_100(m,n,p) MINIMUM((((double) ((n) - (m))) / (p) * 100),100) - - /* - * Under very special circumstances, STDOUT may become unavailable. -diff --git a/pidstat.c b/pidstat.c -index 7e929a0..dac1ed8 100644 ---- a/pidstat.c -+++ b/pidstat.c -@@ -1210,15 +1210,15 @@ int write_pid_task_all_stats(int prev, int curr, int dis, - printf(" %7.2f %7.2f %7.2f %7.2f", - (pstc->utime - pstc->gtime) < (pstp->utime - pstp->gtime) ? - 0.0 : -- SP_VALUE_100(pstp->utime - pstp->gtime, -+ SP_VALUE(pstp->utime - pstp->gtime, - pstc->utime - pstc->gtime, itv), -- SP_VALUE_100(pstp->stime, pstc->stime, itv), -- SP_VALUE_100(pstp->gtime, pstc->gtime, itv), -+ SP_VALUE(pstp->stime, pstc->stime, itv), -+ SP_VALUE(pstp->gtime, pstc->gtime, itv), - /* User time already includes guest time */ - IRIX_MODE_OFF(pidflag) ? -- SP_VALUE_100(pstp->utime + pstp->stime, -+ SP_VALUE(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, g_itv) : -- SP_VALUE_100(pstp->utime + pstp->stime, -+ SP_VALUE(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, itv)); - - printf(" %3d", pstc->processor); -@@ -1387,15 +1387,15 @@ int write_pid_task_cpu_stats(int prev, int curr, int dis, int disp_avg, - printf(" %7.2f %7.2f %7.2f %7.2f", - (pstc->utime - pstc->gtime) < (pstp->utime - pstp->gtime) ? - 0.0 : -- SP_VALUE_100(pstp->utime - pstp->gtime, -+ SP_VALUE(pstp->utime - pstp->gtime, - pstc->utime - pstc->gtime, itv), -- SP_VALUE_100(pstp->stime, pstc->stime, itv), -- SP_VALUE_100(pstp->gtime, pstc->gtime, itv), -+ SP_VALUE(pstp->stime, pstc->stime, itv), -+ SP_VALUE(pstp->gtime, pstc->gtime, itv), - /* User time already includes guest time */ - IRIX_MODE_OFF(pidflag) ? -- SP_VALUE_100(pstp->utime + pstp->stime, -+ SP_VALUE(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, g_itv) : -- SP_VALUE_100(pstp->utime + pstp->stime, -+ SP_VALUE(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, itv)); - - if (!disp_avg) { --- -1.8.3.1 - diff --git a/dist b/dist new file mode 100644 index 0000000000000000000000000000000000000000..ad8eb77ba59be071474988a034571694eaa9db8e --- /dev/null +++ b/dist @@ -0,0 +1 @@ +an7_9 diff --git a/download b/download new file mode 100644 index 0000000000000000000000000000000000000000..fd0e371b2b62fc1f08d367e1635eeff0ea760fcc --- /dev/null +++ b/download @@ -0,0 +1 @@ +5f57c129b50234b25e4a7e0a363b1b72 sysstat-10.1.5.tar.bz2 diff --git a/sysstat-10.1.5-pids-prealloc.patch b/sysstat-10.1.5-pids-prealloc.patch index 23d9a59a0132e98c2685f828df4945f5c2106a9b..e713244952b2451b871320b27d719a9c398e26df 100644 --- a/sysstat-10.1.5-pids-prealloc.patch +++ b/sysstat-10.1.5-pids-prealloc.patch @@ -1,19 +1,3 @@ -diff -upr sysstat-10.1.5.orig/common.h sysstat-10.1.5/common.h ---- sysstat-10.1.5.orig/common.h 2013-03-23 17:31:46.000000000 +0100 -+++ sysstat-10.1.5/common.h 2016-04-29 12:47:09.285214132 +0200 -@@ -106,9 +106,12 @@ - * - * NB: Define SP_VALUE() to normalize to %; - * HZ is 1024 on IA64 and % should be normalized to 100. -+ * SP_VALUE_100() will not output value bigger than 100; this is needed for some -+ * corner cases, should be used with care. - */ - #define S_VALUE(m,n,p) (((double) ((n) - (m))) / (p) * HZ) - #define SP_VALUE(m,n,p) (((double) ((n) - (m))) / (p) * 100) -+#define SP_VALUE_100(m,n,p) MINIMUM((((double) ((n) - (m))) / (p) * 100),100) - - /* - * Under very special circumstances, STDOUT may become unavailable. diff -upr sysstat-10.1.5.orig/pidstat.c sysstat-10.1.5/pidstat.c --- sysstat-10.1.5.orig/pidstat.c 2013-03-23 17:31:46.000000000 +0100 +++ sysstat-10.1.5/pidstat.c 2016-04-29 13:04:02.672402150 +0200 @@ -153,48 +137,6 @@ diff -upr sysstat-10.1.5.orig/pidstat.c sysstat-10.1.5/pidstat.c /* Close /proc directory */ closedir(dir); } -@@ -1174,15 +1191,15 @@ int write_pid_task_all_stats(int prev, i - printf(" %7.2f %7.2f %7.2f %7.2f", - (pstc->utime - pstc->gtime) < (pstp->utime - pstp->gtime) ? - 0.0 : -- SP_VALUE(pstp->utime - pstp->gtime, -+ SP_VALUE_100(pstp->utime - pstp->gtime, - pstc->utime - pstc->gtime, itv), -- SP_VALUE(pstp->stime, pstc->stime, itv), -- SP_VALUE(pstp->gtime, pstc->gtime, itv), -+ SP_VALUE_100(pstp->stime, pstc->stime, itv), -+ SP_VALUE_100(pstp->gtime, pstc->gtime, itv), - /* User time already includes guest time */ - IRIX_MODE_OFF(pidflag) ? -- SP_VALUE(pstp->utime + pstp->stime, -+ SP_VALUE_100(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, g_itv) : -- SP_VALUE(pstp->utime + pstp->stime, -+ SP_VALUE_100(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, itv)); - - printf(" %3d", pstc->processor); -@@ -1351,15 +1368,15 @@ int write_pid_task_cpu_stats(int prev, i - printf(" %7.2f %7.2f %7.2f %7.2f", - (pstc->utime - pstc->gtime) < (pstp->utime - pstp->gtime) ? - 0.0 : -- SP_VALUE(pstp->utime - pstp->gtime, -+ SP_VALUE_100(pstp->utime - pstp->gtime, - pstc->utime - pstc->gtime, itv), -- SP_VALUE(pstp->stime, pstc->stime, itv), -- SP_VALUE(pstp->gtime, pstc->gtime, itv), -+ SP_VALUE_100(pstp->stime, pstc->stime, itv), -+ SP_VALUE_100(pstp->gtime, pstc->gtime, itv), - /* User time already includes guest time */ - IRIX_MODE_OFF(pidflag) ? -- SP_VALUE(pstp->utime + pstp->stime, -+ SP_VALUE_100(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, g_itv) : -- SP_VALUE(pstp->utime + pstp->stime, -+ SP_VALUE_100(pstp->utime + pstp->stime, - pstc->utime + pstc->stime, itv)); - - if (!disp_avg) { diff -upr sysstat-10.1.5.orig/pidstat.h sysstat-10.1.5/pidstat.h --- sysstat-10.1.5.orig/pidstat.h 2013-03-23 17:31:46.000000000 +0100 +++ sysstat-10.1.5/pidstat.h 2016-04-28 18:24:37.700124018 +0200 diff --git a/sysstat-10.1.5.tar.bz2 b/sysstat-10.1.5.tar.bz2 deleted file mode 100644 index 482ec6fc7e8092415f29cf911e2a15ebb49ce1c8..0000000000000000000000000000000000000000 Binary files a/sysstat-10.1.5.tar.bz2 and /dev/null differ diff --git a/sysstat.spec b/sysstat.spec index 4c87e98898ba8a0a910fe63e4165f2320acaec96..4ac21c6e91562593da1a7ba6a31369c6b1aa9573 100644 --- a/sysstat.spec +++ b/sysstat.spec @@ -1,8 +1,7 @@ -%define alicloud_base_release 2 Summary: Collection of performance monitoring tools for Linux Name: sysstat Version: 10.1.5 -Release: 19.%{alicloud_base_release}%{?dist} +Release: 20%{?dist} License: GPLv2+ Group: Applications/System URL: http://sebastien.godard.pagesperso-orange.fr/ @@ -75,7 +74,7 @@ Patch41: 0001-man-use-correct-preposition.patch Patch42: 0001-pidstat-Now-handle-processes-with-spaces-in-their-na.patch # patch fix segfault when appending to sa file Patch43: 0001-sadc-Fix-segfault-that-may-happen-when-appending-dat.patch -Patch100: 0100-pidstat-Report-CPU-usage-for-a-process-as-the-sum-of.patch + Requires: /etc/cron.d, fileutils, grep, sh-utils, textutils Requires(post): systemd, systemd-sysv Requires(preun): systemd @@ -148,7 +147,6 @@ The cifsiostat command reports I/O statistics for CIFS file systems. %patch41 -p1 %patch42 -p1 %patch43 -p1 -%patch100 -p1 iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux mv CREDITS.aux CREDITS @@ -210,11 +208,8 @@ fi %{_localstatedir}/log/sa %changelog -* Tue Jan 26 2021 Chunmei Xu - 10.1.5-19.2 -- pidstat: Report CPU usage for a process as the sum of all threads - -* Tue May 12 2020 Wei Liu - 10.1.5-19.1 -- Rebuild for Alibaba Cloud Linux +* Fri Nov 11 2022 Lukáš Zaoral - 10.1.5-20 +- do not cap %usr to 100% in `pidstat -I` for multithreaded programs (#1763579) * Mon Jan 20 2020 Michal Sekletár - 10.1.5-19 - fix possible segfault when appending to data file (#1774590)