ping

> Hi,
> 
> While running systat(1)'s iostat view in cumulative mode (activated by 
> pressing
> 'b') I noticed that it divides the results by the refresh interval. This is
> because the cumulative mode is implemented by setting last = 0, and then it 
> does
> (current - last) / etime, thereby giving wrong cumulative results. This can be
> verified by comparing with `iostat -dI`. The attached diff fixes this.
> 
> ok?
> 
> Index: usr.bin/systat/iostat.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/systat/iostat.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 iostat.c
> --- usr.bin/systat/iostat.c   28 Jun 2019 13:35:04 -0000      1.49
> +++ usr.bin/systat/iostat.c   28 Jul 2021 19:04:41 -0000
> @@ -167,9 +167,12 @@ void
>  print_io(void)
>  {
>       int n, count = 0;
> -
>       int curr;
> -     etime = naptime;
> +
> +     if (state == BOOT)
> +             etime = 1.0;
> +     else
> +             etime = naptime;
>  
>       /* XXX engine internals: save and restore curr_line for bcache */
>       curr = curr_line;

Reply via email to