On 12/2/24 13:13, Poul-Henning Kamp wrote:
The branch main has been updated by phk:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b5a8abe9502e781598dc052698fe7fa5830f59ee

commit b5a8abe9502e781598dc052698fe7fa5830f59ee
Author:     Poul-Henning Kamp <p...@freebsd.org>
AuthorDate: 2024-12-02 21:12:27 +0000
Commit:     Poul-Henning Kamp <p...@freebsd.org>
CommitDate: 2024-12-02 21:12:27 +0000

     How to show interface traffic in bits per second
---
  usr.bin/fortune/datfiles/freebsd-tips | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/usr.bin/fortune/datfiles/freebsd-tips 
b/usr.bin/fortune/datfiles/freebsd-tips
index c0807405005e..1e9501e3a6fb 100644
--- a/usr.bin/fortune/datfiles/freebsd-tips
+++ b/usr.bin/fortune/datfiles/freebsd-tips
@@ -856,3 +856,7 @@ $ fc-list ':charset=0x1F4A1'
  $ pkg which /usr/local/share/fonts/noto/NotoColorEmoji.ttf
  /usr/local/share/fonts/noto/NotoColorEmoji.ttf was installed by package 
noto-emoji-2.042
  %
+When netstat reports every 8 seconds, it tells traffic in bits per second:
+
+$ netstat -I bge0 8
+%

Hmm, I'm pretty sure it's in bytes, and checking the code, it seems like 
show_stat()
in netstat/if.c just shows the raw delta in values without scaling it by 
'interval',
so I think the counts are the number of bytes sent/received in 8 seconds:

netstat -I igc0 8
            input           igc0           output
   packets  errs idrops      bytes    packets  errs      bytes colls
        61     0     0      14418          6     0        420     0
        42     0     0       8926          5     0        346     0
        43     0     0       7631          7     0        540     0
        31     0     0       4269          6     0        420     0
        20     0     0       2173          6     0        420     0
        26     0     0       3574          5     0        346     0
        32     0     0       4407          9     0        678     0
        22     0     0       2374          5     0        346     0

I do think having a tip about 'netstat -I foo <N>' is useful btw.  I'm not sure 
if
you are trying to do just highlight the interval feature, or if you are 
highlighting
that the stat is scaled by the interval rather than the raw delta (which isn't 
true
for netstat, but is true for some tools (e.g. vmstat uses per-second rates in
interval mode).

--
John Baldwin


Reply via email to