From nobody Tue Dec 03 16:09:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2lw00N78z5gLBb; Tue, 03 Dec 2024 16:09:20 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2lvz5HBGz4Jpq; Tue, 3 Dec 2024 16:09:19 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Authentication-Results: mx1.freebsd.org; none Received: from critter.freebsd.dk (unknown [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id C947A89286; Tue, 03 Dec 2024 16:09:17 +0000 (UTC) Received: (from phk@localhost) by critter.freebsd.dk (8.18.1/8.16.1/Submit) id 4B3G9HAf023627; Tue, 3 Dec 2024 16:09:17 GMT (envelope-from phk) Message-Id: <202412031609.4B3G9HAf023627@critter.freebsd.dk> To: John Baldwin 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 In-reply-to: From: "Poul-Henning Kamp" References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23625.1733242157.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Tue, 03 Dec 2024 16:09:17 +0000 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU] X-Rspamd-Queue-Id: 4Y2lvz5HBGz4Jpq X-Spamd-Bar: ---- -------- 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 ' 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= .