[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RTT, SRTT




Here you have an example on how to plot RTT and SRTT. Take a look to the
record procedure. Notice that if you set a very high bandwidth in the
link, then RTT --> 2*delay, and it is easier to verify the results.

I don't know whether this is the best way to do it or not. I got no
answers for my message
http://www-mash.cs.berkeley.edu/dist/archive/ns-users/9908/0389.html

BTW. In that email I was just trying to get both RTT, SRTT in the same
scale, not to get them in the correct units. This one does the right
conversion (I think), and shows them in seconds.

Any comments would be appreciated. 

/FCD 

----------------------------------

set ns [new Simulator]
ns-random 990821
set trace_rtt [open out.rtt w]
set trace_srtt [open out.srtt w]
proc record {} {
         global ns ttcp0 trace_rtt T_SRTT_BITS T_RTTVAR_BITS trace_srtt

         set time 0.01
         set curr_srtt    [$ttcp0 set srtt_]
         set curr_rtt [$ttcp0 set rtt_]
    # I assume the TCPTick is 0.1
         set curr_rtt [expr $curr_rtt * 0.1] 
         set curr_srtt [expr 0.1 * ($curr_srtt >> $T_SRTT_BITS) ]
         set now [$ns now]
         puts $trace_rtt "$now $curr_rtt"
         puts $trace_srtt "$now $curr_rtt"
         $ns at [expr $now+$time] "record"
}
proc finish {} {
    global ns trace_nam trace_rtt trace_srtt trace_tout trace_all
    $ns flush-trace
    close $trace_rtt
    close $trace_srtt
    exec xgraph out.rtt out.srtt -geometry 800x400 &
    exit 0
}
$ns color 1 Red
set n0 [$ns node]
set n1 [$ns node]
$ns duplex-link $n0   $n1 1000Mb      100ms    DropTail

set ttcp0 [$ns create-connection TCP $n0 TCPSink $n1 1]
set T_SRTT_BITS [$ttcp0 set T_SRTT_BITS]
set T_RTTVAR_BITS [$ttcp0 set T_RTTVAR_BITS]

set ftp0 [new Application/FTP]
$ftp0 attach-agent $ttcp0
$ns at 0.0  "record"
$ns at 0.5  "$ftp0 start"
$ns at 5.5   "$ftp0 stop"
$ns at 6.0   "finish"
$ns run

----------------------------------------------------------------------
Fernando Cela
email: [email protected]                     phone: +46 31 772 1709