From owner-freebsd-net@FreeBSD.ORG Fri Jul 11 05:30:06 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 70CD8A24 for ; Fri, 11 Jul 2014 05:30:06 +0000 (UTC) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 288D82EE4 for ; Fri, 11 Jul 2014 05:30:05 +0000 (UTC) Received: by mail-vc0-f174.google.com with SMTP id hy4so1087804vcb.5 for ; Thu, 10 Jul 2014 22:29:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=4Lr8xHAWrNLufTQB6373tJfBSuE2E9JhuHSuLTdGe0A=; b=BetZ6E+rVSbM6n0JSZp8tAo3CRYp7QWKRWXZsmMYRqhJcGIvY1rj8dWOn/QBi3C0t3 BfuIsBWfX6mCn1p8oYtApe1OdoL7qVFhBqgdNNL2xTpeSt3bgwAxrSH0m41AeHrqvvSC 2RnGbn8wNmtpHhaeg0XzczIQKmJN6VJJW/BWJXC6XwKZfgNP+nP/0vDLozBEvkt1eLhB wwNvfdegcn+AlYPHOGNldTenG4QU7IBvIDgr+0Oc2IuEQkaABHofSEWxBcFqTf3AYl/T bb91fCMFNa9ftvl5m0jwCE4asytW1qdZTg7chAqLVaWjogFasb7kUi1h5IDrN6iMDfgQ pUVA== X-Gm-Message-State: ALoCoQn7zOYnHzucfL9BPuqOWzqe/HnIgeXTiXVvJ5wqmbaG6d40htxkZibshbQRIz716BARMogk X-Received: by 10.58.165.106 with SMTP id yx10mr50926597veb.17.1405056599039; Thu, 10 Jul 2014 22:29:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.11.167 with HTTP; Thu, 10 Jul 2014 22:29:38 -0700 (PDT) X-Originating-IP: [72.177.8.109] In-Reply-To: References: From: Bryan Venteicher Date: Fri, 11 Jul 2014 00:29:38 -0500 Message-ID: Subject: Re: Add netbw option to systat To: hiren panchasara Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: "freebsd-net@freebsd.org" 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: Fri, 11 Jul 2014 05:30:06 -0000 On Wed, Jul 2, 2014 at 7:54 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 rexmi= t > > > > 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 rate= s, > > 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. > > A few things about the patch: > 1) You may want to remove the code hidden behind "#if 0" at 2 places. > =E2=80=8BThat's inherited as is from the =E2=80=8BDragonflyBSD code, and I = was trying to keep the diff relativity small with upstream. I'll remove it the hidden code. > 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=3Drxpend T=3Dtxpend N=3Dnodelay T=3Dtstmp " > + "S=3Dsack X=3Dwinscale F=3Dfastrec"); > =E2=80=8BYes, I'll document them.=E2=80=8B > 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 :-) > > It looks okay me otherwise and thanks for your work. > > cheers, > Hiren >