From owner-freebsd-net@FreeBSD.ORG Thu Jul 3 00:54:42 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 D42228A2 for ; Thu, 3 Jul 2014 00:54:42 +0000 (UTC) Received: from mail-qc0-x236.google.com (mail-qc0-x236.google.com [IPv6:2607:f8b0:400d:c01::236]) (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 96C4626FF for ; Thu, 3 Jul 2014 00:54:42 +0000 (UTC) Received: by mail-qc0-f182.google.com with SMTP id m20so10834711qcx.13 for ; Wed, 02 Jul 2014 17:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=27Qt267w8MXpNz2OjL5NeQOKYzBCT3SWIB0IG7fQhgA=; b=0zbsVYXlb/aMwK97xAkv0dlsadlTraGDRfzY9St7B8UejpYdYJWdzpAy13nM27wacg kWn6Zp+BX9+rxMVyjtF0I/4NwvyP51BeC0vi5qeWf+KWO7a8/FBjhdeNF8iyUdQIBT+h Qkq5GJXZ15LfUG0bMQqyrl02RZs/FD76IUcbfx7XbM8pro+noO1ZPK8SP/zLU/L7eIs7 iDOS0vLqt4Z/h709AZyGqzCI9aujsbNZ11HBVeAkl/KOdQACQ9MHBMxM+uiRVNumbYWn sTqAQ4rUbKhW1eM8HpTaiu6JH3it/ECNIyMQkm7jjjFxTDDdms5R5Q4p1Bzx4lLUJ0cC 11gg== MIME-Version: 1.0 X-Received: by 10.224.166.73 with SMTP id l9mr2327255qay.34.1404348881565; Wed, 02 Jul 2014 17:54:41 -0700 (PDT) Received: by 10.96.73.39 with HTTP; Wed, 2 Jul 2014 17:54:41 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 Jul 2014 17:54:41 -0700 Message-ID: Subject: Re: Add netbw option to systat From: hiren panchasara To: Bryan Venteicher Content-Type: text/plain; charset=UTF-8 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: Thu, 03 Jul 2014 00:54:42 -0000 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. 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 :-) It looks okay me otherwise and thanks for your work. cheers, Hiren