Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Oct 2014 16:01:09 -0400
From:      George Neville-Neil <gnn@neville-neil.com>
To:        grenville armitage <garmitage@swin.edu.au>,  freebsd-dtrace@freebsd.org
Subject:   Re: dtrace question -- TCP smoothed RTT ?
Message-ID:  <54441885.3060603@neville-neil.com>
In-Reply-To: <54440F7D.3040700@swin.edu.au>
References:  <54440F7D.3040700@swin.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54441885.3060603>