Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Oct 2014 06:22:37 +1100
From:      grenville armitage <garmitage@swin.edu.au>
To:        freebsd-dtrace@freebsd.org
Subject:   dtrace question -- TCP smoothed RTT ?
Message-ID:  <54440F7D.3040700@swin.edu.au>

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



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