From owner-freebsd-dtrace@FreeBSD.ORG Sun Oct 19 19:22:40 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 D1FE4128 for ; Sun, 19 Oct 2014 19:22:40 +0000 (UTC) Received: from gpo4.cc.swin.edu.au (gpo4.cc.swin.edu.au [136.186.1.33]) (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 6F3F3C6C for ; Sun, 19 Oct 2014 19:22:39 +0000 (UTC) Received: from [136.186.229.37] (garmitage.caia.swin.edu.au [136.186.229.37]) by gpo4.cc.swin.edu.au (8.14.3/8.14.3) with ESMTP id s9JJMbol014252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Oct 2014 06:22:37 +1100 Message-ID: <54440F7D.3040700@swin.edu.au> Date: Mon, 20 Oct 2014 06:22:37 +1100 From: grenville armitage User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121107 Thunderbird/16.0.2 MIME-Version: 1.0 To: freebsd-dtrace@freebsd.org Subject: dtrace question -- TCP smoothed RTT ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 19:22:40 -0000 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.) cheers, gja