vmstat: Update memory statistics

vmstat <n> would update most fields, but the memory statistics
were only fetched the first time.

References:
 https://bugs.debian.org/1027963

Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
Ingo Saitz 2023-01-06 13:30:39 +11:00 committed by Craig Small
parent dd3cb0892d
commit 7e24816538
2 changed files with 6 additions and 1 deletions

4
NEWS
View File

@ -1,8 +1,10 @@
procps-ng-NEXT procps-ng-NEXT
--------------- ---------------
* docs: Don't install English manpages twice * docs: Don't install English manpages twice
* skill: Match on -p again Debian #1025915
* ps: c flag shows command name again Debian #1026326 * ps: c flag shows command name again Debian #1026326
* skill: Match on -p again Debian #1025915
* vmstat: Referesh memory statistics Debian #1027963
procps-ng-4.0.2 procps-ng-4.0.2
--------------- ---------------
* library revision - 0:1:0 * library revision - 0:1:0

View File

@ -468,6 +468,9 @@ static void new_format(void)
pswpin[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPIN, ul_int); pswpin[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPIN, ul_int);
pswpout[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPOUT, ul_int); pswpout[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPOUT, ul_int);
if (!(mem_stack = procps_meminfo_select(mem_info, Mem_items, MAX_mem)))
xerrx(EXIT_FAILURE, _("Unable to select memory information"));
if (t_option) { if (t_option) {
(void) time( &the_time ); (void) time( &the_time );
tm_ptr = localtime( &the_time ); tm_ptr = localtime( &the_time );