Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Dec 2024 16:09:17 +0000
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second
Message-ID:  <202412031609.4B3G9HAf023627@critter.freebsd.dk>
In-Reply-To: <a6f175eb-b81c-43be-8dba-d188eb7b40bd@FreeBSD.org>
References:  <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> <a6f175eb-b81c-43be-8dba-d188eb7b40bd@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--------
John Baldwin writes:

> > +When netstat reports every 8 seconds, it tells traffic in bits per se=
cond:
> > +
> > +$ 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=
:

And since

	bytes/8 seconds =3D=3D bits/second

Q.E.D

> I do think having a tip about 'netstat -I foo <N>' is useful btw.  I'm n=
ot sure if
> you are trying to do [...]

I have personally used this trick for 35+ years from V.22bis modems
til 10Gbit/s ethernet, to figure out how saturated a particular
transmission facility is.

Transmission media are always in nominal bits per second, and counters
are almost invariably in bytes, so using 8 second integration eliminates
the need for math.

The 8 second integration time also averages most of the burstiness of the
traffic quite nicely.

As the author of the bikeshed email, I should have known better
than to commit something this trivial :-)

Poul-Henning

-- =

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    =

Never attribute to malice what can adequately be explained by incompetence=
.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412031609.4B3G9HAf023627>