From owner-freebsd-dtrace@FreeBSD.ORG Sun Oct 19 20:01:25 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B0E1C617 for ; Sun, 19 Oct 2014 20:01:25 +0000 (UTC) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86AF8F80 for ; Sun, 19 Oct 2014 20:01:24 +0000 (UTC) Received: from cpe-72-182-123-83.austin.res.rr.com ([72.182.123.83]:23300 helo=[192.168.1.121]) by vps.hungerhost.com with esmtpsa (TLSv1:DHE-RSA-AES128-SHA:128) (Exim 4.82) (envelope-from ) id 1XfwfB-0004lS-2v; Sun, 19 Oct 2014 16:01:13 -0400 Message-ID: <54441885.3060603@neville-neil.com> Date: Sun, 19 Oct 2014 16:01:09 -0400 From: George Neville-Neil User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: grenville armitage , freebsd-dtrace@freebsd.org Subject: Re: dtrace question -- TCP smoothed RTT ? References: <54440F7D.3040700@swin.edu.au> In-Reply-To: <54440F7D.3040700@swin.edu.au> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - neville-neil.com X-Get-Message-Sender-Via: vps.hungerhost.com: authenticated_id: gnn@neville-neil.com X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:01:25 -0000 On 10/19/2014 15:22, grenville armitage wrote: > Hi, > > Just started playing with Dtrace two weeks ago, and am curious to see > how much siftr(4) functionality can be replicated with a dtrace script. > Apologies in advance if my question/proposal stems from simply having > too much 'dtrace newbie' flowing in my veins. > > I'd like be able to use args[3]->tcps_srtt to extract the current > smoothed TCP RTT when inside a tcp:::send or tcp:::receive probe. > Currently this isn't available (as best as I can tell). My solution was > to patch /usr/src/cddl/lib/libdtrace/tcp.d by adding two lines as follows: > > > *** tcp.d-orig Fri Aug 15 16:35:44 2014 > --- tcp.d Tue Oct 14 14:24:36 2014 > *************** > *** 116,121 **** > --- 116,122 ---- > uint32_t tcps_rto; /* round-trip timeout, msec */ > uint32_t tcps_mss; /* max segment size */ > int tcps_retransmit; /* retransmit send event, > boolean */ > + int tcps_srtt; /* smoothed RTT in units of > (TCP_RTT_SCALE*hz) */ > } tcpsinfo_t; > /* > *************** > *** 200,205 **** > --- 201,207 ---- > tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* > XXX */ > tcps_mss = p == NULL ? -1 : p->t_maxseg; > tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; > + tcps_srtt = p == NULL ? -1 : p->t_srtt; /* > smoothed RTT in units of (TCP_RTT_SCALE*hz) */ > }; > #pragma D binding "1.0" translator > > > The result is args[3]->tcps_srtt with the same semantics as the smoothed > RTT output by SIFTR. > > Would someone with commit bit like to take this change and run with it? > Or poke holes? Or suggest an improvement? > > (If it matters, the above patch was applied to and tested on FB10-stable > r269789 source.) > I'll take a look at this, possibly today. Do you have any scripts that use this functionality? Best, George