From owner-freebsd-net@FreeBSD.ORG Thu Jul 10 19:37:36 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00D40B95 for ; Thu, 10 Jul 2014 19:37:35 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD9DA2C9B for ; Thu, 10 Jul 2014 19:37:35 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id CCD04B91C; Thu, 10 Jul 2014 15:37:33 -0400 (EDT) From: John Baldwin To: freebsd-net@freebsd.org Subject: Re: Add netbw option to systat Date: Thu, 10 Jul 2014 13:14:58 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201407101314.58558.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 10 Jul 2014 15:37:33 -0400 (EDT) Cc: Bryan Venteicher , hiren panchasara X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2014 19:37:36 -0000 On Wednesday, July 02, 2014 8:54:41 pm hiren panchasara wrote: > On Wed, Jul 2, 2014 at 4:50 PM, Bryan Venteicher > wrote: > > Awhile back, DragonlyFlyBSD added a netbw option to systat that I've ported > > to FreeBSD and found handy at various times: > > > > netbw Display aggregate and per-connection TCP receive and transmit > > rates. Only active TCP connections are shown. > > > > Leading to output such as: > > > > tcp accepts connects rcv 1.192G snd 15.77K rexmit > > > > 192.168.10.80:22 192.168.10.20:23103 rcv snd 415.7 [ NTSX ] > > 192.168.10.80:22 192.168.10.20:46560 rcv 19.80M snd 14.47K [ NTSX ] > > 192.168.10.80:22 192.168.10.20:60699 rcv snd 886.3 [ NTSX ] > > 192.168.10.81:5201 192.168.10.51:60844 rcv 293.2M snd [R TSX ] > > 192.168.10.81:5201 192.168.10.51:60845 rcv 293.5M snd [R TSX ] > > 192.168.10.81:5201 192.168.10.51:60846 rcv 293.2M snd [R TSX ] > > 192.168.10.81:5201 192.168.10.51:60847 rcv 292.9M snd [R TSX ] > > > > It uses the sequences number from the 'struct tcpcb' to derive the rates, > > which is usually good but certainly not perfect (i.e., don't set the > > interval too long). > > > > I'd like to commit this if anybody else thinks they'd find it useful. > > > > http://people.freebsd.org/~bryanv/patches/systat-netbw.patch > > I like the idea. I also like the idea. > A few things about the patch: > 1) You may want to remove the code hidden behind "#if 0" at 2 places. > 2) I am not entirely clear on why/if we need the last column with > flags but if we keep it (for compatibility of any other reason), It > would be nice to have those flags explained in the manpage: > > + mvwprintw(wnd, LINES-2, 0, > + "Rate/sec, " > + "R=rxpend T=txpend N=nodelay T=tstmp " > + "S=sack X=winscale F=fastrec"); > 3) I feel that the header line for o/p (specially 'tcp accepts and > connects' terminology) can be improved but I do not have a better > suggestion :-) 4) Should numtok() just be humanize_number? Or rather, would it simplify the code to use humanize_number? (It might not, but if it does, I think that would be preferable.) -- John Baldwin