Tracing RTT from TcpSocketBase class

920 views
Skip to first unread message

Mauro Vidotto

unread,
Aug 9, 2011, 8:47:32 PM8/9/11
to ns-3-users
Hi all,

I am new to ns3. I am using ns3.10 and want to trace the RTT from the class TcpSocketBase class. I have created a simple topology with three nodes for this:
    
n0 ------------------- n1------------------ n2
      point-to-point         point-to-point

n0 has installed a onoffapplication and n2 has installed a sinkapplication (n0 sends packets to n2), n1 acts as a router.

By using the following piece of code I was trying to trace the RTT value on node n0 of the TcpSocketBase class. The problem I have is that i do not get any output for this traced value (no error at compilation time and no error when running the simulation, the file RTT.log is created but at the end of simulation has a size of 0). I suspect that the config path I am using is wrong ( I used a similar code to trace CongestionWindow sucessfuly on the same simulation). I have checked Doxygen but I could not see any appropriate config path.


//Tracing RTT sample
AsciiTraceHelper asciiTraceHelper2;
Ptr<OutputStreamWrapper> stream2 = asciiTraceHelper2.CreateFileStream ("RTT.log");
Simulator::Schedule (Seconds (2.0000001), Config::ConnectWithoutContext ,"/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/RTTS", MakeBoundCallback (&RTTChange, stream2));

//Definition of RTTChange function
static void
RTTChange (Ptr<OutputStreamWrapper> stream, Time oldRTTS, Time newRTTS)
{
  NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "\t RTTS  \t" << newRTTS);
  *stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << oldRTTS << "\t" << newRTTS << std::endl;
}

Can someone advice about this issue?

Thanks in advance
Mauro Vidotto

John Abraham

unread,
Aug 10, 2011, 6:03:07 AM8/10/11
to ns-3-users
I don't think RTT tracing is implemented
However, try using the following diff

+ //Tracing RTT sample
+ AsciiTraceHelper asciiTraceHelper2;
+ Ptr<OutputStreamWrapper> stream2 =
asciiTraceHelper2.CreateFileStream ("RTT.log");
+ Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/
SocketList/0/RTT", MakeBoundCallback (&RTTChange, stream2));


--- a/src/internet/model/tcp-socket-base.cc Mon Aug 08 08:33:29 2011
-0700
+++ b/src/internet/model/tcp-socket-base.cc Wed Aug 10 06:00:43 2011
-0400
@@ -1453,7 +1453,7 @@
// Use m_rtt for the estimation. Note, RTT of duplicated
acknowledgement
// (which should be ignored) is handled by m_rtt. Once timestamp
option
// is implemented, this function would be more elaborated.
- m_rtt->AckSeq (tcpHeader.GetAckNumber () );
+ m_lastRtt = m_rtt->AckSeq (tcpHeader.GetAckNumber () );
};

Mauro Vidotto

unread,
Aug 11, 2011, 8:42:31 PM8/11/11
to ns-3-...@googlegroups.com


2011/8/10 John Abraham <john...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.

Hi John, Thanks for the fast answer.

I thought it was possible to trace it because Doxygen documentation shows it as one of the possible tracesources for the class TcpSocketBase:
  • RTT: Last RTT sample
But as you said, when searching through the code of TcpSocketBase the variable m_lastRtt is not modified by any method.

I tried your suggestion (not sure how to use the diff , I just add the line  m_lastRtt = m_rtt->AckSeq (tcpHeader.GetAckNumber ()); to the correct part of the class TcpSocketBase). After this I got the RTT.log file written with information.

Regarding the change you proposed, what am I exactly getting on the variable m_lastRtt now? Is the sample value or the estimated value?

Regards
Mauro Vidotto





John Abraham

unread,
Aug 11, 2011, 8:54:34 PM8/11/11
to ns-3-users
From what I see you should be getting Sample RTT old and new.

On Aug 11, 8:42 pm, Mauro Vidotto <mauro.vido...@gmail.com> wrote:
> 2011/8/10 John Abraham <johnj...@gmail.com>
>    - *RTT*: Last RTT sample
Reply all
Reply to author
Forward
0 new messages