Date: Wed, 18 Feb 2026 13:51:20 -0500 From: John Baldwin <jhb@FreeBSD.org> To: Warner Losh <imp@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8e593a1f1432 - main - fortune: fix netstat tip Message-ID: <06f7c9c0-a681-4573-8b1d-83b65f825d5b@FreeBSD.org> In-Reply-To: <6995eeee.37508.1de1224c@gitrepo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
On 2/18/26 11:55, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=8e593a1f143203cace2e14bd6629a8ebdf9b47dc > > commit 8e593a1f143203cace2e14bd6629a8ebdf9b47dc > Author: Warner Losh <imp@FreeBSD.org> > AuthorDate: 2026-02-10 14:59:58 +0000 > Commit: Warner Losh <imp@FreeBSD.org> > CommitDate: 2026-02-18 16:39:28 +0000 > > fortune: fix netstat tip > > netstati <mumble> 8 reports in bytes per second (averaged over 8 > seconds) rather than bits per second because it reports the total > in bits over the 8 seconds... > > Sponsored by: Netflix Eh, I originally thought this too, but the original hint is right. netstat doesn't report a per-second average, just the delta, so when using '8' it is showing the number of bytes sent/received in the 8 second interval which effectively multiplies the per-second rate by 8, so if it is a constant rate you get the bits-per-second as the output. Relevant code from sidewaysintpr() in if.c: fill_iftot(new); xo_open_instance("stats"); show_stat("lu", 10, "received-packets", new->ift_ip - old->ift_ip, 1, 1); show_stat("lu", 5, "received-errors", new->ift_ie - old->ift_ie, 1, 1); show_stat("lu", 5, "dropped-packets", new->ift_id - old->ift_id, 1, 1); show_stat("lu", 10, "received-bytes", new->ift_ib - old->ift_ib, 1, 0); show_stat("lu", 10, "sent-packets", new->ift_op - old->ift_op, 1, 1); show_stat("lu", 5, "send-errors", new->ift_oe - old->ift_oe, 1, 1); show_stat("lu", 10, "sent-bytes", new->ift_ob - old->ift_ob, 1, 0); show_stat("NRSlu", 5, "collisions", new->ift_co - old->ift_co, 1, 1); if (dflag) show_stat("LSlu", 5, "dropped-packets", new->ift_od - old->ift_od, 1, 1); xo_close_instance("stats"); xo_emit("\n"); xo_flush(); (Note no scaling, just 'new - old') -- John Baldwinhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?06f7c9c0-a681-4573-8b1d-83b65f825d5b>
