diff --git a/backport-vmstat-Print-guest-time.patch b/backport-vmstat-Print-guest-time.patch new file mode 100644 index 0000000000000000000000000000000000000000..0a4336c880ab40cdb59e89d9770a8bd8b8eb928c --- /dev/null +++ b/backport-vmstat-Print-guest-time.patch @@ -0,0 +1,70 @@ +From f4eeff0b26a2c48552f8ed843bea95bf97437d2a Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Tue, 11 Jul 2023 19:16:15 +1000 +Subject: [PATCH] vmstat: Print guest time + +Guest time was removed from User time but not printed. This meant +that if guest time was non-zero then the CPU numbers did not add +up to 100% + +References: + !191 + !113 + commit 2461bb5bc17ee4bc01b142b5bba2c5d87578285c + +Signed-off-by: Craig Small +--- + src/vmstat.c | 6 +++--- + testsuite/vmstat.test/vmstat.exp | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/vmstat.c b/src/vmstat.c +index acb7b80..68d356c 100644 +--- a/src/vmstat.c ++++ b/src/vmstat.c +@@ -254,13 +254,13 @@ static void new_header(void) + * that follow (marked with max x chars) might not work, + * unless manual page is translated as well. */ + const char *header = +- _("procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----"); ++ _("procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu-------"); + const char *wide_header = + _("--procs-- -----------------------memory---------------------- ---swap-- -----io---- -system-- ----------cpu----------"); + const char *timestamp_header = _(" -----timestamp-----"); + + const char format[] = +- "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s"; ++ "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s %2s"; + const char wide_format[] = + "%4s %4s %12s %12s %12s %12s %4s %4s %5s %5s %4s %4s %3s %3s %3s %3s %3s %3s"; + +@@ -349,7 +349,7 @@ static void new_format(void) + #define MEMv(E) MEMINFO_VAL(E, ul_int, mem_stack, mem_info) + #define DSYSv(E) STAT_VAL(E, s_int, stat_stack, stat_info) + const char format[] = +- "%2lu %2lu %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u"; ++ "%2lu %2lu %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u %2u"; + const char wide_format[] = + "%4lu %4lu %12lu %12lu %12lu %12lu %4u %4u %5u %5u %4u %4u %3u %3u %3u %3u %3u %3u"; + +diff --git a/testsuite/vmstat.test/vmstat.exp b/testsuite/vmstat.test/vmstat.exp +index 1cd13a1..48d0b0f 100644 +--- a/testsuite/vmstat.test/vmstat.exp ++++ b/testsuite/vmstat.test/vmstat.exp +@@ -12,11 +12,11 @@ if { [ file readable "/proc/vmstat" ] == 0 } { + } else { + set test "vmstat with no arguments" + spawn $vmstat +- expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+buff\\s+cache\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$" ++ expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+buff\\s+cache\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st gu\\s*\(\\s+\\d+\){18}\\s*$" + + set test "vmstat with -a flag" + spawn $vmstat -a +- expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+inact\\s+active\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$" ++ expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+inact\\s+active\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st gu\\s*\(\\s+\\d+\){18}\\s*$" + + set test "vmstat fork option" + spawn $vmstat -f +-- +2.33.0 + diff --git a/procps-ng.spec b/procps-ng.spec index d958452a283d3ee17bf1e1cb7acdcef5fe805794..e83114233009e1e2ef6fbac2fb875d376b225923 100644 --- a/procps-ng.spec +++ b/procps-ng.spec @@ -1,6 +1,6 @@ Name: procps-ng Version: 4.0.2 -Release: 8 +Release: 9 Summary: Utilities that provide system information. License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ URL: https://sourceforge.net/projects/procps-ng/ @@ -20,6 +20,7 @@ Patch8: backport-pmap-Increase-memory-allocation-failure-judgment.patch Patch9: backport-top-added-guest-tics-when-multiple-cpus-were-merged.patch Patch10: backport-library-restore-the-proper-main-thread-tics-valuation.patch Patch11: backport-vmstat-Update-memory-statistics.patch +Patch12: backport-vmstat-Print-guest-time.patch BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel systemd-pam @@ -102,6 +103,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %{_mandir}/man* %changelog +* Thu Jul 13 2023 zhoujie - 4.0.2-9 +- vmstat: print guest time + * Wed Jul 12 2023 zhoujie - 4.0.2-8 - vmstat: Update memory statistics