Date: Wed, 18 Feb 2026 12:41:53 -0700 From: Warner Losh <imp@bsdimp.com> To: John Baldwin <jhb@freebsd.org> Cc: Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, "<dev-commits-src-main@freebsd.org>" <dev-commits-src-main@freebsd.org> Subject: Re: git: 8e593a1f1432 - main - fortune: fix netstat tip Message-ID: <CANCZdfpsafyDVhMA84PyGiVNonDP8Vd8_hXTx7W_WpH9Sw7ceA@mail.gmail.com> In-Reply-To: <06f7c9c0-a681-4573-8b1d-83b65f825d5b@FreeBSD.org> References: <6995eeee.37508.1de1224c@gitrepo.freebsd.org> <06f7c9c0-a681-4573-8b1d-83b65f825d5b@FreeBSD.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Wed, Feb 18, 2026, 11:51 AM John Baldwin <jhb@freebsd.org> wrote: > 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') > Oh. Damn. I'll revert -- > John Baldwin > > [-- Attachment #2 --] <div dir="auto"><div><br><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Feb 18, 2026, 11:51 AM John Baldwin <<a href="mailto:jhb@freebsd.org">jhb@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2/18/26 11:55, Warner Losh wrote:<br> > The branch main has been updated by imp:<br> > <br> > URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=8e593a1f143203cace2e14bd6629a8ebdf9b47dc" rel="noreferrer noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=8e593a1f143203cace2e14bd6629a8ebdf9b47dc</a><br> > <br> > commit 8e593a1f143203cace2e14bd6629a8ebdf9b47dc<br> > Author: Warner Losh <imp@FreeBSD.org><br> > AuthorDate: 2026-02-10 14:59:58 +0000<br> > Commit: Warner Losh <imp@FreeBSD.org><br> > CommitDate: 2026-02-18 16:39:28 +0000<br> > <br> > fortune: fix netstat tip<br> > <br> > netstati <mumble> 8 reports in bytes per second (averaged over 8<br> > seconds) rather than bits per second because it reports the total<br> > in bits over the 8 seconds...<br> > <br> > Sponsored by: Netflix<br> <br> Eh, I originally thought this too, but the original hint is right. netstat<br> doesn't report a per-second average, just the delta, so when using '8' it<br> is showing the number of bytes sent/received in the 8 second interval which<br> effectively multiplies the per-second rate by 8, so if it is a constant<br> rate you get the bits-per-second as the output.<br> <br> Relevant code from sidewaysintpr() in if.c:<br> <br> fill_iftot(new);<br> <br> xo_open_instance("stats");<br> show_stat("lu", 10, "received-packets",<br> new->ift_ip - old->ift_ip, 1, 1);<br> show_stat("lu", 5, "received-errors",<br> new->ift_ie - old->ift_ie, 1, 1);<br> show_stat("lu", 5, "dropped-packets",<br> new->ift_id - old->ift_id, 1, 1);<br> show_stat("lu", 10, "received-bytes",<br> new->ift_ib - old->ift_ib, 1, 0);<br> show_stat("lu", 10, "sent-packets",<br> new->ift_op - old->ift_op, 1, 1);<br> show_stat("lu", 5, "send-errors",<br> new->ift_oe - old->ift_oe, 1, 1);<br> show_stat("lu", 10, "sent-bytes",<br> new->ift_ob - old->ift_ob, 1, 0);<br> show_stat("NRSlu", 5, "collisions",<br> new->ift_co - old->ift_co, 1, 1);<br> if (dflag)<br> show_stat("LSlu", 5, "dropped-packets",<br> new->ift_od - old->ift_od, 1, 1);<br> xo_close_instance("stats");<br> xo_emit("\n");<br> xo_flush();<br> <br> (Note no scaling, just 'new - old')<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Oh. Damn. I'll revert</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> -- <br> John Baldwin<br> <br> </blockquote></div></div></div>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpsafyDVhMA84PyGiVNonDP8Vd8_hXTx7W_WpH9Sw7ceA>
