examples: added traces in tcp-variants-comparison

This commit is contained in:
Natale Patriciello
2016-08-30 09:23:03 +02:00
parent 7e1c1a5238
commit ceffbb20d0

View File

@@ -63,6 +63,9 @@ Ptr<OutputStreamWrapper> cWndStream;
Ptr<OutputStreamWrapper> ssThreshStream;
Ptr<OutputStreamWrapper> rttStream;
Ptr<OutputStreamWrapper> rtoStream;
Ptr<OutputStreamWrapper> nextTxStream;
Ptr<OutputStreamWrapper> nextRxStream;
Ptr<OutputStreamWrapper> inFlightStream;
uint32_t cWndValue;
uint32_t ssThreshValue;
@@ -123,6 +126,23 @@ RtoTracer (Time oldval, Time newval)
*rtoStream->GetStream () << Simulator::Now ().GetSeconds () << " " << newval.GetSeconds () << std::endl;
}
static void
NextTxTracer (SequenceNumber32 old, SequenceNumber32 nextTx)
{
*nextTxStream->GetStream () << Simulator::Now ().GetSeconds () << " " << nextTx << std::endl;
}
static void
InFlightTracer (uint32_t old, uint32_t inFlight)
{
*inFlightStream->GetStream () << Simulator::Now ().GetSeconds () << " " << inFlight << std::endl;
}
static void
NextRxTracer (SequenceNumber32 old, SequenceNumber32 nextRx)
{
*nextRxStream->GetStream () << Simulator::Now ().GetSeconds () << " " << nextRx << std::endl;
}
static void
TraceCwnd (std::string cwnd_tr_file_name)
@@ -156,6 +176,31 @@ TraceRto (std::string rto_tr_file_name)
Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/RTO", MakeCallback (&RtoTracer));
}
static void
TraceNextTx (std::string &next_tx_seq_file_name)
{
AsciiTraceHelper ascii;
nextTxStream = ascii.CreateFileStream (next_tx_seq_file_name.c_str ());
Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/NextTxSequence", MakeCallback (&NextTxTracer));
}
static void
TraceInFlight (std::string &in_flight_file_name)
{
AsciiTraceHelper ascii;
inFlightStream = ascii.CreateFileStream (in_flight_file_name.c_str ());
Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/BytesInFlight", MakeCallback (&InFlightTracer));
}
static void
TraceNextRx (std::string &next_rx_seq_file_name)
{
AsciiTraceHelper ascii;
nextRxStream = ascii.CreateFileStream (next_rx_seq_file_name.c_str ());
Config::ConnectWithoutContext ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/1/RxBuffer/NextRxSequence", MakeCallback (&NextRxTracer));
}
int main (int argc, char *argv[])
{
std::string transport_prot = "TcpWestwood";
@@ -425,6 +470,9 @@ int main (int argc, char *argv[])
Simulator::Schedule (Seconds (0.00001), &TraceSsThresh, prefix_file_name + "-ssth.data");
Simulator::Schedule (Seconds (0.00001), &TraceRtt, prefix_file_name + "-rtt.data");
Simulator::Schedule (Seconds (0.00001), &TraceRto, prefix_file_name + "-rto.data");
Simulator::Schedule (Seconds (0.00001), &TraceNextTx, prefix_file_name + "-next-tx.data");
Simulator::Schedule (Seconds (0.00001), &TraceInFlight, prefix_file_name + "-inflight.data");
Simulator::Schedule (Seconds (0.1), &TraceNextRx, prefix_file_name + "-next-rx.data");
}
if (pcap)