mtp: Change the code style of examples

This commit is contained in:
F5
2023-11-14 15:35:16 +08:00
parent 07400b582e
commit b06d6278f9
10 changed files with 2339 additions and 2034 deletions

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2017-20 NITK Surathkal
* Copyright (c) 2020 Tom Henderson (better alignment with experiment)
@@ -91,16 +90,16 @@
// utilization and low queueing delay and fairness across competing flows
// sharing the same path.
#include <iostream>
#include <iomanip>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/traffic-control-module.h"
#include "ns3/mtp-interface.h"
#include <iomanip>
#include <iostream>
using namespace ns3;
@@ -119,7 +118,8 @@ std::vector<uint64_t> rxS3R1Bytes;
void
PrintProgress(Time interval)
{
std::cout << "Progress to " << std::fixed << std::setprecision (1) << Simulator::Now ().GetSeconds () << " seconds simulation time" << std::endl;
std::cout << "Progress to " << std::fixed << std::setprecision(1)
<< Simulator::Now().GetSeconds() << " seconds simulation time" << std::endl;
Simulator::Schedule(interval, &PrintProgress, interval);
}
@@ -142,7 +142,7 @@ TraceS3R1Sink (std::size_t index, Ptr<const Packet> p, const Address& a)
}
void
InitializeCounters (void)
InitializeCounters()
{
for (std::size_t i = 0; i < 10; i++)
{
@@ -163,15 +163,21 @@ PrintThroughput (Time measurementWindow)
{
for (std::size_t i = 0; i < 10; i++)
{
rxS1R1Throughput << measurementWindow.GetSeconds () << "s " << i << " " << (rxS1R1Bytes[i] * 8) / (measurementWindow.GetSeconds ()) / 1e6 << std::endl;
rxS1R1Throughput << measurementWindow.GetSeconds() << "s " << i << " "
<< (rxS1R1Bytes[i] * 8) / (measurementWindow.GetSeconds()) / 1e6
<< std::endl;
}
for (std::size_t i = 0; i < 20; i++)
{
rxS2R2Throughput << Simulator::Now ().GetSeconds () << "s " << i << " " << (rxS2R2Bytes[i] * 8) / (measurementWindow.GetSeconds ()) / 1e6 << std::endl;
rxS2R2Throughput << Simulator::Now().GetSeconds() << "s " << i << " "
<< (rxS2R2Bytes[i] * 8) / (measurementWindow.GetSeconds()) / 1e6
<< std::endl;
}
for (std::size_t i = 0; i < 10; i++)
{
rxS3R1Throughput << Simulator::Now ().GetSeconds () << "s " << i << " " << (rxS3R1Bytes[i] * 8) / (measurementWindow.GetSeconds ()) / 1e6 << std::endl;
rxS3R1Throughput << Simulator::Now().GetSeconds() << "s " << i << " "
<< (rxS3R1Bytes[i] * 8) / (measurementWindow.GetSeconds()) / 1e6
<< std::endl;
}
}
@@ -190,9 +196,9 @@ PrintFairness (Time measurementWindow)
}
average = ((sum / 10) * 8 / measurementWindow.GetSeconds()) / 1e6;
fairness = static_cast<double>(sum * sum) / (10 * sumSquares);
fairnessIndex << "Average throughput for S1-R1 flows: "
<< std::fixed << std::setprecision (2) << average << " Mbps; fairness: "
<< std::fixed << std::setprecision (3) << fairness << std::endl;
fairnessIndex << "Average throughput for S1-R1 flows: " << std::fixed << std::setprecision(2)
<< average << " Mbps; fairness: " << std::fixed << std::setprecision(3)
<< fairness << std::endl;
average = 0;
sumSquares = 0;
sum = 0;
@@ -204,9 +210,9 @@ PrintFairness (Time measurementWindow)
}
average = ((sum / 20) * 8 / measurementWindow.GetSeconds()) / 1e6;
fairness = static_cast<double>(sum * sum) / (20 * sumSquares);
fairnessIndex << "Average throughput for S2-R2 flows: "
<< std::fixed << std::setprecision (2) << average << " Mbps; fairness: "
<< std::fixed << std::setprecision (3) << fairness << std::endl;
fairnessIndex << "Average throughput for S2-R2 flows: " << std::fixed << std::setprecision(2)
<< average << " Mbps; fairness: " << std::fixed << std::setprecision(3)
<< fairness << std::endl;
average = 0;
sumSquares = 0;
sum = 0;
@@ -218,9 +224,9 @@ PrintFairness (Time measurementWindow)
}
average = ((sum / 10) * 8 / measurementWindow.GetSeconds()) / 1e6;
fairness = static_cast<double>(sum * sum) / (10 * sumSquares);
fairnessIndex << "Average throughput for S3-R1 flows: "
<< std::fixed << std::setprecision (2) << average << " Mbps; fairness: "
<< std::fixed << std::setprecision (3) << fairness << std::endl;
fairnessIndex << "Average throughput for S3-R1 flows: " << std::fixed << std::setprecision(2)
<< average << " Mbps; fairness: " << std::fixed << std::setprecision(3)
<< fairness << std::endl;
sum = 0;
for (std::size_t i = 0; i < 10; i++)
{
@@ -230,7 +236,8 @@ PrintFairness (Time measurementWindow)
{
sum += rxS2R2Bytes[i];
}
fairnessIndex << "Aggregate user-level throughput for flows through T1: " << static_cast<double> (sum * 8) / 1e9 << " Gbps" << std::endl;
fairnessIndex << "Aggregate user-level throughput for flows through T1: "
<< static_cast<double>(sum * 8) / 1e9 << " Gbps" << std::endl;
sum = 0;
for (std::size_t i = 0; i < 10; i++)
{
@@ -240,7 +247,8 @@ PrintFairness (Time measurementWindow)
{
sum += rxS1R1Bytes[i];
}
fairnessIndex << "Aggregate user-level throughput for flows to R1: " << static_cast<double> (sum * 8) / 1e9 << " Gbps" << std::endl;
fairnessIndex << "Aggregate user-level throughput for flows to R1: "
<< static_cast<double>(sum * 8) / 1e9 << " Gbps" << std::endl;
}
void
@@ -250,7 +258,8 @@ CheckT1QueueSize (Ptr<QueueDisc> queue)
uint32_t qSize = queue->GetNPackets();
Time backlog = Seconds(static_cast<double>(qSize * 1500 * 8) / 1e10); // 10 Gb/s
// report size in units of packets and ms
t1QueueLength << std::fixed << std::setprecision (2) << Simulator::Now ().GetSeconds () << " " << qSize << " " << backlog.GetMicroSeconds () << std::endl;
t1QueueLength << std::fixed << std::setprecision(2) << Simulator::Now().GetSeconds() << " "
<< qSize << " " << backlog.GetMicroSeconds() << std::endl;
// check queue size every 1/100 of a second
Simulator::Schedule(MilliSeconds(10), &CheckT1QueueSize, queue);
}
@@ -261,17 +270,16 @@ CheckT2QueueSize (Ptr<QueueDisc> queue)
uint32_t qSize = queue->GetNPackets();
Time backlog = Seconds(static_cast<double>(qSize * 1500 * 8) / 1e9); // 1 Gb/s
// report size in units of packets and ms
t2QueueLength << std::fixed << std::setprecision (2) << Simulator::Now ().GetSeconds () << " " << qSize << " " << backlog.GetMicroSeconds () << std::endl;
t2QueueLength << std::fixed << std::setprecision(2) << Simulator::Now().GetSeconds() << " "
<< qSize << " " << backlog.GetMicroSeconds() << std::endl;
// check queue size every 1/100 of a second
Simulator::Schedule(MilliSeconds(10), &CheckT2QueueSize, queue);
}
int main (int argc, char *argv[])
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable (4);
std::string outputFilePath = ".";
std::string tcpTypeId = "TcpDctcp";
Time flowStartupWindow = Seconds(1);
@@ -282,7 +290,9 @@ int main (int argc, char *argv[])
CommandLine cmd(__FILE__);
cmd.AddValue("tcpTypeId", "ns-3 TCP TypeId", tcpTypeId);
cmd.AddValue ("flowStartupWindow", "startup time window (TCP staggered starts)", flowStartupWindow);
cmd.AddValue("flowStartupWindow",
"startup time window (TCP staggered starts)",
flowStartupWindow);
cmd.AddValue("convergenceTime", "convergence time", convergenceTime);
cmd.AddValue("measurementWindow", "measurement window", measurementWindow);
cmd.AddValue("enableSwitchEcn", "enable ECN at switches", enableSwitchEcn);
@@ -299,7 +309,10 @@ int main (int argc, char *argv[])
rxS2R2Bytes.reserve(20);
rxS3R1Bytes.reserve(10);
NodeContainer S1, S2, S3, R2;
NodeContainer S1;
NodeContainer S2;
NodeContainer S3;
NodeContainer R2;
Ptr<Node> T1 = CreateObject<Node>();
Ptr<Node> T2 = CreateObject<Node>();
Ptr<Node> R1 = CreateObject<Node>();
@@ -336,7 +349,6 @@ int main (int argc, char *argv[])
pointToPointT.SetDeviceAttribute("DataRate", StringValue("10Gbps"));
pointToPointT.SetChannelAttribute("Delay", StringValue("10us"));
// Create a total of 62 links.
std::vector<NetDeviceContainer> S1T1;
S1T1.reserve(10);
@@ -377,20 +389,28 @@ int main (int argc, char *argv[])
// MinTh = 50, MaxTh = 150 recommended in ACM SIGCOMM 2010 DCTCP Paper
// This yields a target (MinTh) queue depth of 60us at 10 Gb/s
tchRed10.SetRootQueueDisc("ns3::RedQueueDisc",
"LinkBandwidth", StringValue ("10Gbps"),
"LinkDelay", StringValue ("10us"),
"MinTh", DoubleValue (50),
"MaxTh", DoubleValue (150));
"LinkBandwidth",
StringValue("10Gbps"),
"LinkDelay",
StringValue("10us"),
"MinTh",
DoubleValue(50),
"MaxTh",
DoubleValue(150));
QueueDiscContainer queueDiscs1 = tchRed10.Install(T1T2);
TrafficControlHelper tchRed1;
// MinTh = 20, MaxTh = 60 recommended in ACM SIGCOMM 2010 DCTCP Paper
// This yields a target queue depth of 250us at 1 Gb/s
tchRed1.SetRootQueueDisc("ns3::RedQueueDisc",
"LinkBandwidth", StringValue ("1Gbps"),
"LinkDelay", StringValue ("10us"),
"MinTh", DoubleValue (20),
"MaxTh", DoubleValue (60));
"LinkBandwidth",
StringValue("1Gbps"),
"LinkDelay",
StringValue("10us"),
"MinTh",
DoubleValue(20),
"MaxTh",
DoubleValue(60));
QueueDiscContainer queueDiscs2 = tchRed1.Install(R1T2.Get(1));
for (std::size_t i = 0; i < 10; i++)
{
@@ -464,8 +484,10 @@ int main (int argc, char *argv[])
sinkApp.Stop(stopTime);
OnOffHelper clientHelper1("ns3::TcpSocketFactory", Address());
clientHelper1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
clientHelper1.SetAttribute("OnTime",
StringValue("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper1.SetAttribute("OffTime",
StringValue("ns3::ConstantRandomVariable[Constant=0]"));
clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("1Gbps")));
clientHelper1.SetAttribute("PacketSize", UintegerValue(1000));
@@ -501,8 +523,10 @@ int main (int argc, char *argv[])
sinkApp.Stop(stopTime);
OnOffHelper clientHelper1("ns3::TcpSocketFactory", Address());
clientHelper1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
clientHelper1.SetAttribute("OnTime",
StringValue("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper1.SetAttribute("OffTime",
StringValue("ns3::ConstantRandomVariable[Constant=0]"));
clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("1Gbps")));
clientHelper1.SetAttribute("PacketSize", UintegerValue(1000));
@@ -517,7 +541,8 @@ int main (int argc, char *argv[])
else
{
clientApps1.Add(clientHelper1.Install(S3.Get(i - 10)));
clientApps1.Start ((i - 10) * flowStartupWindow / 10 + clientStartTime + MilliSeconds (i * 5));
clientApps1.Start((i - 10) * flowStartupWindow / 10 + clientStartTime +
MilliSeconds(i * 5));
}
clientApps1.Stop(stopTime);
@@ -547,8 +572,12 @@ int main (int argc, char *argv[])
s3r1Sinks[i]->TraceConnectWithoutContext("Rx", MakeBoundCallback(&TraceS3R1Sink, i));
}
Simulator::Schedule(flowStartupWindow + convergenceTime, &InitializeCounters);
Simulator::Schedule (flowStartupWindow + convergenceTime + measurementWindow, &PrintThroughput, measurementWindow);
Simulator::Schedule (flowStartupWindow + convergenceTime + measurementWindow, &PrintFairness, measurementWindow);
Simulator::Schedule(flowStartupWindow + convergenceTime + measurementWindow,
&PrintThroughput,
measurementWindow);
Simulator::Schedule(flowStartupWindow + convergenceTime + measurementWindow,
&PrintFairness,
measurementWindow);
Simulator::Schedule(progressInterval, &PrintProgress, progressInterval);
Simulator::Schedule(flowStartupWindow + convergenceTime, &CheckT1QueueSize, queueDiscs1.Get(0));
Simulator::Schedule(flowStartupWindow + convergenceTime, &CheckT2QueueSize, queueDiscs2.Get(0));

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -16,7 +15,6 @@
* Contributed by: Luis Cortes (cortes@gatech.edu)
*/
// This script exercises global routing code in a mixed point-to-point
// and csma/cd environment. We bring up and down interfaces and observe
// the effect on global routing. We explicitly enable the attribute
@@ -62,19 +60,19 @@
// - Tracing of queues and packet receptions to file "dynamic-global-routing.tr"
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
#include "ns3/applications-module.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <string>
using namespace ns3;
@@ -83,10 +81,7 @@ NS_LOG_COMPONENT_DEFINE ("DynamicGlobalRoutingExample");
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
// The below value configures the default behavior of global routing.
// By default, it is disabled. To respond to interface events, set to true
Config::SetDefault("ns3::Ipv4GlobalRouting::RespondToInterfaceEvents", BooleanValue(true));
@@ -154,8 +149,7 @@ main (int argc, char *argv[])
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
InetSocketAddress (i5i6.GetAddress (1), port));
OnOffHelper onoff("ns3::UdpSocketFactory", InetSocketAddress(i5i6.GetAddress(1), port));
onoff.SetConstantRate(DataRate("2kbps"));
onoff.SetAttribute("PacketSize", UintegerValue(50));
@@ -165,8 +159,7 @@ main (int argc, char *argv[])
// Create a second OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
OnOffHelper onoff2 ("ns3::UdpSocketFactory",
InetSocketAddress (i1i6.GetAddress (1), port));
OnOffHelper onoff2("ns3::UdpSocketFactory", InetSocketAddress(i1i6.GetAddress(1), port));
onoff2.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
onoff2.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
onoff2.SetAttribute("DataRate", StringValue("2kbps"));
@@ -189,7 +182,6 @@ main (int argc, char *argv[])
apps2.Start(Seconds(11.0));
apps2.Stop(Seconds(16.0));
AsciiTraceHelper ascii;
Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream("dynamic-global-routing.tr");
p2p.EnableAsciiAll(stream);
@@ -221,11 +213,14 @@ main (int argc, char *argv[])
// Trace routing tables
Ipv4GlobalRoutingHelper g;
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("dynamic-global-routing.routes", std::ios::out);
Ptr<OutputStreamWrapper> routingStream =
Create<OutputStreamWrapper>("dynamic-global-routing.routes", std::ios::out);
g.PrintRoutingTableAllAt(Seconds(12), routingStream);
NS_LOG_INFO("Run Simulation.");
Simulator::Run();
Simulator::Destroy();
NS_LOG_INFO("Done.");
return 0;
}

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2015 Universita' degli Studi di Napoli Federico II
*
@@ -27,10 +26,11 @@
// n1 ------------------------------------ n2 ----------------------------------- n3
// point-to-point (access link) point-to-point (bottleneck link)
// 100 Mbps, 0.1 ms bandwidth [10 Mbps], delay [5 ms]
// qdiscs PfifoFast with capacity qdiscs queueDiscType in {PfifoFast, ARED, CoDel, FqCoDel, PIE} [PfifoFast]
// of 1000 packets with capacity of queueDiscSize packets [1000]
// netdevices queues with size of 100 packets netdevices queues with size of netdevicesQueueSize packets [100]
// without BQL bql BQL [false]
// qdiscs PfifoFast with capacity qdiscs queueDiscType in {PfifoFast, ARED, CoDel,
// FqCoDel, PIE} [PfifoFast] of 1000 packets with capacity of
// queueDiscSize packets [1000] netdevices queues with size of 100 packets netdevices queues with
// size of netdevicesQueueSize packets [100] without BQL bql BQL
// [false]
// *** fixed configuration ***
//
// Two TCP flows are generated: one from n1 to n3 and the other from n3 to n1.
@@ -53,53 +53,79 @@
// If you use an AQM as queue disc on the bottleneck netdevices, you can observe that the ping Rtt
// decrease. A further decrease can be observed when you enable BQL.
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/internet-apps-module.h"
#include "ns3/traffic-control-module.h"
#include "ns3/core-module.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/mtp-interface.h"
#include "ns3/internet-apps-module.h"
#include "ns3/internet-module.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/traffic-control-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE("BenchmarkQueueDiscs");
/**
* Print the queue limitis.
*
* \param stream The ouput stream.
* \param oldVal Old value.
* \param newVal New value.
*/
void
LimitsTrace(Ptr<OutputStreamWrapper> stream, uint32_t oldVal, uint32_t newVal)
{
*stream->GetStream() << Simulator::Now().GetSeconds() << " " << newVal << std::endl;
}
/**
* Print the bytes in the queue.
*
* \param stream The ouput stream.
* \param oldVal Old value.
* \param newVal New value.
*/
void
BytesInQueueTrace(Ptr<OutputStreamWrapper> stream, uint32_t oldVal, uint32_t newVal)
{
*stream->GetStream() << Simulator::Now().GetSeconds() << " " << newVal << std::endl;
}
/**
* Sample and print the queue goodput.
*
* \param app The Tx app.
* \param stream The ouput stream.
* \param period The sampling period.
*/
static void
GoodputSampling (std::string fileName, ApplicationContainer app, Ptr<OutputStreamWrapper> stream, float period)
GoodputSampling(ApplicationContainer app, Ptr<OutputStreamWrapper> stream, float period)
{
Simulator::Schedule (Seconds (period), &GoodputSampling, fileName, app, stream, period);
Simulator::Schedule(Seconds(period), &GoodputSampling, app, stream, period);
double goodput;
uint64_t totalPackets = DynamicCast<PacketSink>(app.Get(0))->GetTotalRx();
goodput = totalPackets * 8 / (Simulator::Now().GetSeconds() * 1024); // Kbit/s
*stream->GetStream() << Simulator::Now().GetSeconds() << " " << goodput << std::endl;
}
static void PingRtt (std::string context, Time rtt)
/**
* Print the ping RTT.
*
* \param context The context.
* \param rtt The RTT.
*/
static void
PingRtt(std::string context, Time rtt)
{
std::cout << context << "=" << rtt.GetMilliSeconds() << " ms" << std::endl;
}
int main (int argc, char *argv[])
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
std::string bandwidth = "10Mbps";
std::string delay = "5ms";
std::string queueDiscType = "PfifoFast";
@@ -110,16 +136,20 @@ int main (int argc, char *argv[])
std::string flowsDatarate = "20Mbps";
uint32_t flowsPacketsSize = 1000;
float startTime = 0.1f; // in s
float startTime = 0.1F; // in s
float simDuration = 60;
float samplingPeriod = 1;
CommandLine cmd(__FILE__);
cmd.AddValue("bandwidth", "Bottleneck bandwidth", bandwidth);
cmd.AddValue("delay", "Bottleneck delay", delay);
cmd.AddValue ("queueDiscType", "Bottleneck queue disc type in {PfifoFast, ARED, CoDel, FqCoDel, PIE, prio}", queueDiscType);
cmd.AddValue("queueDiscType",
"Bottleneck queue disc type in {PfifoFast, ARED, CoDel, FqCoDel, PIE, prio}",
queueDiscType);
cmd.AddValue("queueDiscSize", "Bottleneck queue disc size in packets", queueDiscSize);
cmd.AddValue ("netdevicesQueueSize", "Bottleneck netdevices queue size in packets", netdevicesQueueSize);
cmd.AddValue("netdevicesQueueSize",
"Bottleneck netdevices queue size in packets",
netdevicesQueueSize);
cmd.AddValue("bql", "Enable byte queue limits on bottleneck netdevices", bql);
cmd.AddValue("flowsDatarate", "Upload and download flows datarate", flowsDatarate);
cmd.AddValue("flowsPacketsSize", "Upload and download flows packets sizes", flowsPacketsSize);
@@ -131,7 +161,9 @@ int main (int argc, char *argv[])
float stopTime = startTime + simDuration;
// Create nodes
NodeContainer n1, n2, n3;
NodeContainer n1;
NodeContainer n2;
NodeContainer n3;
n1.Create(1);
n2.Create(1);
n3.Create(1);
@@ -145,7 +177,9 @@ int main (int argc, char *argv[])
PointToPointHelper bottleneckLink;
bottleneckLink.SetDeviceAttribute("DataRate", StringValue(bandwidth));
bottleneckLink.SetChannelAttribute("Delay", StringValue(delay));
bottleneckLink.SetQueue ("ns3::DropTailQueue", "MaxSize", StringValue (std::to_string (netdevicesQueueSize) + "p"));
bottleneckLink.SetQueue("ns3::DropTailQueue",
"MaxSize",
StringValue(std::to_string(netdevicesQueueSize) + "p"));
InternetStackHelper stack;
stack.InstallAll();
@@ -157,41 +191,46 @@ int main (int argc, char *argv[])
// Bottleneck link traffic control configuration
TrafficControlHelper tchBottleneck;
if (queueDiscType.compare ("PfifoFast") == 0)
if (queueDiscType == "PfifoFast")
{
tchBottleneck.SetRootQueueDisc ("ns3::PfifoFastQueueDisc", "MaxSize",
tchBottleneck.SetRootQueueDisc(
"ns3::PfifoFastQueueDisc",
"MaxSize",
QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueDiscSize)));
}
else if (queueDiscType.compare ("ARED") == 0)
else if (queueDiscType == "ARED")
{
tchBottleneck.SetRootQueueDisc("ns3::RedQueueDisc");
Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
Config::SetDefault("ns3::RedQueueDisc::MaxSize",
QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueDiscSize)));
}
else if (queueDiscType.compare ("CoDel") == 0)
else if (queueDiscType == "CoDel")
{
tchBottleneck.SetRootQueueDisc("ns3::CoDelQueueDisc");
Config::SetDefault("ns3::CoDelQueueDisc::MaxSize",
QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueDiscSize)));
}
else if (queueDiscType.compare ("FqCoDel") == 0)
else if (queueDiscType == "FqCoDel")
{
tchBottleneck.SetRootQueueDisc("ns3::FqCoDelQueueDisc");
Config::SetDefault("ns3::FqCoDelQueueDisc::MaxSize",
QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueDiscSize)));
}
else if (queueDiscType.compare ("PIE") == 0)
else if (queueDiscType == "PIE")
{
tchBottleneck.SetRootQueueDisc("ns3::PieQueueDisc");
Config::SetDefault("ns3::PieQueueDisc::MaxSize",
QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueDiscSize)));
}
else if (queueDiscType.compare ("prio") == 0)
else if (queueDiscType == "prio")
{
uint16_t handle = tchBottleneck.SetRootQueueDisc ("ns3::PrioQueueDisc", "Priomap",
uint16_t handle =
tchBottleneck.SetRootQueueDisc("ns3::PrioQueueDisc",
"Priomap",
StringValue("0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1"));
TrafficControlHelper::ClassIdList cid = tchBottleneck.AddQueueDiscClasses (handle, 2, "ns3::QueueDiscClass");
TrafficControlHelper::ClassIdList cid =
tchBottleneck.AddQueueDiscClasses(handle, 2, "ns3::QueueDiscClass");
tchBottleneck.AddChildQueueDisc(handle, cid[0], "ns3::FifoQueueDisc");
tchBottleneck.AddChildQueueDisc(handle, cid[1], "ns3::RedQueueDisc");
}
@@ -219,20 +258,27 @@ int main (int argc, char *argv[])
address.NewNetwork();
Ipv4InterfaceContainer interfacesBottleneck = address.Assign(devicesBottleneckLink);
Ptr<NetDeviceQueueInterface> interface = devicesBottleneckLink.Get (0)->GetObject<NetDeviceQueueInterface> ();
Ptr<NetDeviceQueueInterface> interface =
devicesBottleneckLink.Get(0)->GetObject<NetDeviceQueueInterface>();
Ptr<NetDeviceQueue> queueInterface = interface->GetTxQueue(0);
Ptr<DynamicQueueLimits> queueLimits = StaticCast<DynamicQueueLimits> (queueInterface->GetQueueLimits ());
Ptr<DynamicQueueLimits> queueLimits =
StaticCast<DynamicQueueLimits>(queueInterface->GetQueueLimits());
AsciiTraceHelper ascii;
if (bql)
{
queueDiscType = queueDiscType + "-bql";
Ptr<OutputStreamWrapper> streamLimits = ascii.CreateFileStream (queueDiscType + "-limits.txt");
queueLimits->TraceConnectWithoutContext ("Limit",MakeBoundCallback (&LimitsTrace, streamLimits));
Ptr<OutputStreamWrapper> streamLimits =
ascii.CreateFileStream(queueDiscType + "-limits.txt");
queueLimits->TraceConnectWithoutContext("Limit",
MakeBoundCallback(&LimitsTrace, streamLimits));
}
Ptr<Queue<Packet> > queue = StaticCast<PointToPointNetDevice> (devicesBottleneckLink.Get (0))->GetQueue ();
Ptr<OutputStreamWrapper> streamBytesInQueue = ascii.CreateFileStream (queueDiscType + "-bytesInQueue.txt");
queue->TraceConnectWithoutContext ("BytesInQueue",MakeBoundCallback (&BytesInQueueTrace, streamBytesInQueue));
Ptr<Queue<Packet>> queue =
StaticCast<PointToPointNetDevice>(devicesBottleneckLink.Get(0))->GetQueue();
Ptr<OutputStreamWrapper> streamBytesInQueue =
ascii.CreateFileStream(queueDiscType + "-bytesInQueue.txt");
queue->TraceConnectWithoutContext("BytesInQueue",
MakeBoundCallback(&BytesInQueueTrace, streamBytesInQueue));
Ipv4InterfaceContainer n1Interface;
n1Interface.Add(interfacesAccess.Get(0));
@@ -247,7 +293,9 @@ int main (int argc, char *argv[])
// Flows configuration
// Bidirectional TCP streams with ping like flent tcp_bidirectional test.
uint16_t port = 7;
ApplicationContainer uploadApp, downloadApp, sourceApps;
ApplicationContainer uploadApp;
ApplicationContainer downloadApp;
ApplicationContainer sourceApps;
// Configure and install upload flow
Address addUp(InetSocketAddress(Ipv4Address::GetAny(), port));
PacketSinkHelper sinkHelperUp("ns3::TcpSocketFactory", addUp);
@@ -293,12 +341,20 @@ int main (int argc, char *argv[])
sourceApps.Start(Seconds(0 + 0.1));
sourceApps.Stop(Seconds(stopTime - 0.1));
Ptr<OutputStreamWrapper> uploadGoodputStream = ascii.CreateFileStream (queueDiscType + "-upGoodput.txt");
Simulator::Schedule (Seconds (samplingPeriod), &GoodputSampling, queueDiscType + "-upGoodput.txt", uploadApp,
uploadGoodputStream, samplingPeriod);
Ptr<OutputStreamWrapper> downloadGoodputStream = ascii.CreateFileStream (queueDiscType + "-downGoodput.txt");
Simulator::Schedule (Seconds (samplingPeriod), &GoodputSampling, queueDiscType + "-downGoodput.txt", downloadApp,
downloadGoodputStream, samplingPeriod);
Ptr<OutputStreamWrapper> uploadGoodputStream =
ascii.CreateFileStream(queueDiscType + "-upGoodput.txt");
Simulator::Schedule(Seconds(samplingPeriod),
&GoodputSampling,
uploadApp,
uploadGoodputStream,
samplingPeriod);
Ptr<OutputStreamWrapper> downloadGoodputStream =
ascii.CreateFileStream(queueDiscType + "-downGoodput.txt");
Simulator::Schedule(Seconds(samplingPeriod),
&GoodputSampling,
downloadApp,
downloadGoodputStream,
samplingPeriod);
// Flow monitor
Ptr<FlowMonitor> flowMonitor;

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014 Universita' di Firenze, Italy
*
@@ -50,32 +49,31 @@
// the Echo Reply is unable to reach the sender.
// Examining the .pcap files with Wireshark can confirm this effect.
#include "ns3/core-module.h"
#include "ns3/internet-apps-module.h"
#include "ns3/internet-module.h"
#include "ns3/ipv6-routing-table-entry.h"
#include "ns3/ipv6-static-routing-helper.h"
#include "ns3/mtp-module.h"
#include "ns3/point-to-point-module.h"
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/internet-apps-module.h"
#include "ns3/ipv6-static-routing-helper.h"
#include "ns3/ipv6-routing-table-entry.h"
#include "ns3/mtp-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE("RipNgSimpleRouting");
void TearDownLink (Ptr<Node> nodeA, Ptr<Node> nodeB, uint32_t interfaceA, uint32_t interfaceB)
void
TearDownLink(Ptr<Node> nodeA, Ptr<Node> nodeB, uint32_t interfaceA, uint32_t interfaceB)
{
nodeA->GetObject<Ipv6>()->SetDown(interfaceA);
nodeB->GetObject<Ipv6>()->SetDown(interfaceB);
}
int main (int argc, char **argv)
int
main(int argc, char** argv)
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
bool verbose = false;
bool printRoutingTables = false;
bool showPings = false;
@@ -83,9 +81,13 @@ int main (int argc, char **argv)
CommandLine cmd(__FILE__);
cmd.AddValue("verbose", "turn on log components", verbose);
cmd.AddValue ("printRoutingTables", "Print routing tables at 30, 60 and 90 seconds", printRoutingTables);
cmd.AddValue("printRoutingTables",
"Print routing tables at 30, 60 and 90 seconds",
printRoutingTables);
cmd.AddValue("showPings", "Show Ping6 reception", showPings);
cmd.AddValue ("splitHorizonStrategy", "Split Horizon strategy to use (NoSplitHorizon, SplitHorizon, PoisonReverse)", SplitHorizon);
cmd.AddValue("splitHorizonStrategy",
"Split Horizon strategy to use (NoSplitHorizon, SplitHorizon, PoisonReverse)",
SplitHorizon);
cmd.Parse(argc, argv);
if (verbose)
@@ -140,7 +142,6 @@ int main (int argc, char **argv)
NodeContainer routers(a, b, c, d);
NodeContainer nodes(src, dst);
NS_LOG_INFO("Create channels.");
PointToPointHelper p2p;
p2p.SetDeviceAttribute("DataRate", DataRateValue(5000000));
@@ -271,4 +272,6 @@ int main (int argc, char **argv)
Simulator::Run();
Simulator::Destroy();
NS_LOG_INFO("Done.");
return 0;
}

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2013 Universita' di Firenze
* Copyright (c) 2019 Caliola Engineering, LLC : RFC 6621 multicast packet de-duplication
@@ -22,45 +21,41 @@
* network to all nodes over multiple hops.
*/
#include "ns3/test.h"
#include "ns3/simulator.h"
#include "ns3/simple-channel.h"
#include "ns3/simple-net-device.h"
#include "ns3/socket.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/string.h"
#include "ns3/config.h"
#include "ns3/data-rate.h"
#include "ns3/uinteger.h"
#include "ns3/names.h"
#include "ns3/log.h"
#include "ns3/node.h"
#include "ns3/double.h"
#include "ns3/inet-socket-address.h"
#include "ns3/random-variable-stream.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/ipv4-static-routing.h"
#include "ns3/udp-socket-factory.h"
#include "ns3/udp-socket.h"
#include "ns3/packet-sink.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/ipv4-list-routing-helper.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/simple-net-device-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/ipv4-static-routing.h"
#include "ns3/log.h"
#include "ns3/mtp-interface.h"
#include "ns3/names.h"
#include "ns3/node.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/packet-sink.h"
#include "ns3/random-variable-stream.h"
#include "ns3/simple-channel.h"
#include "ns3/simple-net-device-helper.h"
#include "ns3/simple-net-device.h"
#include "ns3/simulator.h"
#include "ns3/socket.h"
#include "ns3/string.h"
#include "ns3/test.h"
#include "ns3/trace-helper.h"
#include "ns3/traffic-control-layer.h"
#include "ns3/mtp-module.h"
#include "ns3/udp-socket-factory.h"
#include "ns3/udp-socket.h"
#include "ns3/uinteger.h"
#include <string>
#include <limits>
#include <functional>
#include <limits>
#include <string>
using namespace ns3;
@@ -79,10 +74,7 @@ using namespace ns3;
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
// multicast target
const std::string targetAddr = "239.192.100.1";
Config::SetDefault("ns3::Ipv4L3Protocol::EnableDuplicatePacketDetection", BooleanValue(true));
@@ -141,36 +133,50 @@ main (int argc, char *argv[])
//// many Unix variants.
//// So, we just log it and fall through to LookupStatic ()
auto ipv4 = node->GetObject<Ipv4>();
NS_ASSERT_MSG ((bool) ipv4, "Node " << Names::FindName (node) << " does not have Ipv4 aggregate");
NS_ASSERT_MSG((bool)ipv4,
"Node " << Names::FindName(node) << " does not have Ipv4 aggregate");
auto routing = staticRouting.GetStaticRouting(ipv4);
routing->AddHostRouteTo(targetAddr.c_str(), ipv4->GetInterfaceForDevice(*diter), 0);
}
else
{
// route for forwarding
staticRouting.AddMulticastRoute (node, Ipv4Address::GetAny (), targetAddr.c_str (), *diter, NetDeviceContainer (*diter));
staticRouting.AddMulticastRoute(node,
Ipv4Address::GetAny(),
targetAddr.c_str(),
*diter,
NetDeviceContainer(*diter));
}
}
// set the topology, by default fully-connected
auto channel = devices.Get(0)->GetChannel();
auto simplechannel = channel->GetObject<SimpleChannel>();
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("A/dev"), Names::Find <SimpleNetDevice> ("D/dev"));
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("D/dev"), Names::Find <SimpleNetDevice> ("A/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("A/dev"),
Names::Find<SimpleNetDevice>("D/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("D/dev"),
Names::Find<SimpleNetDevice>("A/dev"));
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("A/dev"), Names::Find <SimpleNetDevice> ("E/dev"));
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("E/dev"), Names::Find <SimpleNetDevice> ("A/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("A/dev"),
Names::Find<SimpleNetDevice>("E/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("E/dev"),
Names::Find<SimpleNetDevice>("A/dev"));
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("B/dev"), Names::Find <SimpleNetDevice> ("E/dev"));
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("E/dev"), Names::Find <SimpleNetDevice> ("B/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("B/dev"),
Names::Find<SimpleNetDevice>("E/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("E/dev"),
Names::Find<SimpleNetDevice>("B/dev"));
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("C/dev"), Names::Find <SimpleNetDevice> ("E/dev"));
simplechannel->BlackList (Names::Find <SimpleNetDevice> ("E/dev"), Names::Find <SimpleNetDevice> ("C/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("C/dev"),
Names::Find<SimpleNetDevice>("E/dev"));
simplechannel->BlackList(Names::Find<SimpleNetDevice>("E/dev"),
Names::Find<SimpleNetDevice>("C/dev"));
// ensure some time progress between re-transmissions
simplechannel->SetAttribute("Delay", TimeValue(MilliSeconds(1)));
// sinks
PacketSinkHelper sinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), 9));
PacketSinkHelper sinkHelper("ns3::UdpSocketFactory",
InetSocketAddress(Ipv4Address::GetAny(), 9));
auto sinks = sinkHelper.Install("B");
sinks.Add(sinkHelper.Install("C"));
sinks.Add(sinkHelper.Install("D"));
@@ -185,8 +191,7 @@ main (int argc, char *argv[])
source.Start(Seconds(1.1));
// pcap traces
for (auto end = nodes.End (),
iter = nodes.Begin (); iter != end; ++iter)
for (auto end = nodes.End(), iter = nodes.Begin(); iter != end; ++iter)
{
internet.EnablePcapIpv4("smf-trace", (*iter)->GetId(), 1, false);
}
@@ -195,13 +200,12 @@ main (int argc, char *argv[])
Simulator::Run();
std::cout << "Node A sent " << 10 * 1024 << " bytes" << std::endl;
for (auto end = sinks.End (),
iter = sinks.Begin (); iter != end; ++iter)
for (auto end = sinks.End(), iter = sinks.Begin(); iter != end; ++iter)
{
auto node = (*iter)->GetNode();
auto sink = (*iter)->GetObject<PacketSink>();
std::cout << "Node " << Names::FindName (node)
<< " received " << sink->GetTotalRx () << " bytes" << std::endl;
std::cout << "Node " << Names::FindName(node) << " received " << sink->GetTotalRx()
<< " bytes" << std::endl;
}
Simulator::Destroy();

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -30,19 +29,19 @@
Source
*/
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/ipv4-list-routing-helper.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <string>
using namespace ns3;
@@ -53,7 +52,6 @@ static uint32_t currentTxBytes = 0;
static const uint32_t writeSize = 1040;
uint8_t data[writeSize];
void StartFlow(Ptr<Socket>, Ipv4Address, uint16_t);
void WriteUntilBufferFull(Ptr<Socket>, uint32_t);
@@ -65,10 +63,7 @@ void dstSocketRecv (Ptr<Socket> socket);
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
// Allow the user to override any of the defaults and the above
// DefaultValue::Bind ()s at run-time, via command-line arguments
CommandLine cmd(__FILE__);
@@ -152,16 +147,20 @@ main (int argc, char *argv[])
// There are no apps that can utilize the Socket Option so doing the work directly..
// Taken from tcp-large-transfer example
Ptr<Socket> srcSocket1 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory"));
Ptr<Socket> srcSocket2 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory"));
Ptr<Socket> srcSocket3 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory"));
Ptr<Socket> srcSocket4 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory"));
Ptr<Socket> srcSocket1 =
Socket::CreateSocket(nSrc, TypeId::LookupByName("ns3::TcpSocketFactory"));
Ptr<Socket> srcSocket2 =
Socket::CreateSocket(nSrc, TypeId::LookupByName("ns3::TcpSocketFactory"));
Ptr<Socket> srcSocket3 =
Socket::CreateSocket(nSrc, TypeId::LookupByName("ns3::TcpSocketFactory"));
Ptr<Socket> srcSocket4 =
Socket::CreateSocket(nSrc, TypeId::LookupByName("ns3::TcpSocketFactory"));
uint16_t dstport = 12345;
Ipv4Address dstaddr("10.20.1.2");
PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dstport));
PacketSinkHelper sink("ns3::TcpSocketFactory",
InetSocketAddress(Ipv4Address::GetAny(), dstport));
ApplicationContainer apps = sink.Install(nDst);
apps.Start(Seconds(0.0));
apps.Stop(Seconds(10.0));
@@ -182,7 +181,7 @@ main (int argc, char *argv[])
Simulator::Schedule(Seconds(2.0), &BindSock, srcSocket3, SrcToRtr2);
Simulator::Schedule(Seconds(2.1), &StartFlow, srcSocket3, dstaddr, dstport);
// Fourth again as normal (goes via Rtr1)
Simulator::Schedule (Seconds (3.0),&BindSock, srcSocket4, Ptr<NetDevice>(0));
Simulator::Schedule(Seconds(3.0), &BindSock, srcSocket4, Ptr<NetDevice>(nullptr));
Simulator::Schedule(Seconds(3.1), &StartFlow, srcSocket4, dstaddr, dstport);
// If you uncomment what's below, it results in ASSERT failing since you can't
// bind to a socket not existing on a node
@@ -193,15 +192,14 @@ main (int argc, char *argv[])
return 0;
}
void BindSock (Ptr<Socket> sock, Ptr<NetDevice> netdev)
void
BindSock(Ptr<Socket> sock, Ptr<NetDevice> netdev)
{
sock->BindToNetDevice(netdev);
return;
}
void StartFlow (Ptr<Socket> localSocket,
Ipv4Address servAddress,
uint16_t servPort)
void
StartFlow(Ptr<Socket> localSocket, Ipv4Address servAddress, uint16_t servPort)
{
NS_LOG_INFO("Starting flow at time " << Simulator::Now().GetSeconds());
currentTxBytes = 0;
@@ -214,7 +212,8 @@ void StartFlow (Ptr<Socket> localSocket,
WriteUntilBufferFull(localSocket, localSocket->GetTxAvailable());
}
void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace)
void
WriteUntilBufferFull(Ptr<Socket> localSocket, uint32_t txSpace)
{
while (currentTxBytes < totalTxBytes && localSocket->GetTxAvailable() > 0)
{

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2018-20 NITK Surathkal
*
@@ -53,14 +52,14 @@
// The congestion window and queue occupancy traces output by this program show
// periodic drops every 10 seconds when BBR algorithm is in PROBE_RTT phase.
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/traffic-control-module.h"
#include "ns3/core-module.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/internet-module.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/traffic-control-module.h"
using namespace ns3;
@@ -76,14 +75,18 @@ TraceThroughput (Ptr<FlowMonitor> monitor)
auto itr = stats.begin();
Time curTime = Now();
std::ofstream thr(dir + "/throughput.dat", std::ios::out | std::ios::app);
thr << curTime << " " << 8 * (itr->second.txBytes - prev) / (1000 * 1000 * (curTime.GetSeconds () - prevTime.GetSeconds ())) << std::endl;
thr << curTime << " "
<< 8 * (itr->second.txBytes - prev) /
(1000 * 1000 * (curTime.GetSeconds() - prevTime.GetSeconds()))
<< std::endl;
prevTime = curTime;
prev = itr->second.txBytes;
Simulator::Schedule(Seconds(0.2), &TraceThroughput, monitor);
}
// Check the queue size
void CheckQueueSize (Ptr<QueueDisc> qd)
void
CheckQueueSize(Ptr<QueueDisc> qd)
{
uint32_t qsize = qd->GetCurrentSize().GetValue();
Simulator::Schedule(Seconds(0.2), &CheckQueueSize, qd);
@@ -93,24 +96,27 @@ void CheckQueueSize (Ptr<QueueDisc> qd)
}
// Trace congestion window
static void CwndTracer (Ptr<OutputStreamWrapper> stream, uint32_t oldval, uint32_t newval)
static void
CwndTracer(Ptr<OutputStreamWrapper> stream, uint32_t oldval, uint32_t newval)
{
*stream->GetStream() << Simulator::Now().GetSeconds() << " " << newval / 1448.0 << std::endl;
}
void TraceCwnd (uint32_t nodeId, uint32_t socketId)
void
TraceCwnd(uint32_t nodeId, uint32_t socketId)
{
AsciiTraceHelper ascii;
Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(dir + "/cwnd.dat");
Config::ConnectWithoutContext ("/NodeList/" + std::to_string (nodeId) + "/$ns3::TcpL4Protocol/SocketList/" + std::to_string (socketId) + "/CongestionWindow", MakeBoundCallback (&CwndTracer, stream));
Config::ConnectWithoutContext("/NodeList/" + std::to_string(nodeId) +
"/$ns3::TcpL4Protocol/SocketList/" +
std::to_string(socketId) + "/CongestionWindow",
MakeBoundCallback(&CwndTracer, stream));
}
int main (int argc, char *argv [])
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
// Naming the output directory using local system time
time_t rawtime;
struct tm* timeinfo;
@@ -131,7 +137,9 @@ int main (int argc, char *argv [])
cmd.AddValue("tcpTypeId", "Transport protocol to use: TcpNewReno, TcpBbr", tcpTypeId);
cmd.AddValue("delAckCount", "Delayed ACK count", delAckCount);
cmd.AddValue("enablePcap", "Enable/Disable pcap file generation", enablePcap);
cmd.AddValue ("stopTime", "Stop time for applications / simulation time will be stopTime + 1", stopTime);
cmd.AddValue("stopTime",
"Stop time for applications / simulation time will be stopTime + 1",
stopTime);
cmd.Parse(argc, argv);
queueDisc = std::string("ns3::") + queueDisc;
@@ -145,7 +153,8 @@ int main (int argc, char *argv [])
Config::SetDefault("ns3::DropTailQueue<Packet>::MaxSize", QueueSizeValue(QueueSize("1p")));
Config::SetDefault(queueDisc + "::MaxSize", QueueSizeValue(QueueSize("100p")));
NodeContainer sender, receiver;
NodeContainer sender;
NodeContainer receiver;
NodeContainer routers;
sender.Create(1);
receiver.Create(1);

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2020 NITK Surathkal
*
@@ -79,20 +78,21 @@
// TCP Prague and ACK-filtering, which may show a stronger performance
// impact for TCP pacing.
#include "ns3/applications-module.h"
#include "ns3/core-module.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/internet-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/packet-sink.h"
#include "ns3/point-to-point-module.h"
#include "ns3/traffic-control-module.h"
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/internet-module.h"
#include "ns3/applications-module.h"
#include "ns3/network-module.h"
#include "ns3/packet-sink.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/traffic-control-module.h"
#include "ns3/mtp-module.h"
using namespace ns3;
@@ -106,39 +106,47 @@ std::ofstream packetTraceStream;
static void
CwndTracer(uint32_t oldval, uint32_t newval)
{
cwndStream << std::fixed << std::setprecision (6) << Simulator::Now ().GetSeconds () << std::setw (12) << newval << std::endl;
cwndStream << std::fixed << std::setprecision(6) << Simulator::Now().GetSeconds()
<< std::setw(12) << newval << std::endl;
}
static void
PacingRateTracer(DataRate oldval, DataRate newval)
{
pacingRateStream << std::fixed << std::setprecision (6) << Simulator::Now ().GetSeconds () << std::setw (12) << newval.GetBitRate () / 1e6 << std::endl;
pacingRateStream << std::fixed << std::setprecision(6) << Simulator::Now().GetSeconds()
<< std::setw(12) << newval.GetBitRate() / 1e6 << std::endl;
}
static void
SsThreshTracer(uint32_t oldval, uint32_t newval)
{
ssThreshStream << std::fixed << std::setprecision (6) << Simulator::Now ().GetSeconds () << std::setw (12) << newval << std::endl;
ssThreshStream << std::fixed << std::setprecision(6) << Simulator::Now().GetSeconds()
<< std::setw(12) << newval << std::endl;
}
static void
TxTracer(Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint32_t interface)
{
packetTraceStream << std::fixed << std::setprecision (6) << Simulator::Now ().GetSeconds () << " tx " << p->GetSize () << std::endl;
packetTraceStream << std::fixed << std::setprecision(6) << Simulator::Now().GetSeconds()
<< " tx " << p->GetSize() << std::endl;
}
static void
RxTracer(Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint32_t interface)
{
packetTraceStream << std::fixed << std::setprecision (6) << Simulator::Now ().GetSeconds () << " rx " << p->GetSize () << std::endl;
packetTraceStream << std::fixed << std::setprecision(6) << Simulator::Now().GetSeconds()
<< " rx " << p->GetSize() << std::endl;
}
void
ConnectSocketTraces (void)
ConnectSocketTraces()
{
Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeCallback (&CwndTracer));
Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/PacingRate", MakeCallback (&PacingRateTracer));
Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/SlowStartThreshold", MakeCallback (&SsThreshTracer));
Config::ConnectWithoutContext("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
MakeCallback(&CwndTracer));
Config::ConnectWithoutContext("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/PacingRate",
MakeCallback(&PacingRateTracer));
Config::ConnectWithoutContext("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/SlowStartThreshold",
MakeCallback(&SsThreshTracer));
Config::ConnectWithoutContext("/NodeList/0/$ns3::Ipv4L3Protocol/Tx", MakeCallback(&TxTracer));
Config::ConnectWithoutContext("/NodeList/0/$ns3::Ipv4L3Protocol/Rx", MakeCallback(&RxTracer));
}
@@ -146,10 +154,7 @@ ConnectSocketTraces (void)
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
bool tracing = false;
uint32_t maxBytes = 0; // value of zero corresponds to unlimited send
@@ -169,7 +174,8 @@ main (int argc, char *argv[])
// Configure defaults that are not based on explicit command-line arguments
// They may be overridden by general attribute configuration of command line
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TypeId::LookupByName (transportProtocol)));
Config::SetDefault("ns3::TcpL4Protocol::SocketType",
TypeIdValue(TypeId::LookupByName(transportProtocol)));
Config::SetDefault("ns3::TcpSocket::InitialCwnd", UintegerValue(10));
CommandLine cmd(__FILE__);
@@ -179,14 +185,18 @@ main (int argc, char *argv[])
cmd.AddValue("maxPacingRate", "Max Pacing Rate", maxPacingRate);
cmd.AddValue("useEcn", "Flag to enable/disable ECN", useEcn);
cmd.AddValue("useQueueDisc", "Flag to enable/disable queue disc on bottleneck", useQueueDisc);
cmd.AddValue ("shouldPaceInitialWindow", "Flag to enable/disable pacing of TCP initial window", shouldPaceInitialWindow);
cmd.AddValue("shouldPaceInitialWindow",
"Flag to enable/disable pacing of TCP initial window",
shouldPaceInitialWindow);
cmd.AddValue("simulationEndTime", "Simulation end time", simulationEndTime);
cmd.Parse(argc, argv);
// Configure defaults based on command-line arguments
Config::SetDefault("ns3::TcpSocketState::EnablePacing", BooleanValue(isPacingEnabled));
Config::SetDefault ("ns3::TcpSocketState::PaceInitialWindow", BooleanValue (shouldPaceInitialWindow));
Config::SetDefault ("ns3::TcpSocketBase::UseEcn", (useEcn ? EnumValue (TcpSocketState::On) : EnumValue (TcpSocketState::Off)));
Config::SetDefault("ns3::TcpSocketState::PaceInitialWindow",
BooleanValue(shouldPaceInitialWindow));
Config::SetDefault("ns3::TcpSocketBase::UseEcn",
(useEcn ? EnumValue(TcpSocketState::On) : EnumValue(TcpSocketState::Off)));
Config::SetDefault("ns3::TcpSocketState::MaxPacingRate", DataRateValue(maxPacingRate));
NS_LOG_INFO("Create nodes.");
@@ -253,9 +263,12 @@ main (int argc, char *argv[])
// Two Sink Applications at n4 and n5
uint16_t sinkPort = 8080;
Address sinkAddress4 (InetSocketAddress (regLinkInterface4.GetAddress (1), sinkPort)); // interface of n4
Address sinkAddress5 (InetSocketAddress (regLinkInterface5.GetAddress (1), sinkPort)); // interface of n5
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
Address sinkAddress4(
InetSocketAddress(regLinkInterface4.GetAddress(1), sinkPort)); // interface of n4
Address sinkAddress5(
InetSocketAddress(regLinkInterface5.GetAddress(1), sinkPort)); // interface of n5
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory",
InetSocketAddress(Ipv4Address::GetAny(), sinkPort));
ApplicationContainer sinkApps4 = packetSinkHelper.Install(c.Get(4)); // n4 as sink
ApplicationContainer sinkApps5 = packetSinkHelper.Install(c.Get(5)); // n5 as sink
@@ -313,22 +326,30 @@ main (int argc, char *argv[])
monitor->CheckForLostPackets();
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon.GetClassifier());
FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin();
i != stats.end();
++i)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
std::cout << "Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
std::cout << "Flow " << i->first << " (" << t.sourceAddress << " -> "
<< t.destinationAddress << ")\n";
std::cout << " Tx Packets: " << i->second.txPackets << "\n";
std::cout << " Tx Bytes: " << i->second.txBytes << "\n";
std::cout << " TxOffered: " << i->second.txBytes * 8.0 / simulationEndTime.GetSeconds () / 1000 / 1000 << " Mbps\n";
std::cout << " TxOffered: "
<< i->second.txBytes * 8.0 / simulationEndTime.GetSeconds() / 1000 / 1000
<< " Mbps\n";
std::cout << " Rx Packets: " << i->second.rxPackets << "\n";
std::cout << " Rx Bytes: " << i->second.rxBytes << "\n";
std::cout << " Throughput: " << i->second.rxBytes * 8.0 / simulationEndTime.GetSeconds () / 1000 / 1000 << " Mbps\n";
std::cout << " Throughput: "
<< i->second.rxBytes * 8.0 / simulationEndTime.GetSeconds() / 1000 / 1000
<< " Mbps\n";
}
cwndStream.close();
pacingRateStream.close();
ssThreshStream.close();
Simulator::Destroy();
return 0;
}

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -15,7 +14,6 @@
*
*/
// Default Network topology, 9 nodes in a star
/*
n2 n3 n4
@@ -33,28 +31,25 @@
// "tcp-star-server-$n-$i.pcap" where n and i represent node and interface
// numbers respectively
// Usage examples for things you might want to tweak:
// ./ns3 run="tcp-star-server"
// ./ns3 run="tcp-star-server --nNodes=25"
// ./ns3 run="tcp-star-server --ns3::OnOffApplication::DataRate=10000"
// ./ns3 run="tcp-star-server --ns3::OnOffApplication::PacketSize=500"
// ./ns3 run "tcp-star-server"
// ./ns3 run "tcp-star-server --nNodes=25"
// ./ns3 run "tcp-star-server --ns3::OnOffApplication::DataRate=10000"
// ./ns3 run "tcp-star-server --ns3::OnOffApplication::PacketSize=500"
// See the ns-3 tutorial for more info on the command line:
// http://www.nsnam.org/tutorials.html
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <string>
using namespace ns3;
@@ -63,10 +58,7 @@ NS_LOG_COMPONENT_DEFINE ("TcpServer");
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
// Users may find it convenient to turn on explicit debugging
// for selected modules; the below lines suggest how to do this
@@ -149,15 +141,14 @@ main (int argc, char *argv[])
ApplicationContainer clientApps;
for (uint32_t i = 0; i < clientNodes.GetN(); ++i)
{
AddressValue remoteAddress
(InetSocketAddress (interfaceAdjacencyList[i].GetAddress (0), port));
AddressValue remoteAddress(
InetSocketAddress(interfaceAdjacencyList[i].GetAddress(0), port));
clientHelper.SetAttribute("Remote", remoteAddress);
clientApps.Add(clientHelper.Install(clientNodes.Get(i)));
}
clientApps.Start(Seconds(1.0));
clientApps.Stop(Seconds(10.0));
// configure tracing
AsciiTraceHelper ascii;
p2p.EnableAsciiAll(ascii.CreateFileStream("tcp-star-server.tr"));

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2019 Cable Television Laboratories, Inc.
* Copyright (c) 2020 Tom Henderson (adapted for DCTCP testing)
@@ -113,13 +112,15 @@
// validation cases (and syntax of how to run):
// ------------
// Case 'dctcp-10ms': DCTCP single flow, 10ms base RTT, 50 Mbps link, ECN enabled, CoDel:
// ./ns3 run 'tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=10ms --queueUseEcn=1 --stopTime=15s --validate=1 --validation=dctcp-10ms'
// ./ns3 run 'tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=10ms
// --queueUseEcn=1 --stopTime=15s --validate=1 --validation=dctcp-10ms'
// - Throughput between 48 Mbps and 49 Mbps for time greater than 5.6s
// - DCTCP alpha below 0.1 for time greater than 5.4s
// - DCTCP alpha between 0.06 and 0.085 for time greater than 7s
//
// Case 'dctcp-80ms': DCTCP single flow, 80ms base RTT, 50 Mbps link, ECN enabled, CoDel:
// ./ns3 run 'tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=80ms --queueUseEcn=1 --stopTime=40s --validate=1 --validation=dctcp-80ms'
// ./ns3 run 'tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=80ms
// --queueUseEcn=1 --stopTime=40s --validate=1 --validation=dctcp-80ms'
// - Throughput less than 20 Mbps for time less than 14s
// - Throughput less than 48 Mbps for time less than 30s
// - Throughput between 47.5 Mbps and 48.5 for time greater than 32s
@@ -128,30 +129,33 @@
// - DCTCP alpha between 0.015 and 0.025 for time greater than 34
//
// Case 'cubic-50ms-no-ecn': CUBIC single flow, 50ms base RTT, 50 Mbps link, ECN disabled, CoDel:
// ./ns3 run 'tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=1 --validation=cubic-50ms-no-ecn'
// ./ns3 run 'tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms
// --queueUseEcn=0 --stopTime=20s --validate=1 --validation=cubic-50ms-no-ecn'
// - Maximum value of cwnd is 511 segments at 5.4593 seconds
// - cwnd decreases to 173 segments at 5.80304 seconds
// - cwnd reaches another local maxima around 14.2815 seconds of 236 segments
// - cwnd reaches a second maximum around 18.048 seconds of 234 segments
//
// Case 'cubic-50ms-ecn': CUBIC single flow, 50ms base RTT, 50 Mbps link, ECN enabled, CoDel:
// ./ns3 run 'tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=1 --validation=cubic-50ms-no-ecn'
// ./ns3 run 'tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms
// --queueUseEcn=0 --stopTime=20s --validate=1 --validation=cubic-50ms-no-ecn'
// - Maximum value of cwnd is 511 segments at 5.4593 seconds
// - cwnd decreases to 173 segments at 5.7939 seconds
// - cwnd reaches another local maxima around 14.3477 seconds of 236 segments
// - cwnd reaches a second maximum around 18.064 seconds of 234 segments
#include <iostream>
#include <fstream>
#include <string>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/traffic-control-module.h"
#include "ns3/internet-module.h"
#include "ns3/core-module.h"
#include "ns3/internet-apps-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/internet-module.h"
#include "ns3/mtp-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/traffic-control-module.h"
#include <fstream>
#include <iostream>
#include <string>
using namespace ns3;
@@ -159,13 +163,20 @@ NS_LOG_COMPONENT_DEFINE ("TcpValidation");
// These variables are declared outside of main() so that they can
// be used in trace sinks.
std::atomic<uint32_t> g_firstBytesReceived = 0;
std::atomic<uint32_t> g_secondBytesReceived = 0;
std::atomic<uint32_t> g_marksObserved = 0;
std::atomic<uint32_t> g_dropsObserved = 0;
std::string g_validate = ""; // Empty string disables this mode
bool g_validationFailed = false;
std::atomic<uint32_t> g_firstBytesReceived (0); //!< First received packet size.
std::atomic<uint32_t> g_secondBytesReceived (0); //!< Second received packet size.
std::atomic<uint32_t> g_marksObserved (0); //!< Number of marked packets observed.
std::atomic<uint32_t> g_dropsObserved (0); //!< Number of dropped packets observed.
std::string g_validate = ""; //!< Empty string disables validation.
bool g_validationFailed = false; //!< True if validation failed.
/**
* Trace first congestion window.
*
* \param ofStream Output filestream.
* \param oldCwnd Old value.
* \param newCwnd new value.
*/
void
TraceFirstCwnd(std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
{
@@ -173,7 +184,8 @@ TraceFirstCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
// so that we can report cwnd in units of segments
if (g_validate == "")
{
*ofStream << Simulator::Now ().GetSeconds () << " " << static_cast<double> (newCwnd) / 1448 << std::endl;
*ofStream << Simulator::Now().GetSeconds() << " " << static_cast<double>(newCwnd) / 1448
<< std::endl;
}
// Validation checks; both the ECN enabled and disabled cases are similar
if (g_validate == "cubic-50ms-no-ecn" || g_validate == "cubic-50ms-ecn")
@@ -203,6 +215,14 @@ TraceFirstCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
}
}
/**
* Trace first TcpDctcp.
*
* \param ofStream Output filestream.
* \param bytesMarked Bytes marked.
* \param bytesAcked Bytes ACKed.
* \param alpha Alpha.
*/
void
TraceFirstDctcp(std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
{
@@ -226,7 +246,8 @@ TraceFirstDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAc
}
else if ((now > 34) && (alpha < 0.015) && (alpha > 0.025))
{
NS_LOG_WARN ("now " << Now ().As (Time::S) << " alpha " << alpha << " (expected 0.015 <= alpha <= 0.025)");
NS_LOG_WARN("now " << Now().As(Time::S) << " alpha " << alpha
<< " (expected 0.015 <= alpha <= 0.025)");
g_validationFailed = true;
}
}
@@ -240,21 +261,37 @@ TraceFirstDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAc
}
if ((now > 7) && ((alpha > 0.09) || (alpha < 0.055)))
{
NS_LOG_WARN ("now " << Now ().As (Time::S) << " alpha " << alpha << " (expected 0.09 <= alpha <= 0.055)");
NS_LOG_WARN("now " << Now().As(Time::S) << " alpha " << alpha
<< " (expected 0.09 <= alpha <= 0.055)");
g_validationFailed = true;
}
}
}
/**
* Trace first RTT.
*
* \param ofStream Output filestream.
* \param oldRtt Old value.
* \param newRtt New value.
*/
void
TraceFirstRtt(std::ofstream* ofStream, Time oldRtt, Time newRtt)
{
if (g_validate == "")
{
*ofStream << Simulator::Now ().GetSeconds () << " " << newRtt.GetSeconds () * 1000 << std::endl;
*ofStream << Simulator::Now().GetSeconds() << " " << newRtt.GetSeconds() * 1000
<< std::endl;
}
}
/**
* Trace second congestion window.
*
* \param ofStream Output filestream.
* \param oldCwnd Old value.
* \param newCwnd new value.
*/
void
TraceSecondCwnd(std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
{
@@ -262,19 +299,36 @@ TraceSecondCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
// so that we can report cwnd in units of segments
if (g_validate == "")
{
*ofStream << Simulator::Now ().GetSeconds () << " " << static_cast<double> (newCwnd) / 1448 << std::endl;
*ofStream << Simulator::Now().GetSeconds() << " " << static_cast<double>(newCwnd) / 1448
<< std::endl;
}
}
/**
* Trace second RTT.
*
* \param ofStream Output filestream.
* \param oldRtt Old value.
* \param newRtt New value.
*/
void
TraceSecondRtt(std::ofstream* ofStream, Time oldRtt, Time newRtt)
{
if (g_validate == "")
{
*ofStream << Simulator::Now ().GetSeconds () << " " << newRtt.GetSeconds () * 1000 << std::endl;
*ofStream << Simulator::Now().GetSeconds() << " " << newRtt.GetSeconds() * 1000
<< std::endl;
}
}
/**
* Trace second TcpDctcp.
*
* \param ofStream Output filestream.
* \param bytesMarked Bytes marked.
* \param bytesAcked Bytes ACKed.
* \param alpha Alpha.
*/
void
TraceSecondDctcp(std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
{
@@ -284,6 +338,12 @@ TraceSecondDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesA
}
}
/**
* Trace ping RTT.
*
* \param ofStream Output filestream.
* \param rtt RTT value.
*/
void
TracePingRtt(std::ofstream* ofStream, Time rtt)
{
@@ -293,18 +353,36 @@ TracePingRtt (std::ofstream* ofStream, Time rtt)
}
}
/**
* Trace first Rx.
*
* \param packet The packet.
* \param address The sender address.
*/
void
TraceFirstRx(Ptr<const Packet> packet, const Address& address)
{
g_firstBytesReceived += packet->GetSize();
}
/**
* Trace second Rx.
*
* \param packet The packet.
* \param address The sender address.
*/
void
TraceSecondRx(Ptr<const Packet> packet, const Address& address)
{
g_secondBytesReceived += packet->GetSize();
}
/**
* Trace queue drop.
*
* \param ofStream Output filestream.
* \param item The dropped QueueDiscItem.
*/
void
TraceQueueDrop(std::ofstream* ofStream, Ptr<const QueueDiscItem> item)
{
@@ -315,6 +393,13 @@ TraceQueueDrop (std::ofstream* ofStream, Ptr<const QueueDiscItem> item)
g_dropsObserved++;
}
/**
* Trace queue marks.
*
* \param ofStream Output filestream.
* \param item The marked QueueDiscItem.
* \param reason The reason.
*/
void
TraceQueueMark(std::ofstream* ofStream, Ptr<const QueueDiscItem> item, const char* reason)
{
@@ -325,16 +410,32 @@ TraceQueueMark (std::ofstream* ofStream, Ptr<const QueueDiscItem> item, const ch
g_marksObserved++;
}
/**
* Trace queue length.
*
* \param ofStream Output filestream.
* \param queueLinkRate Queue link rate.
* \param oldVal Old value.
* \param newVal New value.
*/
void
TraceQueueLength(std::ofstream* ofStream, DataRate queueLinkRate, uint32_t oldVal, uint32_t newVal)
{
// output in units of ms
if (g_validate == "")
{
*ofStream << Simulator::Now ().GetSeconds () << " " << std::fixed << static_cast<double> (newVal * 8) / (queueLinkRate.GetBitRate () / 1000) << std::endl;
*ofStream << Simulator::Now().GetSeconds() << " " << std::fixed
<< static_cast<double>(newVal * 8) / (queueLinkRate.GetBitRate() / 1000)
<< std::endl;
}
}
/**
* Trace marks frequency.
*
* \param ofStream Output filestream.
* \param marksSamplingInterval The mark sampling interval.
*/
void
TraceMarksFrequency(std::ofstream* ofStream, Time marksSamplingInterval)
{
@@ -343,9 +444,18 @@ TraceMarksFrequency (std::ofstream* ofStream, Time marksSamplingInterval)
*ofStream << Simulator::Now().GetSeconds() << " " << g_marksObserved << std::endl;
}
g_marksObserved = 0;
Simulator::Schedule (marksSamplingInterval, &TraceMarksFrequency, ofStream, marksSamplingInterval);
Simulator::Schedule(marksSamplingInterval,
&TraceMarksFrequency,
ofStream,
marksSamplingInterval);
}
/**
* Trace the first throughput.
*
* \param ofStream Output filestream.
* \param throughputInterval The throughput interval.
*/
void
TraceFirstThroughput(std::ofstream* ofStream, Time throughputInterval)
{
@@ -361,17 +471,20 @@ TraceFirstThroughput (std::ofstream* ofStream, Time throughputInterval)
double now = Simulator::Now().GetSeconds();
if ((now < 14) && (throughput > 20))
{
NS_LOG_WARN ("now " << Now ().As (Time::S) << " throughput " << throughput << " (expected <= 20)");
NS_LOG_WARN("now " << Now().As(Time::S) << " throughput " << throughput
<< " (expected <= 20)");
g_validationFailed = true;
}
if ((now < 30) && (throughput > 48))
{
NS_LOG_WARN ("now " << Now ().As (Time::S) << " throughput " << throughput << " (expected <= 48)");
NS_LOG_WARN("now " << Now().As(Time::S) << " throughput " << throughput
<< " (expected <= 48)");
g_validationFailed = true;
}
if ((now > 32) && ((throughput < 47.5) || (throughput > 48.5)))
{
NS_LOG_WARN ("now " << Now ().As (Time::S) << " throughput " << throughput << " (expected 47.5 <= throughput <= 48.5)");
NS_LOG_WARN("now " << Now().As(Time::S) << " throughput " << throughput
<< " (expected 47.5 <= throughput <= 48.5)");
g_validationFailed = true;
}
}
@@ -380,78 +493,130 @@ TraceFirstThroughput (std::ofstream* ofStream, Time throughputInterval)
double now = Simulator::Now().GetSeconds();
if ((now > 5.6) && ((throughput < 48) || (throughput > 49)))
{
NS_LOG_WARN ("now " << Now ().As (Time::S) << " throughput " << throughput << " (expected 48 <= throughput <= 49)");
NS_LOG_WARN("now " << Now().As(Time::S) << " throughput " << throughput
<< " (expected 48 <= throughput <= 49)");
g_validationFailed = true;
}
}
}
/**
* Trace the second throughput.
*
* \param ofStream Output filestream.
* \param throughputInterval The throughput interval.
*/
void
TraceSecondThroughput(std::ofstream* ofStream, Time throughputInterval)
{
if (g_validate == "")
{
*ofStream << Simulator::Now ().GetSeconds () << " " << g_secondBytesReceived * 8 / throughputInterval.GetSeconds () / 1e6 << std::endl;
*ofStream << Simulator::Now().GetSeconds() << " "
<< g_secondBytesReceived * 8 / throughputInterval.GetSeconds() / 1e6 << std::endl;
}
g_secondBytesReceived = 0;
Simulator::Schedule(throughputInterval, &TraceSecondThroughput, ofStream, throughputInterval);
}
/**
* Schedule trace connection.
*
* \param ofStream Output filestream.
*/
void
ScheduleFirstTcpCwndTraceConnection(std::ofstream* ofStream)
{
Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeBoundCallback (&TraceFirstCwnd, ofStream));
Config::ConnectWithoutContextFailSafe(
"/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
MakeBoundCallback(&TraceFirstCwnd, ofStream));
}
/**
* Schedule trace connection.
*
* \param ofStream Output filestream.
*/
void
ScheduleFirstTcpRttTraceConnection(std::ofstream* ofStream)
{
Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/RTT", MakeBoundCallback (&TraceFirstRtt, ofStream));
Config::ConnectWithoutContextFailSafe("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/RTT",
MakeBoundCallback(&TraceFirstRtt, ofStream));
}
/**
* Schedule trace connection.
*
* \param ofStream Output filestream.
*/
void
ScheduleFirstDctcpTraceConnection(std::ofstream* ofStream)
{
Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionOps/$ns3::TcpDctcp/CongestionEstimate", MakeBoundCallback (&TraceFirstDctcp, ofStream));
Config::ConnectWithoutContextFailSafe("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/"
"CongestionOps/$ns3::TcpDctcp/CongestionEstimate",
MakeBoundCallback(&TraceFirstDctcp, ofStream));
}
/**
* Schedule trace connection.
*
* \param ofStream Output filestream.
*/
void
ScheduleSecondDctcpTraceConnection(std::ofstream* ofStream)
{
Config::ConnectWithoutContextFailSafe ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/CongestionOps/$ns3::TcpDctcp/CongestionEstimate", MakeBoundCallback (&TraceSecondDctcp, ofStream));
Config::ConnectWithoutContextFailSafe("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/"
"CongestionOps/$ns3::TcpDctcp/CongestionEstimate",
MakeBoundCallback(&TraceSecondDctcp, ofStream));
}
/**
* Schedule trace connection.
*/
void
ScheduleFirstPacketSinkConnection (void)
ScheduleFirstPacketSinkConnection()
{
Config::ConnectWithoutContextFailSafe ("/NodeList/6/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&TraceFirstRx));
Config::ConnectWithoutContextFailSafe("/NodeList/6/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback(&TraceFirstRx));
}
/**
* Schedule trace connection.
*
* \param ofStream Output filestream.
*/
void
ScheduleSecondTcpCwndTraceConnection(std::ofstream* ofStream)
{
Config::ConnectWithoutContext ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeBoundCallback (&TraceSecondCwnd, ofStream));
Config::ConnectWithoutContext("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
MakeBoundCallback(&TraceSecondCwnd, ofStream));
}
/**
* Schedule trace connection.
*
* \param ofStream Output filestream.
*/
void
ScheduleSecondTcpRttTraceConnection(std::ofstream* ofStream)
{
Config::ConnectWithoutContext ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/RTT", MakeBoundCallback (&TraceSecondRtt, ofStream));
Config::ConnectWithoutContext("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/RTT",
MakeBoundCallback(&TraceSecondRtt, ofStream));
}
/**
* Schedule trace connection.
*/
void
ScheduleSecondPacketSinkConnection (void)
ScheduleSecondPacketSinkConnection()
{
Config::ConnectWithoutContext ("/NodeList/7/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&TraceSecondRx));
Config::ConnectWithoutContext("/NodeList/7/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback(&TraceSecondRx));
}
int
main(int argc, char* argv[])
{
LogComponentEnable ("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable ("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);
MtpInterface::Enable();
////////////////////////////////////////////////////////////
// variables not configured at command line //
////////////////////////////////////////////////////////////
@@ -498,7 +663,8 @@ main (int argc, char *argv[])
Config::SetDefault("ns3::TcpSocket::SndBufSize", UintegerValue(32768000));
Config::SetDefault("ns3::TcpSocket::RcvBufSize", UintegerValue(32768000));
Config::SetDefault("ns3::TcpSocket::InitialCwnd", UintegerValue(10));
Config::SetDefault ("ns3::TcpL4Protocol::RecoveryType", TypeIdValue (TcpPrrRecovery::GetTypeId ()));
Config::SetDefault("ns3::TcpL4Protocol::RecoveryType",
TypeIdValue(TcpPrrRecovery::GetTypeId()));
////////////////////////////////////////////////////////////
// command-line argument parsing //
@@ -519,10 +685,9 @@ main (int argc, char *argv[])
// If validation is selected, perform some configuration checks
if (g_validate != "")
{
NS_ABORT_MSG_UNLESS (g_validate == "dctcp-10ms"
|| g_validate == "dctcp-80ms"
|| g_validate == "cubic-50ms-no-ecn"
|| g_validate == "cubic-50ms-ecn", "Unknown test");
NS_ABORT_MSG_UNLESS(g_validate == "dctcp-10ms" || g_validate == "dctcp-80ms" ||
g_validate == "cubic-50ms-no-ecn" || g_validate == "cubic-50ms-ecn",
"Unknown test");
if (g_validate == "dctcp-10ms" || g_validate == "dctcp-80ms")
{
NS_ABORT_MSG_UNLESS(firstTcpType == "dctcp", "Incorrect TCP");
@@ -559,8 +724,12 @@ main (int argc, char *argv[])
if (enableLogging)
{
LogComponentEnable ("TcpSocketBase", (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_NODE | LOG_PREFIX_TIME | LOG_LEVEL_ALL));
LogComponentEnable ("TcpDctcp", (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_NODE | LOG_PREFIX_TIME | LOG_LEVEL_ALL));
LogComponentEnable(
"TcpSocketBase",
(LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_NODE | LOG_PREFIX_TIME | LOG_LEVEL_ALL));
LogComponentEnable(
"TcpDctcp",
(LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_NODE | LOG_PREFIX_TIME | LOG_LEVEL_ALL));
}
Time oneWayDelay = baseRtt / 2;
@@ -648,11 +817,16 @@ main (int argc, char *argv[])
// Report on configuration
if (enableSecondTcp)
{
NS_LOG_DEBUG ("first TCP: " << firstTcpTypeId.GetName () << "; second TCP: " << secondTcpTypeId.GetName () << "; queue: " << queueTypeId.GetName () << "; ceThreshold: " << ceThreshold.GetSeconds () * 1000 << "ms");
NS_LOG_DEBUG("first TCP: " << firstTcpTypeId.GetName()
<< "; second TCP: " << secondTcpTypeId.GetName()
<< "; queue: " << queueTypeId.GetName()
<< "; ceThreshold: " << ceThreshold.GetSeconds() * 1000 << "ms");
}
else
{
NS_LOG_DEBUG ("first TCP: " << firstTcpTypeId.GetName () << "; queue: " << queueTypeId.GetName () << "; ceThreshold: " << ceThreshold.GetSeconds () * 1000 << "ms");
NS_LOG_DEBUG("first TCP: " << firstTcpTypeId.GetName()
<< "; queue: " << queueTypeId.GetName()
<< "; ceThreshold: " << ceThreshold.GetSeconds() * 1000 << "ms");
}
// Write traces only if we are not in validation mode (g_validate == "")
@@ -671,28 +845,28 @@ main (int argc, char *argv[])
std::ofstream queueLengthOfStream;
if (g_validate == "")
{
pingOfStream.open (pingTraceFile.c_str (), std::ofstream::out);
firstTcpRttOfStream.open (firstTcpRttTraceFile.c_str (), std::ofstream::out);
firstTcpCwndOfStream.open (firstTcpCwndTraceFile.c_str (), std::ofstream::out);
firstTcpThroughputOfStream.open (firstTcpThroughputTraceFile.c_str (), std::ofstream::out);
pingOfStream.open(pingTraceFile, std::ofstream::out);
firstTcpRttOfStream.open(firstTcpRttTraceFile, std::ofstream::out);
firstTcpCwndOfStream.open(firstTcpCwndTraceFile, std::ofstream::out);
firstTcpThroughputOfStream.open(firstTcpThroughputTraceFile, std::ofstream::out);
if (firstTcpType == "dctcp")
{
firstTcpDctcpOfStream.open (firstDctcpTraceFile.c_str (), std::ofstream::out);
firstTcpDctcpOfStream.open(firstDctcpTraceFile, std::ofstream::out);
}
if (enableSecondTcp)
{
secondTcpRttOfStream.open (secondTcpRttTraceFile.c_str (), std::ofstream::out);
secondTcpCwndOfStream.open (secondTcpCwndTraceFile.c_str (), std::ofstream::out);
secondTcpThroughputOfStream.open (secondTcpThroughputTraceFile.c_str (), std::ofstream::out);
secondTcpRttOfStream.open(secondTcpRttTraceFile, std::ofstream::out);
secondTcpCwndOfStream.open(secondTcpCwndTraceFile, std::ofstream::out);
secondTcpThroughputOfStream.open(secondTcpThroughputTraceFile, std::ofstream::out);
if (secondTcpType == "dctcp")
{
secondTcpDctcpOfStream.open (secondDctcpTraceFile.c_str (), std::ofstream::out);
secondTcpDctcpOfStream.open(secondDctcpTraceFile, std::ofstream::out);
}
}
queueDropOfStream.open (queueDropTraceFile.c_str (), std::ofstream::out);
queueMarkOfStream.open (queueMarkTraceFile.c_str (), std::ofstream::out);
queueMarksFrequencyOfStream.open (queueMarksFrequencyTraceFile.c_str (), std::ofstream::out);
queueLengthOfStream.open (queueLengthTraceFile.c_str (), std::ofstream::out);
queueDropOfStream.open(queueDropTraceFile, std::ofstream::out);
queueMarkOfStream.open(queueMarkTraceFile, std::ofstream::out);
queueMarksFrequencyOfStream.open(queueMarksFrequencyTraceFile, std::ofstream::out);
queueLengthOfStream.open(queueLengthTraceFile, std::ofstream::out);
}
////////////////////////////////////////////////////////////
@@ -859,30 +1033,53 @@ main (int argc, char *argv[])
qd = tc->GetRootQueueDiscOnDevice(wanLanDevices.Get(0));
qd->TraceConnectWithoutContext("Drop", MakeBoundCallback(&TraceQueueDrop, &queueDropOfStream));
qd->TraceConnectWithoutContext("Mark", MakeBoundCallback(&TraceQueueMark, &queueMarkOfStream));
qd->TraceConnectWithoutContext ("BytesInQueue", MakeBoundCallback (&TraceQueueLength, &queueLengthOfStream, linkRate));
qd->TraceConnectWithoutContext(
"BytesInQueue",
MakeBoundCallback(&TraceQueueLength, &queueLengthOfStream, linkRate));
// Setup scheduled traces; TCP traces must be hooked after socket creation
Simulator::Schedule (Seconds (5) + MilliSeconds (100), &ScheduleFirstTcpRttTraceConnection, &firstTcpRttOfStream);
Simulator::Schedule (Seconds (5) + MilliSeconds (100), &ScheduleFirstTcpCwndTraceConnection, &firstTcpCwndOfStream);
Simulator::Schedule(Seconds(5) + MilliSeconds(100),
&ScheduleFirstTcpRttTraceConnection,
&firstTcpRttOfStream);
Simulator::Schedule(Seconds(5) + MilliSeconds(100),
&ScheduleFirstTcpCwndTraceConnection,
&firstTcpCwndOfStream);
Simulator::Schedule(Seconds(5) + MilliSeconds(100), &ScheduleFirstPacketSinkConnection);
if (firstTcpType == "dctcp")
{
Simulator::Schedule (Seconds (5) + MilliSeconds (100), &ScheduleFirstDctcpTraceConnection, &firstTcpDctcpOfStream);
Simulator::Schedule(Seconds(5) + MilliSeconds(100),
&ScheduleFirstDctcpTraceConnection,
&firstTcpDctcpOfStream);
}
Simulator::Schedule (throughputSamplingInterval, &TraceFirstThroughput, &firstTcpThroughputOfStream, throughputSamplingInterval);
Simulator::Schedule(throughputSamplingInterval,
&TraceFirstThroughput,
&firstTcpThroughputOfStream,
throughputSamplingInterval);
if (enableSecondTcp)
{
// Setup scheduled traces; TCP traces must be hooked after socket creation
Simulator::Schedule (Seconds (15) + MilliSeconds (100), &ScheduleSecondTcpRttTraceConnection, &secondTcpRttOfStream);
Simulator::Schedule (Seconds (15) + MilliSeconds (100), &ScheduleSecondTcpCwndTraceConnection, &secondTcpCwndOfStream);
Simulator::Schedule(Seconds(15) + MilliSeconds(100),
&ScheduleSecondTcpRttTraceConnection,
&secondTcpRttOfStream);
Simulator::Schedule(Seconds(15) + MilliSeconds(100),
&ScheduleSecondTcpCwndTraceConnection,
&secondTcpCwndOfStream);
Simulator::Schedule(Seconds(15) + MilliSeconds(100), &ScheduleSecondPacketSinkConnection);
Simulator::Schedule (throughputSamplingInterval, &TraceSecondThroughput, &secondTcpThroughputOfStream, throughputSamplingInterval);
Simulator::Schedule(throughputSamplingInterval,
&TraceSecondThroughput,
&secondTcpThroughputOfStream,
throughputSamplingInterval);
if (secondTcpType == "dctcp")
{
Simulator::Schedule (Seconds (15) + MilliSeconds (100), &ScheduleSecondDctcpTraceConnection, &secondTcpDctcpOfStream);
Simulator::Schedule(Seconds(15) + MilliSeconds(100),
&ScheduleSecondDctcpTraceConnection,
&secondTcpDctcpOfStream);
}
}
Simulator::Schedule (marksSamplingInterval, &TraceMarksFrequency, &queueMarksFrequencyOfStream, marksSamplingInterval);
Simulator::Schedule(marksSamplingInterval,
&TraceMarksFrequency,
&queueMarksFrequencyOfStream,
marksSamplingInterval);
if (enablePcap)
{
@@ -923,5 +1120,6 @@ main (int argc, char *argv[])
{
NS_FATAL_ERROR("Validation failed");
}
}
return 0;
}