mtp, mpi: Fix clang-tidy warnings
This commit is contained in:
@@ -163,7 +163,7 @@ main(int argc, char* argv[])
|
|||||||
Time simulationEndTime = Seconds(5);
|
Time simulationEndTime = Seconds(5);
|
||||||
DataRate bottleneckBandwidth("10Mbps"); // value of x as shown in the above network topology
|
DataRate bottleneckBandwidth("10Mbps"); // value of x as shown in the above network topology
|
||||||
Time bottleneckDelay = MilliSeconds(40);
|
Time bottleneckDelay = MilliSeconds(40);
|
||||||
DataRate regLinkBandwidth = DataRate(4 * bottleneckBandwidth.GetBitRate());
|
DataRate regLinkBandwidth(4 * bottleneckBandwidth.GetBitRate());
|
||||||
Time regLinkDelay = MilliSeconds(5);
|
Time regLinkDelay = MilliSeconds(5);
|
||||||
DataRate maxPacingRate("4Gbps");
|
DataRate maxPacingRate("4Gbps");
|
||||||
|
|
||||||
@@ -326,9 +326,7 @@ main(int argc, char* argv[])
|
|||||||
monitor->CheckForLostPackets();
|
monitor->CheckForLostPackets();
|
||||||
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon.GetClassifier());
|
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon.GetClassifier());
|
||||||
FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats();
|
FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats();
|
||||||
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin();
|
for (auto i = stats.begin(); i != stats.end(); ++i)
|
||||||
i != stats.end();
|
|
||||||
++i)
|
|
||||||
{
|
{
|
||||||
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
|
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
|
||||||
|
|
||||||
|
|||||||
@@ -163,12 +163,12 @@ NS_LOG_COMPONENT_DEFINE("TcpValidation");
|
|||||||
|
|
||||||
// These variables are declared outside of main() so that they can
|
// These variables are declared outside of main() so that they can
|
||||||
// be used in trace sinks.
|
// be used in trace sinks.
|
||||||
std::atomic<uint32_t> g_firstBytesReceived (0); //!< First received packet size.
|
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_secondBytesReceived(0); //!< Second received packet size.
|
||||||
std::atomic<uint32_t> g_marksObserved (0); //!< Number of marked packets observed.
|
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::atomic<uint32_t> g_dropsObserved(0); //!< Number of dropped packets observed.
|
||||||
std::string g_validate = ""; //!< Empty string disables validation.
|
std::string g_validate = ""; //!< Empty string disables validation.
|
||||||
bool g_validationFailed = false; //!< True if validation failed.
|
bool g_validationFailed = false; //!< True if validation failed.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trace first congestion window.
|
* Trace first congestion window.
|
||||||
@@ -748,7 +748,7 @@ main(int argc, char* argv[])
|
|||||||
firstTcpTypeId = TcpDctcp::GetTypeId();
|
firstTcpTypeId = TcpDctcp::GetTypeId();
|
||||||
Config::SetDefault("ns3::CoDelQueueDisc::CeThreshold", TimeValue(ceThreshold));
|
Config::SetDefault("ns3::CoDelQueueDisc::CeThreshold", TimeValue(ceThreshold));
|
||||||
Config::SetDefault("ns3::FqCoDelQueueDisc::CeThreshold", TimeValue(ceThreshold));
|
Config::SetDefault("ns3::FqCoDelQueueDisc::CeThreshold", TimeValue(ceThreshold));
|
||||||
if (queueUseEcn == false)
|
if (!queueUseEcn)
|
||||||
{
|
{
|
||||||
std::cout << "Warning: using DCTCP with queue ECN disabled" << std::endl;
|
std::cout << "Warning: using DCTCP with queue ECN disabled" << std::endl;
|
||||||
}
|
}
|
||||||
@@ -935,7 +935,7 @@ main(int argc, char* argv[])
|
|||||||
proto->SetAttribute("SocketType", TypeIdValue(secondTcpTypeId));
|
proto->SetAttribute("SocketType", TypeIdValue(secondTcpTypeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// InternetStackHelper will install a base TrafficControLayer on the node,
|
// InternetStackHelper will install a base TrafficControlLayer on the node,
|
||||||
// but the Ipv4AddressHelper below will install the default FqCoDelQueueDisc
|
// but the Ipv4AddressHelper below will install the default FqCoDelQueueDisc
|
||||||
// on all single device nodes. The below code overrides the configuration
|
// on all single device nodes. The below code overrides the configuration
|
||||||
// that is normally done by the Ipv4AddressHelper::Install() method by
|
// that is normally done by the Ipv4AddressHelper::Install() method by
|
||||||
|
|||||||
@@ -52,15 +52,16 @@ class Distribution
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// load a distribution from a CDF file
|
// load a distribution from a CDF file
|
||||||
Distribution(string filename = "src/mtp/examples/web-search.txt")
|
Distribution(const string filename)
|
||||||
{
|
{
|
||||||
ifstream fin;
|
ifstream fin;
|
||||||
fin.open(filename);
|
fin.open(filename);
|
||||||
while (!fin.eof())
|
while (!fin.eof())
|
||||||
{
|
{
|
||||||
double x, cdf;
|
double x;
|
||||||
|
double cdf;
|
||||||
fin >> x >> cdf;
|
fin >> x >> cdf;
|
||||||
m_cdf.push_back(std::make_pair(x, cdf));
|
m_cdf.emplace_back(x, cdf);
|
||||||
}
|
}
|
||||||
fin.close();
|
fin.close();
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ class Distribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
// expectation value of the distribution
|
// expectation value of the distribution
|
||||||
double Expectation()
|
double Expectation() const
|
||||||
{
|
{
|
||||||
double ex = 0;
|
double ex = 0;
|
||||||
for (uint32_t i = 1; i < m_cdf.size(); i++)
|
for (uint32_t i = 1; i < m_cdf.size(); i++)
|
||||||
@@ -106,22 +107,20 @@ class Distribution
|
|||||||
class TrafficGenerator
|
class TrafficGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TrafficGenerator(string cdfFile,
|
TrafficGenerator(const string cdfFile,
|
||||||
uint32_t hostTotal,
|
const uint32_t hostTotal,
|
||||||
double dataRate,
|
const double dataRate,
|
||||||
double incastRatio,
|
const double incastRatio,
|
||||||
vector<uint32_t> victims)
|
const vector<uint32_t> victims)
|
||||||
|
: m_currentTime(0),
|
||||||
|
m_incastRatio(incastRatio),
|
||||||
|
m_hostTotal(hostTotal),
|
||||||
|
m_victims(victims),
|
||||||
|
m_flowCount(0),
|
||||||
|
m_flowSizeTotal(0),
|
||||||
|
m_distribution(cdfFile)
|
||||||
{
|
{
|
||||||
m_distribution = Distribution(cdfFile);
|
|
||||||
|
|
||||||
m_currentTime = 0;
|
|
||||||
m_averageInterval = m_distribution.Expectation() * 8 / dataRate;
|
m_averageInterval = m_distribution.Expectation() * 8 / dataRate;
|
||||||
m_incastRatio = incastRatio;
|
|
||||||
m_hostTotal = hostTotal;
|
|
||||||
m_victims = victims;
|
|
||||||
|
|
||||||
m_flowCount = 0;
|
|
||||||
m_flowSizeTotal = 0;
|
|
||||||
m_uniformRand = CreateObject<UniformRandomVariable>();
|
m_uniformRand = CreateObject<UniformRandomVariable>();
|
||||||
m_expRand = CreateObject<ExponentialRandomVariable>();
|
m_expRand = CreateObject<ExponentialRandomVariable>();
|
||||||
}
|
}
|
||||||
@@ -129,7 +128,8 @@ class TrafficGenerator
|
|||||||
// get one flow with incremental time and random src, dst and size
|
// get one flow with incremental time and random src, dst and size
|
||||||
tuple<double, uint32_t, uint32_t, uint32_t> GetFlow()
|
tuple<double, uint32_t, uint32_t, uint32_t> GetFlow()
|
||||||
{
|
{
|
||||||
uint32_t src, dst;
|
uint32_t src;
|
||||||
|
uint32_t dst;
|
||||||
if (m_uniformRand->GetValue(0, 1) < m_incastRatio)
|
if (m_uniformRand->GetValue(0, 1) < m_incastRatio)
|
||||||
{
|
{
|
||||||
dst = m_victims[m_uniformRand->GetInteger(0, m_victims.size() - 1)];
|
dst = m_victims[m_uniformRand->GetInteger(0, m_victims.size() - 1)];
|
||||||
@@ -151,22 +151,22 @@ class TrafficGenerator
|
|||||||
return make_tuple(m_currentTime, src, dst, flowSize);
|
return make_tuple(m_currentTime, src, dst, flowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetActualDataRate()
|
double GetActualDataRate() const
|
||||||
{
|
{
|
||||||
return m_flowSizeTotal / m_currentTime * 8;
|
return m_flowSizeTotal / m_currentTime * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetAvgFlowSize()
|
double GetAvgFlowSize() const
|
||||||
{
|
{
|
||||||
return m_distribution.Expectation();
|
return m_distribution.Expectation();
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetActualAvgFlowSize()
|
double GetActualAvgFlowSize() const
|
||||||
{
|
{
|
||||||
return m_flowSizeTotal / (double)m_flowCount;
|
return m_flowSizeTotal / (double)m_flowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GetFlowCount()
|
uint32_t GetFlowCount() const
|
||||||
{
|
{
|
||||||
return m_flowCount;
|
return m_flowCount;
|
||||||
}
|
}
|
||||||
@@ -463,10 +463,17 @@ StartSimulation()
|
|||||||
uint64_t eventCount = Simulator::GetEventCount();
|
uint64_t eventCount = Simulator::GetEventCount();
|
||||||
if (conf::flowmon)
|
if (conf::flowmon)
|
||||||
{
|
{
|
||||||
uint64_t dropped = 0, totalTx = 0, totalRx = 0, totalTxBytes = 0, flowCount = 0,
|
uint64_t dropped = 0;
|
||||||
finishedFlowCount = 0;
|
uint64_t totalTx = 0;
|
||||||
|
uint64_t totalRx = 0;
|
||||||
|
uint64_t totalTxBytes = 0;
|
||||||
|
uint64_t flowCount = 0;
|
||||||
|
uint64_t finishedFlowCount = 0;
|
||||||
double totalThroughput = 0;
|
double totalThroughput = 0;
|
||||||
Time totalFct(0), totalFinishedFct(0), totalDelay(0);
|
Time totalFct(0);
|
||||||
|
Time totalFinishedFct(0);
|
||||||
|
Time totalDelay(0);
|
||||||
|
|
||||||
flowMonitor->CheckForLostPackets();
|
flowMonitor->CheckForLostPackets();
|
||||||
for (auto& p : flowMonitor->GetFlowStats())
|
for (auto& p : flowMonitor->GetFlowStats())
|
||||||
{
|
{
|
||||||
@@ -490,6 +497,7 @@ StartSimulation()
|
|||||||
flowCount++;
|
flowCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double avgFct = (double)totalFct.GetMicroSeconds() / flowCount;
|
double avgFct = (double)totalFct.GetMicroSeconds() / flowCount;
|
||||||
double avgFinishedFct = (double)totalFinishedFct.GetMicroSeconds() / finishedFlowCount;
|
double avgFinishedFct = (double)totalFinishedFct.GetMicroSeconds() / finishedFlowCount;
|
||||||
double avgDelay = (double)totalDelay.GetMicroSeconds() / totalRx;
|
double avgDelay = (double)totalDelay.GetMicroSeconds() / totalRx;
|
||||||
@@ -542,7 +550,10 @@ main(int argc, char* argv[])
|
|||||||
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
|
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
|
||||||
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
|
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
|
||||||
uint32_t nHost = conf::k / 2; // number of hosts under a switch
|
uint32_t nHost = conf::k / 2; // number of hosts under a switch
|
||||||
NodeContainer core[nGroup], agg[nPod], edge[nPod], host[nPod][nEdge];
|
NodeContainer core[nGroup];
|
||||||
|
NodeContainer agg[nPod];
|
||||||
|
NodeContainer edge[nPod];
|
||||||
|
NodeContainer host[nPod][nEdge];
|
||||||
|
|
||||||
// create nodes
|
// create nodes
|
||||||
for (uint32_t i = 0; i < nGroup; i++)
|
for (uint32_t i = 0; i < nGroup; i++)
|
||||||
|
|||||||
@@ -51,15 +51,16 @@ class Distribution
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// load a distribution from a CDF file
|
// load a distribution from a CDF file
|
||||||
Distribution(string filename = "src/mtp/examples/web-search.txt")
|
Distribution(const string filename)
|
||||||
{
|
{
|
||||||
ifstream fin;
|
ifstream fin;
|
||||||
fin.open(filename);
|
fin.open(filename);
|
||||||
while (!fin.eof())
|
while (!fin.eof())
|
||||||
{
|
{
|
||||||
double x, cdf;
|
double x;
|
||||||
|
double cdf;
|
||||||
fin >> x >> cdf;
|
fin >> x >> cdf;
|
||||||
m_cdf.push_back(std::make_pair(x, cdf));
|
m_cdf.emplace_back(x, cdf);
|
||||||
}
|
}
|
||||||
fin.close();
|
fin.close();
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ class Distribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
// expectation value of the distribution
|
// expectation value of the distribution
|
||||||
double Expectation()
|
double Expectation() const
|
||||||
{
|
{
|
||||||
double ex = 0;
|
double ex = 0;
|
||||||
for (uint32_t i = 1; i < m_cdf.size(); i++)
|
for (uint32_t i = 1; i < m_cdf.size(); i++)
|
||||||
@@ -105,22 +106,20 @@ class Distribution
|
|||||||
class TrafficGenerator
|
class TrafficGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TrafficGenerator(string cdfFile,
|
TrafficGenerator(const string cdfFile,
|
||||||
uint32_t hostTotal,
|
const uint32_t hostTotal,
|
||||||
double dataRate,
|
const double dataRate,
|
||||||
double incastRatio,
|
const double incastRatio,
|
||||||
vector<uint32_t> victims)
|
const vector<uint32_t> victims)
|
||||||
|
: m_currentTime(0),
|
||||||
|
m_incastRatio(incastRatio),
|
||||||
|
m_hostTotal(hostTotal),
|
||||||
|
m_victims(victims),
|
||||||
|
m_flowCount(0),
|
||||||
|
m_flowSizeTotal(0),
|
||||||
|
m_distribution(cdfFile)
|
||||||
{
|
{
|
||||||
m_distribution = Distribution(cdfFile);
|
|
||||||
|
|
||||||
m_currentTime = 0;
|
|
||||||
m_averageInterval = m_distribution.Expectation() * 8 / dataRate;
|
m_averageInterval = m_distribution.Expectation() * 8 / dataRate;
|
||||||
m_incastRatio = incastRatio;
|
|
||||||
m_hostTotal = hostTotal;
|
|
||||||
m_victims = victims;
|
|
||||||
|
|
||||||
m_flowCount = 0;
|
|
||||||
m_flowSizeTotal = 0;
|
|
||||||
m_uniformRand = CreateObject<UniformRandomVariable>();
|
m_uniformRand = CreateObject<UniformRandomVariable>();
|
||||||
m_expRand = CreateObject<ExponentialRandomVariable>();
|
m_expRand = CreateObject<ExponentialRandomVariable>();
|
||||||
}
|
}
|
||||||
@@ -128,7 +127,8 @@ class TrafficGenerator
|
|||||||
// get one flow with incremental time and random src, dst and size
|
// get one flow with incremental time and random src, dst and size
|
||||||
tuple<double, uint32_t, uint32_t, uint32_t> GetFlow()
|
tuple<double, uint32_t, uint32_t, uint32_t> GetFlow()
|
||||||
{
|
{
|
||||||
uint32_t src, dst;
|
uint32_t src;
|
||||||
|
uint32_t dst;
|
||||||
if (m_uniformRand->GetValue(0, 1) < m_incastRatio)
|
if (m_uniformRand->GetValue(0, 1) < m_incastRatio)
|
||||||
{
|
{
|
||||||
dst = m_victims[m_uniformRand->GetInteger(0, m_victims.size() - 1)];
|
dst = m_victims[m_uniformRand->GetInteger(0, m_victims.size() - 1)];
|
||||||
@@ -150,22 +150,22 @@ class TrafficGenerator
|
|||||||
return make_tuple(m_currentTime, src, dst, flowSize);
|
return make_tuple(m_currentTime, src, dst, flowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetActualDataRate()
|
double GetActualDataRate() const
|
||||||
{
|
{
|
||||||
return m_flowSizeTotal / m_currentTime * 8;
|
return m_flowSizeTotal / m_currentTime * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetAvgFlowSize()
|
double GetAvgFlowSize() const
|
||||||
{
|
{
|
||||||
return m_distribution.Expectation();
|
return m_distribution.Expectation();
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetActualAvgFlowSize()
|
double GetActualAvgFlowSize() const
|
||||||
{
|
{
|
||||||
return m_flowSizeTotal / (double)m_flowCount;
|
return m_flowSizeTotal / (double)m_flowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GetFlowCount()
|
uint32_t GetFlowCount() const
|
||||||
{
|
{
|
||||||
return m_flowCount;
|
return m_flowCount;
|
||||||
}
|
}
|
||||||
@@ -467,10 +467,17 @@ StartSimulation()
|
|||||||
uint64_t eventCount = Simulator::GetEventCount();
|
uint64_t eventCount = Simulator::GetEventCount();
|
||||||
if (conf::flowmon)
|
if (conf::flowmon)
|
||||||
{
|
{
|
||||||
uint64_t dropped = 0, totalTx = 0, totalRx = 0, totalTxBytes = 0, flowCount = 0,
|
uint64_t dropped = 0;
|
||||||
finishedFlowCount = 0;
|
uint64_t totalTx = 0;
|
||||||
|
uint64_t totalRx = 0;
|
||||||
|
uint64_t totalTxBytes = 0;
|
||||||
|
uint64_t flowCount = 0;
|
||||||
|
uint64_t finishedFlowCount = 0;
|
||||||
double totalThroughput = 0;
|
double totalThroughput = 0;
|
||||||
Time totalFct(0), totalFinishedFct(0), totalDelay(0);
|
Time totalFct(0);
|
||||||
|
Time totalFinishedFct(0);
|
||||||
|
Time totalDelay(0);
|
||||||
|
|
||||||
flowMonitor->CheckForLostPackets();
|
flowMonitor->CheckForLostPackets();
|
||||||
for (auto& p : flowMonitor->GetFlowStats())
|
for (auto& p : flowMonitor->GetFlowStats())
|
||||||
{
|
{
|
||||||
@@ -494,6 +501,7 @@ StartSimulation()
|
|||||||
flowCount++;
|
flowCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double avgFct = (double)totalFct.GetMicroSeconds() / flowCount;
|
double avgFct = (double)totalFct.GetMicroSeconds() / flowCount;
|
||||||
double avgFinishedFct = (double)totalFinishedFct.GetMicroSeconds() / finishedFlowCount;
|
double avgFinishedFct = (double)totalFinishedFct.GetMicroSeconds() / finishedFlowCount;
|
||||||
double avgDelay = (double)totalDelay.GetMicroSeconds() / totalRx;
|
double avgDelay = (double)totalDelay.GetMicroSeconds() / totalRx;
|
||||||
@@ -546,7 +554,10 @@ main(int argc, char* argv[])
|
|||||||
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
|
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
|
||||||
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
|
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
|
||||||
uint32_t nHost = conf::k / 2; // number of hosts under a switch
|
uint32_t nHost = conf::k / 2; // number of hosts under a switch
|
||||||
NodeContainer core[nGroup], agg[nPod], edge[nPod], host[nPod][nEdge];
|
NodeContainer core[nGroup];
|
||||||
|
NodeContainer agg[nPod];
|
||||||
|
NodeContainer edge[nPod];
|
||||||
|
NodeContainer host[nPod][nEdge];
|
||||||
|
|
||||||
// create nodes
|
// create nodes
|
||||||
for (uint32_t i = 0; i < nGroup; i++)
|
for (uint32_t i = 0; i < nGroup; i++)
|
||||||
|
|||||||
@@ -225,7 +225,8 @@ GrantedTimeWindowMpiInterface::SendPacket(Ptr<Packet> p,
|
|||||||
|
|
||||||
#ifdef NS3_MTP
|
#ifdef NS3_MTP
|
||||||
while (g_sending.exchange(true, std::memory_order_acquire))
|
while (g_sending.exchange(true, std::memory_order_acquire))
|
||||||
;
|
{
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SentBuffer sendBuf;
|
SentBuffer sendBuf;
|
||||||
|
|||||||
@@ -178,8 +178,7 @@ HybridSimulatorImpl::Remove(const EventId& id)
|
|||||||
if (id.GetUid() == EventId::DESTROY)
|
if (id.GetUid() == EventId::DESTROY)
|
||||||
{
|
{
|
||||||
// destroy events.
|
// destroy events.
|
||||||
for (std::list<EventId>::iterator i = m_destroyEvents.begin(); i != m_destroyEvents.end();
|
for (auto i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||||
i++)
|
|
||||||
{
|
{
|
||||||
if (*i == id)
|
if (*i == id)
|
||||||
{
|
{
|
||||||
@@ -209,13 +208,11 @@ HybridSimulatorImpl::IsExpired(const EventId& id) const
|
|||||||
if (id.GetUid() == EventId::DESTROY)
|
if (id.GetUid() == EventId::DESTROY)
|
||||||
{
|
{
|
||||||
// destroy events.
|
// destroy events.
|
||||||
if (id.PeekEventImpl() == 0 || id.PeekEventImpl()->IsCancelled())
|
if (id.PeekEventImpl() == nullptr || id.PeekEventImpl()->IsCancelled())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (std::list<EventId>::const_iterator i = m_destroyEvents.begin();
|
for (auto i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||||
i != m_destroyEvents.end();
|
|
||||||
i++)
|
|
||||||
{
|
{
|
||||||
if (*i == id)
|
if (*i == id)
|
||||||
{
|
{
|
||||||
@@ -374,7 +371,7 @@ HybridSimulatorImpl::Partition()
|
|||||||
if (m_minLookahead == TimeStep(0))
|
if (m_minLookahead == TimeStep(0))
|
||||||
{
|
{
|
||||||
std::vector<Time> delays;
|
std::vector<Time> delays;
|
||||||
for (NodeContainer::Iterator it = nodes.Begin(); it != nodes.End(); it++)
|
for (auto it = nodes.Begin(); it != nodes.End(); it++)
|
||||||
{
|
{
|
||||||
Ptr<Node> node = *it;
|
Ptr<Node> node = *it;
|
||||||
if (node->GetSystemId() == m_myId)
|
if (node->GetSystemId() == m_myId)
|
||||||
@@ -398,7 +395,7 @@ HybridSimulatorImpl::Partition()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::sort(delays.begin(), delays.end());
|
std::sort(delays.begin(), delays.end());
|
||||||
if (delays.size() == 0)
|
if (delays.empty())
|
||||||
{
|
{
|
||||||
m_minLookahead = TimeStep(0);
|
m_minLookahead = TimeStep(0);
|
||||||
}
|
}
|
||||||
@@ -414,7 +411,7 @@ HybridSimulatorImpl::Partition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// perform a BFS on the whole network topo to assign each node a localSystemId
|
// perform a BFS on the whole network topo to assign each node a localSystemId
|
||||||
for (NodeContainer::Iterator it = nodes.Begin(); it != nodes.End(); it++)
|
for (auto it = nodes.Begin(); it != nodes.End(); it++)
|
||||||
{
|
{
|
||||||
Ptr<Node> node = *it;
|
Ptr<Node> node = *it;
|
||||||
if (!visited[node->GetId()] && node->GetSystemId() == m_myId)
|
if (!visited[node->GetId()] && node->GetSystemId() == m_myId)
|
||||||
|
|||||||
@@ -49,15 +49,16 @@ class Distribution
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// load a distribution from a CDF file
|
// load a distribution from a CDF file
|
||||||
Distribution(string filename = "src/mtp/examples/web-search.txt")
|
Distribution(const string filename)
|
||||||
{
|
{
|
||||||
ifstream fin;
|
ifstream fin;
|
||||||
fin.open(filename);
|
fin.open(filename);
|
||||||
while (!fin.eof())
|
while (!fin.eof())
|
||||||
{
|
{
|
||||||
double x, cdf;
|
double x;
|
||||||
|
double cdf;
|
||||||
fin >> x >> cdf;
|
fin >> x >> cdf;
|
||||||
m_cdf.push_back(std::make_pair(x, cdf));
|
m_cdf.emplace_back(x, cdf);
|
||||||
}
|
}
|
||||||
fin.close();
|
fin.close();
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ class Distribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
// expectation value of the distribution
|
// expectation value of the distribution
|
||||||
double Expectation()
|
double Expectation() const
|
||||||
{
|
{
|
||||||
double ex = 0;
|
double ex = 0;
|
||||||
for (uint32_t i = 1; i < m_cdf.size(); i++)
|
for (uint32_t i = 1; i < m_cdf.size(); i++)
|
||||||
@@ -103,22 +104,20 @@ class Distribution
|
|||||||
class TrafficGenerator
|
class TrafficGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TrafficGenerator(string cdfFile,
|
TrafficGenerator(const string cdfFile,
|
||||||
uint32_t hostTotal,
|
const uint32_t hostTotal,
|
||||||
double dataRate,
|
const double dataRate,
|
||||||
double incastRatio,
|
const double incastRatio,
|
||||||
vector<uint32_t> victims)
|
const vector<uint32_t> victims)
|
||||||
|
: m_currentTime(0),
|
||||||
|
m_incastRatio(incastRatio),
|
||||||
|
m_hostTotal(hostTotal),
|
||||||
|
m_victims(victims),
|
||||||
|
m_flowCount(0),
|
||||||
|
m_flowSizeTotal(0),
|
||||||
|
m_distribution(cdfFile)
|
||||||
{
|
{
|
||||||
m_distribution = Distribution(cdfFile);
|
|
||||||
|
|
||||||
m_currentTime = 0;
|
|
||||||
m_averageInterval = m_distribution.Expectation() * 8 / dataRate;
|
m_averageInterval = m_distribution.Expectation() * 8 / dataRate;
|
||||||
m_incastRatio = incastRatio;
|
|
||||||
m_hostTotal = hostTotal;
|
|
||||||
m_victims = victims;
|
|
||||||
|
|
||||||
m_flowCount = 0;
|
|
||||||
m_flowSizeTotal = 0;
|
|
||||||
m_uniformRand = CreateObject<UniformRandomVariable>();
|
m_uniformRand = CreateObject<UniformRandomVariable>();
|
||||||
m_expRand = CreateObject<ExponentialRandomVariable>();
|
m_expRand = CreateObject<ExponentialRandomVariable>();
|
||||||
}
|
}
|
||||||
@@ -126,7 +125,8 @@ class TrafficGenerator
|
|||||||
// get one flow with incremental time and random src, dst and size
|
// get one flow with incremental time and random src, dst and size
|
||||||
tuple<double, uint32_t, uint32_t, uint32_t> GetFlow()
|
tuple<double, uint32_t, uint32_t, uint32_t> GetFlow()
|
||||||
{
|
{
|
||||||
uint32_t src, dst;
|
uint32_t src;
|
||||||
|
uint32_t dst;
|
||||||
if (m_uniformRand->GetValue(0, 1) < m_incastRatio)
|
if (m_uniformRand->GetValue(0, 1) < m_incastRatio)
|
||||||
{
|
{
|
||||||
dst = m_victims[m_uniformRand->GetInteger(0, m_victims.size() - 1)];
|
dst = m_victims[m_uniformRand->GetInteger(0, m_victims.size() - 1)];
|
||||||
@@ -148,22 +148,22 @@ class TrafficGenerator
|
|||||||
return make_tuple(m_currentTime, src, dst, flowSize);
|
return make_tuple(m_currentTime, src, dst, flowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetActualDataRate()
|
double GetActualDataRate() const
|
||||||
{
|
{
|
||||||
return m_flowSizeTotal / m_currentTime * 8;
|
return m_flowSizeTotal / m_currentTime * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetAvgFlowSize()
|
double GetAvgFlowSize() const
|
||||||
{
|
{
|
||||||
return m_distribution.Expectation();
|
return m_distribution.Expectation();
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetActualAvgFlowSize()
|
double GetActualAvgFlowSize() const
|
||||||
{
|
{
|
||||||
return m_flowSizeTotal / (double)m_flowCount;
|
return m_flowSizeTotal / (double)m_flowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GetFlowCount()
|
uint32_t GetFlowCount() const
|
||||||
{
|
{
|
||||||
return m_flowCount;
|
return m_flowCount;
|
||||||
}
|
}
|
||||||
@@ -443,10 +443,17 @@ StartSimulation()
|
|||||||
uint64_t eventCount = Simulator::GetEventCount();
|
uint64_t eventCount = Simulator::GetEventCount();
|
||||||
if (conf::flowmon)
|
if (conf::flowmon)
|
||||||
{
|
{
|
||||||
uint64_t dropped = 0, totalTx = 0, totalRx = 0, totalTxBytes = 0, flowCount = 0,
|
uint64_t dropped = 0;
|
||||||
finishedFlowCount = 0;
|
uint64_t totalTx = 0;
|
||||||
|
uint64_t totalRx = 0;
|
||||||
|
uint64_t totalTxBytes = 0;
|
||||||
|
uint64_t flowCount = 0;
|
||||||
|
uint64_t finishedFlowCount = 0;
|
||||||
double totalThroughput = 0;
|
double totalThroughput = 0;
|
||||||
Time totalFct(0), totalFinishedFct(0), totalDelay(0);
|
Time totalFct(0);
|
||||||
|
Time totalFinishedFct(0);
|
||||||
|
Time totalDelay(0);
|
||||||
|
|
||||||
flowMonitor->CheckForLostPackets();
|
flowMonitor->CheckForLostPackets();
|
||||||
for (auto& p : flowMonitor->GetFlowStats())
|
for (auto& p : flowMonitor->GetFlowStats())
|
||||||
{
|
{
|
||||||
@@ -470,6 +477,7 @@ StartSimulation()
|
|||||||
flowCount++;
|
flowCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double avgFct = (double)totalFct.GetMicroSeconds() / flowCount;
|
double avgFct = (double)totalFct.GetMicroSeconds() / flowCount;
|
||||||
double avgFinishedFct = (double)totalFinishedFct.GetMicroSeconds() / finishedFlowCount;
|
double avgFinishedFct = (double)totalFinishedFct.GetMicroSeconds() / finishedFlowCount;
|
||||||
double avgDelay = (double)totalDelay.GetMicroSeconds() / totalRx;
|
double avgDelay = (double)totalDelay.GetMicroSeconds() / totalRx;
|
||||||
@@ -508,7 +516,10 @@ main(int argc, char* argv[])
|
|||||||
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
|
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
|
||||||
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
|
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
|
||||||
uint32_t nHost = conf::k / 2; // number of hosts under a switch
|
uint32_t nHost = conf::k / 2; // number of hosts under a switch
|
||||||
NodeContainer core[nGroup], agg[nPod], edge[nPod], host[nPod][nEdge];
|
NodeContainer core[nGroup];
|
||||||
|
NodeContainer agg[nPod];
|
||||||
|
NodeContainer edge[nPod];
|
||||||
|
NodeContainer host[nPod][nEdge];
|
||||||
|
|
||||||
// create nodes
|
// create nodes
|
||||||
for (uint32_t i = 0; i < nGroup; i++)
|
for (uint32_t i = 0; i < nGroup; i++)
|
||||||
|
|||||||
@@ -33,18 +33,18 @@ namespace ns3
|
|||||||
NS_LOG_COMPONENT_DEFINE("LogicalProcess");
|
NS_LOG_COMPONENT_DEFINE("LogicalProcess");
|
||||||
|
|
||||||
LogicalProcess::LogicalProcess()
|
LogicalProcess::LogicalProcess()
|
||||||
|
: m_systemId(0),
|
||||||
|
m_systemCount(0),
|
||||||
|
m_stop(false),
|
||||||
|
m_uid(EventId::UID::VALID),
|
||||||
|
m_currentContext(Simulator::NO_CONTEXT),
|
||||||
|
m_currentUid(0),
|
||||||
|
m_currentTs(0),
|
||||||
|
m_eventCount(0),
|
||||||
|
m_pendingEventCount(0),
|
||||||
|
m_events(nullptr),
|
||||||
|
m_lookAhead(TimeStep(0))
|
||||||
{
|
{
|
||||||
m_systemId = 0;
|
|
||||||
m_systemCount = 0;
|
|
||||||
m_uid = EventId::UID::VALID;
|
|
||||||
m_stop = false;
|
|
||||||
m_currentContext = Simulator::NO_CONTEXT;
|
|
||||||
m_currentUid = 0;
|
|
||||||
m_currentTs = 0;
|
|
||||||
m_eventCount = 0;
|
|
||||||
m_pendingEventCount = 0;
|
|
||||||
m_events = 0;
|
|
||||||
m_lookAhead = TimeStep(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalProcess::~LogicalProcess()
|
LogicalProcess::~LogicalProcess()
|
||||||
@@ -82,7 +82,7 @@ LogicalProcess::CalculateLookAhead()
|
|||||||
{
|
{
|
||||||
m_lookAhead = Time::Max() / 2 - TimeStep(1);
|
m_lookAhead = Time::Max() / 2 - TimeStep(1);
|
||||||
NodeContainer c = NodeContainer::GetGlobal();
|
NodeContainer c = NodeContainer::GetGlobal();
|
||||||
for (NodeContainer::Iterator iter = c.Begin(); iter != c.End(); ++iter)
|
for (auto iter = c.Begin(); iter != c.End(); ++iter)
|
||||||
{
|
{
|
||||||
#ifdef NS3_MPI
|
#ifdef NS3_MPI
|
||||||
if (((*iter)->GetSystemId() >> 16) != m_systemId)
|
if (((*iter)->GetSystemId() >> 16) != m_systemId)
|
||||||
@@ -241,8 +241,7 @@ LogicalProcess::ScheduleWithContext(LogicalProcess* remote,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ev.key.m_uid = EventId::UID::INVALID;
|
ev.key.m_uid = EventId::UID::INVALID;
|
||||||
remote->m_mailbox[m_systemId].push_back(
|
remote->m_mailbox[m_systemId].emplace_back(m_currentTs, m_systemId, m_uid, ev);
|
||||||
std::make_tuple(m_currentTs, m_systemId, m_uid, ev));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,16 +287,9 @@ LogicalProcess::Remove(const EventId& id)
|
|||||||
bool
|
bool
|
||||||
LogicalProcess::IsExpired(const EventId& id) const
|
LogicalProcess::IsExpired(const EventId& id) const
|
||||||
{
|
{
|
||||||
if (id.PeekEventImpl() == 0 || id.GetTs() < m_currentTs ||
|
return id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs ||
|
||||||
(id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) ||
|
(id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) ||
|
||||||
id.PeekEventImpl()->IsCancelled())
|
id.PeekEventImpl()->IsCancelled();
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -233,7 +233,8 @@ MtpInterface::ProcessOneRound()
|
|||||||
|
|
||||||
// logical process barriar synchronization
|
// logical process barriar synchronization
|
||||||
while (g_finishedSystemCount.load(std::memory_order_acquire) != g_systemCount)
|
while (g_finishedSystemCount.load(std::memory_order_acquire) != g_systemCount)
|
||||||
;
|
{
|
||||||
|
};
|
||||||
|
|
||||||
// stage 2: process the public LP
|
// stage 2: process the public LP
|
||||||
g_systems[0].ProcessOneRound();
|
g_systems[0].ProcessOneRound();
|
||||||
@@ -256,7 +257,8 @@ MtpInterface::ProcessOneRound()
|
|||||||
|
|
||||||
// logical process barriar synchronization
|
// logical process barriar synchronization
|
||||||
while (g_finishedSystemCount.load(std::memory_order_acquire) != g_systemCount)
|
while (g_finishedSystemCount.load(std::memory_order_acquire) != g_systemCount)
|
||||||
;
|
{
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -324,7 +326,8 @@ MtpInterface::ThreadFunc(void* arg)
|
|||||||
if (index >= g_systemCount)
|
if (index >= g_systemCount)
|
||||||
{
|
{
|
||||||
while (g_systemIndex.load(std::memory_order_acquire) >= g_systemCount)
|
while (g_systemIndex.load(std::memory_order_acquire) >= g_systemCount)
|
||||||
;
|
{
|
||||||
|
};
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LogicalProcess* system = &g_systems[g_sortedSystemIndices[index]];
|
LogicalProcess* system = &g_systems[g_sortedSystemIndices[index]];
|
||||||
|
|||||||
Reference in New Issue
Block a user