Bug 219829 - "systat -if 1" Peak has wrong display
Summary: "systat -if 1" Peak has wrong display
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
: 160412 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-07 02:14 UTC by rezo
Modified: 2020-09-05 17:03 UTC (History)
6 users (show)

See Also:


Attachments
systat if patch (7.37 KB, patch)
2020-07-10 02:16 UTC, ota
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rezo 2017-06-07 02:14:52 UTC
My uname -a:
FreeBSD GIEPHER-PHP 11.0-RELEASE-p4 FreeBSD 11.0-RELEASE-p4 #0 r309666: Thu Dec  8 17:44:40 CST 2016     giepher@GIEPHER-PHP:/usr/obj/usr/src/sys/GIEPHER_PHP_DEBUG  amd64

I use "systat -if 1" last night before I leave my office, today it shows a very large numbers that are impossible just like below:
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   ||   

      Interface           Traffic               Peak                Total
       vboxnet0  in      0.000 KB/s          2.868 MB/s          120.139 MB
                 out     0.000 KB/s          0.204 KB/s          782.491 KB

        bridge0  in      0.000 KB/s          0.000 KB/s          450.108 MB
                 out     0.432 KB/s     16777216.000 TB/s          1.078 GB

            lo0  in      0.000 KB/s     16777216.000 TB/s          2.694 MB
                 out     0.000 KB/s     16777216.000 TB/s          2.694 MB

            re0  in      4.678 KB/s     16777216.000 TB/s         10.189 GB
                 out     0.432 KB/s     16777216.000 TB/s          1.226 GB
Comment 1 Fabian Keil 2017-06-07 09:21:28 UTC
systat uses gettimeofday() calls to measure the time difference
between updates.

If the system time jumps, the "elapsed" time can appear to be
less than a second in which case the devisions in fetchifstat()
will result in the devided variables becoming larger.

systat should probably be changed to use clock_gettime()
with a monotonic clock.
Comment 2 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-29 00:20:09 UTC
*** Bug 160412 has been marked as a duplicate of this bug. ***
Comment 3 Mateusz Piotrowski freebsd_committer 2019-06-23 19:22:38 UTC
I get similarly weird Peak information when I have "systat -if 1" running when I restart the netif service:

>                     /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
>      Load Average   ||||
> 
>       Interface           Traffic               Peak                Total
>           lagg0  in      3.850 KB/s     16718284.049 TB/s          4.754 KB
>                  out     4.127 KB/s     16718284.049 TB/s          5.292 KB
> 
>           wlan0  in      3.850 KB/s     16718267.389 TB/s          4.754 KB
>                  out     4.127 KB/s     16718267.389 TB/s          5.292 KB
> 
>             lo0  in      0.000 KB/s          0.000 KB/s          317.986 KB
>                  out     0.000 KB/s          0.000 KB/s          317.986 KB

I'm running FreeBSD 13.0-CURRENT r348877 GENERIC-NODEBUG  amd64.
Comment 4 ota 2020-06-11 03:40:49 UTC
I also noticed that I see this happens when I bring down or restart wlan0.

I prepared a fix for this at https://reviews.freebsd.org/D25226 .
If you can try and report your result back, that will be nice.
Comment 5 ota 2020-07-10 02:16:53 UTC
Created attachment 216345 [details]
systat if patch

Same one as https://reviews.freebsd.org/D25226
Comment 6 commit-hook freebsd_committer 2020-07-11 13:56:41 UTC
A commit references this bug:

Author: mr
Date: Sat Jul 11 13:56:37 UTC 2020
New revision: 363095
URL: https://svnweb.freebsd.org/changeset/base/363095

Log:
  Handle device removal and removal+add cases to fix infinity rate.

  PR:		219829
  Submitted by:	ota@j.email.ne.jp
  Reported by:	rezo@live.cn
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D25226

Changes:
  head/usr.bin/systat/ifcmds.c
  head/usr.bin/systat/ifstat.c
  head/usr.bin/systat/systat.1
Comment 7 ota 2020-08-01 04:14:33 UTC
Could you MFC to stable/12, please?
Comment 8 commit-hook freebsd_committer 2020-09-05 17:03:15 UTC
A commit references this bug:

Author: mr
Date: Sat Sep  5 17:02:49 UTC 2020
New revision: 365364
URL: https://svnweb.freebsd.org/changeset/base/365364

Log:
  MFC r363095:
  Handle device removal and removal+add cases to fix infinity rate.

  PR:		219829
  Submitted by:	ota@j.email.ne.jp
  Reported by:	rezo@live.cn
  Differential Revision:	https://reviews.freebsd.org/D25226

Changes:
_U  stable/12/
  stable/12/usr.bin/systat/ifcmds.c
  stable/12/usr.bin/systat/ifstat.c
  stable/12/usr.bin/systat/systat.1