Commit 526698fe authored by Sanskriti Sharma's avatar Sanskriti Sharma

vmstat: Fixed initial si,so,bi,bo,in & cs values

In the default display option, the first line of stats output in the
above mentioned columns was incorrect.

Reference(s):
procps-ng/procps#15
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=668580

Signed off by: Sanskriti Sharma <sansharm@redhat.com>
parent 5e1c339b
Pipeline #27799121 passed with stage
in 1 minute and 57 seconds
......@@ -298,11 +298,13 @@ static void new_format(void)
struct tm *tm_ptr;
time_t the_time;
char timebuf[32];
unsigned up;
sleep_half = (sleep_time / 2);
new_header();
meminfo();
up = uptime(NULL,NULL);
getstat(cpu_use, cpu_nic, cpu_sys, cpu_idl, cpu_iow, cpu_xxx, cpu_yyy,
cpu_zzz, pgpgin, pgpgout, pswpin, pswpout, intr, ctxt, &running,
&blocked, &dummy_1, &dummy_2);
......@@ -330,12 +332,12 @@ static void new_format(void)
unitConvert(kb_swap_used), unitConvert(kb_main_free),
unitConvert(a_option?kb_inactive:kb_main_buffers),
unitConvert(a_option?kb_active:kb_main_cached),
(unsigned)( (unitConvert(*pswpin * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (unitConvert(*pswpout * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (*pgpgin * hz + divo2) / Div ),
(unsigned)( (*pgpgout * hz + divo2) / Div ),
(unsigned)( (*intr * hz + divo2) / Div ),
(unsigned)( (*ctxt * hz + divo2) / Div ),
(unsigned)( (unitConvert(*pswpin * kb_per_page) / up )),
(unsigned)( (unitConvert(*pswpout * kb_per_page) / up )),
(unsigned)( (*pgpgin / up )),
(unsigned)( (*pgpgout / up )),
(unsigned)( (*intr / up )),
(unsigned)( (*ctxt / up )),
(unsigned)( (100*duse + divo2) / Div ),
(unsigned)( (100*dsys + divo2) / Div ),
(unsigned)( (100*didl + divo2) / Div ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment