src: Updating code style to conform (more or less) to ndn-cxx style
Also, adding .clang-format that describes the applied style. Note that
this style requires a slightly customized version of clang-format.
diff --git a/utils/tracers/l2-rate-tracer.cpp b/utils/tracers/l2-rate-tracer.cpp
index 41ae00b..f5c4d22 100644
--- a/utils/tracers/l2-rate-tracer.cpp
+++ b/utils/tracers/l2-rate-tracer.cpp
@@ -34,153 +34,150 @@
using namespace boost;
using namespace std;
-NS_LOG_COMPONENT_DEFINE ("L2RateTracer");
+NS_LOG_COMPONENT_DEFINE("L2RateTracer");
namespace ns3 {
-static std::list< boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<L2RateTracer> > > > g_tracers;
+static std::list<boost::tuple<boost::shared_ptr<std::ostream>, std::list<Ptr<L2RateTracer>>>>
+ g_tracers;
template<class T>
static inline void
-NullDeleter (T *ptr)
+NullDeleter(T* ptr)
{
}
void
-L2RateTracer::Destroy ()
+L2RateTracer::Destroy()
{
- g_tracers.clear ();
+ g_tracers.clear();
}
void
-L2RateTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+L2RateTracer::InstallAll(const std::string& file, Time averagingPeriod /* = Seconds (0.5)*/)
{
- std::list<Ptr<L2RateTracer> > tracers;
+ std::list<Ptr<L2RateTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeList::Iterator node = NodeList::Begin ();
- node != NodeList::End ();
- node++)
- {
- NS_LOG_DEBUG ("Node: " << lexical_cast<string> ((*node)->GetId ()));
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- Ptr<L2RateTracer> trace = Create<L2RateTracer> (outputStream, *node);
- trace->SetAveragingPeriod (averagingPeriod);
- tracers.push_back (trace);
- }
+ for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++) {
+ NS_LOG_DEBUG("Node: " << lexical_cast<string>((*node)->GetId()));
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ Ptr<L2RateTracer> trace = Create<L2RateTracer>(outputStream, *node);
+ trace->SetAveragingPeriod(averagingPeriod);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
-
-L2RateTracer::L2RateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node)
- : L2Tracer (node)
- , m_os (os)
+L2RateTracer::L2RateTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node)
+ : L2Tracer(node)
+ , m_os(os)
{
- SetAveragingPeriod (Seconds (1.0));
+ SetAveragingPeriod(Seconds(1.0));
}
-L2RateTracer::~L2RateTracer ()
+L2RateTracer::~L2RateTracer()
{
- m_printEvent.Cancel ();
+ m_printEvent.Cancel();
}
void
-L2RateTracer::SetAveragingPeriod (const Time &period)
+L2RateTracer::SetAveragingPeriod(const Time& period)
{
m_period = period;
- m_printEvent.Cancel ();
- m_printEvent = Simulator::Schedule (m_period, &L2RateTracer::PeriodicPrinter, this);
+ m_printEvent.Cancel();
+ m_printEvent = Simulator::Schedule(m_period, &L2RateTracer::PeriodicPrinter, this);
}
void
-L2RateTracer::PeriodicPrinter ()
+L2RateTracer::PeriodicPrinter()
{
- Print (*m_os);
- Reset ();
+ Print(*m_os);
+ Reset();
- m_printEvent = Simulator::Schedule (m_period, &L2RateTracer::PeriodicPrinter, this);
+ m_printEvent = Simulator::Schedule(m_period, &L2RateTracer::PeriodicPrinter, this);
}
void
-L2RateTracer::PrintHeader (std::ostream &os) const
+L2RateTracer::PrintHeader(std::ostream& os) const
{
- os << "Time" << "\t"
+ os << "Time"
+ << "\t"
- << "Node" << "\t"
- << "Interface" << "\t"
+ << "Node"
+ << "\t"
+ << "Interface"
+ << "\t"
- << "Type" << "\t"
- << "Packets" << "\t"
- << "Kilobytes" << "\t"
- << "PacketsRaw" << "\t"
+ << "Type"
+ << "\t"
+ << "Packets"
+ << "\t"
+ << "Kilobytes"
+ << "\t"
+ << "PacketsRaw"
+ << "\t"
<< "KilobytesRaw";
}
void
-L2RateTracer::Reset ()
+L2RateTracer::Reset()
{
- m_stats.get<0> ().Reset ();
- m_stats.get<1> ().Reset ();
+ m_stats.get<0>().Reset();
+ m_stats.get<1>().Reset();
}
const double alpha = 0.8;
-#define STATS(INDEX) m_stats.get<INDEX> ()
-#define RATE(INDEX, fieldName) STATS(INDEX).fieldName / m_period.ToDouble (Time::S)
+#define STATS(INDEX) m_stats.get<INDEX>()
+#define RATE(INDEX, fieldName) STATS(INDEX).fieldName / m_period.ToDouble(Time::S)
-#define PRINTER(printName, fieldName, interface) \
-STATS(2).fieldName = /*new value*/alpha * RATE(0, fieldName) + /*old value*/(1-alpha) * STATS(2).fieldName; \
-STATS(3).fieldName = /*new value*/alpha * RATE(1, fieldName) / 1024.0 + /*old value*/(1-alpha) * STATS(3).fieldName; \
- \
- os << time.ToDouble (Time::S) << "\t" \
- << m_node << "\t" \
- << interface << "\t" \
- << printName << "\t" \
- << STATS(2).fieldName << "\t" \
- << STATS(3).fieldName << "\t" \
- << STATS(0).fieldName << "\t" \
- << STATS(1).fieldName / 1024.0 << "\n";
+#define PRINTER(printName, fieldName, interface) \
+ STATS(2).fieldName = \
+ /*new value*/ alpha * RATE(0, fieldName) + /*old value*/ (1 - alpha) * STATS(2).fieldName; \
+ STATS(3).fieldName = /*new value*/ alpha * RATE(1, fieldName) / 1024.0 \
+ + /*old value*/ (1 - alpha) * STATS(3).fieldName; \
+ \
+ os << time.ToDouble(Time::S) << "\t" << m_node << "\t" << interface << "\t" << printName << "\t" \
+ << STATS(2).fieldName << "\t" << STATS(3).fieldName << "\t" << STATS(0).fieldName << "\t" \
+ << STATS(1).fieldName / 1024.0 << "\n";
void
-L2RateTracer::Print (std::ostream &os) const
+L2RateTracer::Print(std::ostream& os) const
{
- Time time = Simulator::Now ();
+ Time time = Simulator::Now();
- PRINTER ("Drop", m_drop, "combined");
+ PRINTER("Drop", m_drop, "combined");
}
void
-L2RateTracer::Drop (Ptr<const Packet> packet)
+L2RateTracer::Drop(Ptr<const Packet> packet)
{
// no interface information... this should be part of this L2Tracer object data
- m_stats.get<0> ().m_drop ++;
- m_stats.get<1> ().m_drop += packet->GetSize ();
+ m_stats.get<0>().m_drop++;
+ m_stats.get<1>().m_drop += packet->GetSize();
}
} // namespace ns3
diff --git a/utils/tracers/l2-rate-tracer.hpp b/utils/tracers/l2-rate-tracer.hpp
index 275b213..79f16c4 100644
--- a/utils/tracers/l2-rate-tracer.hpp
+++ b/utils/tracers/l2-rate-tracer.hpp
@@ -38,28 +38,29 @@
*
* @todo Finish implementation
*/
-class L2RateTracer : public L2Tracer
-{
+class L2RateTracer : public L2Tracer {
public:
/**
* @brief Network layer tracer constructor
*/
- L2RateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
- virtual ~L2RateTracer ();
+ L2RateTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node);
+ virtual ~L2RateTracer();
/**
* @brief Helper method to install tracers on all simulation nodes
*
* @param file File to which traces will be written
* @param averagingPeriod Defines averaging period for the rate calculation,
- * as well as how often data will be written into the trace file (default, every half second)
+ * as well as how often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
+ InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Explicit request to remove all statically created tracers
@@ -68,26 +69,26 @@
* or if it is desired to do a postprocessing of the resulting data
*/
static void
- Destroy ();
+ Destroy();
void
- SetAveragingPeriod (const Time &period);
+ SetAveragingPeriod(const Time& period);
virtual void
- PrintHeader (std::ostream &os) const;
+ PrintHeader(std::ostream& os) const;
virtual void
- Print (std::ostream &os) const;
+ Print(std::ostream& os) const;
virtual void
- Drop (Ptr<const Packet>);
+ Drop(Ptr<const Packet>);
private:
void
- PeriodicPrinter ();
+ PeriodicPrinter();
void
- Reset ();
+ Reset();
private:
boost::shared_ptr<std::ostream> m_os;
diff --git a/utils/tracers/l2-tracer.cpp b/utils/tracers/l2-tracer.cpp
index 631db7c..bf1fcf1 100644
--- a/utils/tracers/l2-tracer.cpp
+++ b/utils/tracers/l2-tracer.cpp
@@ -32,31 +32,29 @@
namespace ns3 {
-L2Tracer::L2Tracer (Ptr<Node> node)
-: m_nodePtr (node)
+L2Tracer::L2Tracer(Ptr<Node> node)
+ : m_nodePtr(node)
{
- m_node = boost::lexical_cast<string> (m_nodePtr->GetId ());
+ m_node = boost::lexical_cast<string>(m_nodePtr->GetId());
- Connect ();
+ Connect();
- string name = Names::FindName (node);
- if (!name.empty ())
- {
- m_node = name;
- }
+ string name = Names::FindName(node);
+ if (!name.empty()) {
+ m_node = name;
+ }
}
void
-L2Tracer::Connect ()
+L2Tracer::Connect()
{
- for (uint32_t devId = 0; devId < m_nodePtr->GetNDevices (); devId ++)
- {
- Ptr<PointToPointNetDevice> p2pnd = DynamicCast<PointToPointNetDevice> (m_nodePtr->GetDevice (devId));
- if (p2pnd)
- {
- p2pnd->GetQueue ()->TraceConnectWithoutContext ("Drop", MakeCallback (&L2Tracer::Drop, this));
- }
+ for (uint32_t devId = 0; devId < m_nodePtr->GetNDevices(); devId++) {
+ Ptr<PointToPointNetDevice> p2pnd =
+ DynamicCast<PointToPointNetDevice>(m_nodePtr->GetDevice(devId));
+ if (p2pnd) {
+ p2pnd->GetQueue()->TraceConnectWithoutContext("Drop", MakeCallback(&L2Tracer::Drop, this));
}
+ }
}
} // namespace ns3
diff --git a/utils/tracers/l2-tracer.hpp b/utils/tracers/l2-tracer.hpp
index e6378b5..a2cd3a6 100644
--- a/utils/tracers/l2-tracer.hpp
+++ b/utils/tracers/l2-tracer.hpp
@@ -35,23 +35,22 @@
*
* @todo Finish implementation
*/
-class L2Tracer : public SimpleRefCount<L2Tracer>
-{
+class L2Tracer : public SimpleRefCount<L2Tracer> {
public:
- L2Tracer (Ptr<Node> node);
- virtual ~L2Tracer () { };
+ L2Tracer(Ptr<Node> node);
+ virtual ~L2Tracer(){};
void
- Connect ();
+ Connect();
virtual void
- PrintHeader (std::ostream &os) const = 0;
+ PrintHeader(std::ostream& os) const = 0;
virtual void
- Print (std::ostream &os) const = 0;
+ Print(std::ostream& os) const = 0;
virtual void
- Drop (Ptr<const Packet>) = 0;
+ Drop(Ptr<const Packet>) = 0;
// Rx/Tx is NetDevice specific
// please refer to pyviz.cc in order to extend this tracer
@@ -60,9 +59,9 @@
std::string m_node;
Ptr<Node> m_nodePtr;
- struct Stats
- {
- void Reset ()
+ struct Stats {
+ void
+ Reset()
{
m_in = 0;
m_out = 0;
@@ -76,12 +75,12 @@
};
inline std::ostream&
-operator << (std::ostream &os, const L2Tracer &tracer)
+operator<<(std::ostream& os, const L2Tracer& tracer)
{
os << "# ";
- tracer.PrintHeader (os);
+ tracer.PrintHeader(os);
os << "\n";
- tracer.Print (os);
+ tracer.Print(os);
return os;
}
diff --git a/utils/tracers/ndn-app-delay-tracer.cpp b/utils/tracers/ndn-app-delay-tracer.cpp
index 01a5af4..666f945 100644
--- a/utils/tracers/ndn-app-delay-tracer.cpp
+++ b/utils/tracers/ndn-app-delay-tracer.cpp
@@ -37,162 +37,143 @@
#include <fstream>
-NS_LOG_COMPONENT_DEFINE ("ndn.AppDelayTracer");
+NS_LOG_COMPONENT_DEFINE("ndn.AppDelayTracer");
using namespace std;
namespace ns3 {
namespace ndn {
-static std::list< boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<AppDelayTracer> > > > g_tracers;
+static std::list<boost::tuple<boost::shared_ptr<std::ostream>, std::list<Ptr<AppDelayTracer>>>>
+ g_tracers;
template<class T>
static inline void
-NullDeleter (T *ptr)
+NullDeleter(T* ptr)
{
}
void
-AppDelayTracer::Destroy ()
+AppDelayTracer::Destroy()
{
- g_tracers.clear ();
+ g_tracers.clear();
}
void
-AppDelayTracer::InstallAll (const std::string &file)
+AppDelayTracer::InstallAll(const std::string& file)
{
using namespace boost;
using namespace std;
- std::list<Ptr<AppDelayTracer> > tracers;
+ std::list<Ptr<AppDelayTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeList::Iterator node = NodeList::Begin ();
- node != NodeList::End ();
- node++)
- {
- Ptr<AppDelayTracer> trace = Install (*node, outputStream);
- tracers.push_back (trace);
- }
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++) {
+ Ptr<AppDelayTracer> trace = Install(*node, outputStream);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
void
-AppDelayTracer::Install (const NodeContainer &nodes, const std::string &file)
+AppDelayTracer::Install(const NodeContainer& nodes, const std::string& file)
{
using namespace boost;
using namespace std;
- std::list<Ptr<AppDelayTracer> > tracers;
+ std::list<Ptr<AppDelayTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeContainer::Iterator node = nodes.Begin ();
- node != nodes.End ();
- node++)
- {
- Ptr<AppDelayTracer> trace = Install (*node, outputStream);
- tracers.push_back (trace);
- }
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeContainer::Iterator node = nodes.Begin(); node != nodes.End(); node++) {
+ Ptr<AppDelayTracer> trace = Install(*node, outputStream);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
void
-AppDelayTracer::Install (Ptr<Node> node, const std::string &file)
+AppDelayTracer::Install(Ptr<Node> node, const std::string& file)
{
using namespace boost;
using namespace std;
- std::list<Ptr<AppDelayTracer> > tracers;
+ std::list<Ptr<AppDelayTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- Ptr<AppDelayTracer> trace = Install (node, outputStream);
- tracers.push_back (trace);
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ Ptr<AppDelayTracer> trace = Install(node, outputStream);
+ tracers.push_back(trace);
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
-
Ptr<AppDelayTracer>
-AppDelayTracer::Install (Ptr<Node> node,
- boost::shared_ptr<std::ostream> outputStream)
+AppDelayTracer::Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream)
{
- NS_LOG_DEBUG ("Node: " << node->GetId ());
+ NS_LOG_DEBUG("Node: " << node->GetId());
- Ptr<AppDelayTracer> trace = Create<AppDelayTracer> (outputStream, node);
+ Ptr<AppDelayTracer> trace = Create<AppDelayTracer>(outputStream, node);
return trace;
}
@@ -201,86 +182,86 @@
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-AppDelayTracer::AppDelayTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node)
-: m_nodePtr (node)
-, m_os (os)
+AppDelayTracer::AppDelayTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node)
+ : m_nodePtr(node)
+ , m_os(os)
{
- m_node = boost::lexical_cast<string> (m_nodePtr->GetId ());
+ m_node = boost::lexical_cast<string>(m_nodePtr->GetId());
- Connect ();
+ Connect();
- string name = Names::FindName (node);
- if (!name.empty ())
- {
- m_node = name;
- }
+ string name = Names::FindName(node);
+ if (!name.empty()) {
+ m_node = name;
+ }
}
-AppDelayTracer::AppDelayTracer (boost::shared_ptr<std::ostream> os, const std::string &node)
-: m_node (node)
-, m_os (os)
+AppDelayTracer::AppDelayTracer(boost::shared_ptr<std::ostream> os, const std::string& node)
+ : m_node(node)
+ , m_os(os)
{
- Connect ();
+ Connect();
}
-AppDelayTracer::~AppDelayTracer ()
-{
-};
-
+AppDelayTracer::~AppDelayTracer(){};
void
-AppDelayTracer::Connect ()
+AppDelayTracer::Connect()
{
- Config::ConnectWithoutContext ("/NodeList/"+m_node+"/ApplicationList/*/LastRetransmittedInterestDataDelay",
- MakeCallback (&AppDelayTracer::LastRetransmittedInterestDataDelay, this));
+ Config::ConnectWithoutContext("/NodeList/" + m_node
+ + "/ApplicationList/*/LastRetransmittedInterestDataDelay",
+ MakeCallback(&AppDelayTracer::LastRetransmittedInterestDataDelay,
+ this));
- Config::ConnectWithoutContext ("/NodeList/"+m_node+"/ApplicationList/*/FirstInterestDataDelay",
- MakeCallback (&AppDelayTracer::FirstInterestDataDelay, this));
+ Config::ConnectWithoutContext("/NodeList/" + m_node + "/ApplicationList/*/FirstInterestDataDelay",
+ MakeCallback(&AppDelayTracer::FirstInterestDataDelay, this));
}
void
-AppDelayTracer::PrintHeader (std::ostream &os) const
+AppDelayTracer::PrintHeader(std::ostream& os) const
{
- os << "Time" << "\t"
- << "Node" << "\t"
- << "AppId" << "\t"
- << "SeqNo" << "\t"
+ os << "Time"
+ << "\t"
+ << "Node"
+ << "\t"
+ << "AppId"
+ << "\t"
+ << "SeqNo"
+ << "\t"
- << "Type" << "\t"
- << "DelayS" << "\t"
- << "DelayUS" << "\t"
- << "RetxCount" << "\t"
- << "HopCount" << "";
+ << "Type"
+ << "\t"
+ << "DelayS"
+ << "\t"
+ << "DelayUS"
+ << "\t"
+ << "RetxCount"
+ << "\t"
+ << "HopCount"
+ << "";
}
void
-AppDelayTracer::LastRetransmittedInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, int32_t hopCount)
+AppDelayTracer::LastRetransmittedInterestDataDelay(Ptr<App> app, uint32_t seqno, Time delay,
+ int32_t hopCount)
{
- *m_os << Simulator::Now ().ToDouble (Time::S) << "\t"
- << m_node << "\t"
- << app->GetId () << "\t"
+ *m_os << Simulator::Now().ToDouble(Time::S) << "\t" << m_node << "\t" << app->GetId() << "\t"
<< seqno << "\t"
- << "LastDelay" << "\t"
- << delay.ToDouble (Time::S) << "\t"
- << delay.ToDouble (Time::US) << "\t"
- << 1 << "\t"
+ << "LastDelay"
+ << "\t" << delay.ToDouble(Time::S) << "\t" << delay.ToDouble(Time::US) << "\t" << 1 << "\t"
<< hopCount << "\n";
}
void
-AppDelayTracer::FirstInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, uint32_t retxCount, int32_t hopCount)
+AppDelayTracer::FirstInterestDataDelay(Ptr<App> app, uint32_t seqno, Time delay, uint32_t retxCount,
+ int32_t hopCount)
{
- *m_os << Simulator::Now ().ToDouble (Time::S) << "\t"
- << m_node << "\t"
- << app->GetId () << "\t"
+ *m_os << Simulator::Now().ToDouble(Time::S) << "\t" << m_node << "\t" << app->GetId() << "\t"
<< seqno << "\t"
- << "FullDelay" << "\t"
- << delay.ToDouble (Time::S) << "\t"
- << delay.ToDouble (Time::US) << "\t"
- << retxCount << "\t"
- << hopCount << "\n";
+ << "FullDelay"
+ << "\t" << delay.ToDouble(Time::S) << "\t" << delay.ToDouble(Time::US) << "\t" << retxCount
+ << "\t" << hopCount << "\n";
}
-
} // namespace ndn
} // namespace ns3
diff --git a/utils/tracers/ndn-app-delay-tracer.hpp b/utils/tracers/ndn-app-delay-tracer.hpp
index d911fc9..64b695a 100644
--- a/utils/tracers/ndn-app-delay-tracer.hpp
+++ b/utils/tracers/ndn-app-delay-tracer.hpp
@@ -44,20 +44,20 @@
* @ingroup ndn-tracers
* @brief Tracer to obtain application-level delays
*/
-class AppDelayTracer : public SimpleRefCount<AppDelayTracer>
-{
+class AppDelayTracer : public SimpleRefCount<AppDelayTracer> {
public:
/**
* @brief Helper method to install tracers on all simulation nodes
*
* @param file File to which traces will be written. If filename is -, then std::out is used
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
- *
+ *
*/
static void
- InstallAll (const std::string &file);
+ InstallAll(const std::string& file);
/**
* @brief Helper method to install tracers on the selected simulation nodes
@@ -65,39 +65,44 @@
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (const NodeContainer &nodes, const std::string &file);
+ Install(const NodeContainer& nodes, const std::string& file);
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (Ptr<Node> node, const std::string &file);
+ Install(Ptr<Node> node, const std::string& file);
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param outputStream Smart pointer to a stream
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*/
static Ptr<AppDelayTracer>
- Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream);
+ Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream);
/**
* @brief Explicit request to remove all statically created tracers
@@ -106,26 +111,26 @@
* or if it is desired to do a postprocessing of the resulting data
*/
static void
- Destroy ();
-
+ Destroy();
+
/**
* @brief Trace constructor that attaches to all applications on the node using node's pointer
* @param os reference to the output stream
* @param node pointer to the node
*/
- AppDelayTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
+ AppDelayTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node);
/**
* @brief Trace constructor that attaches to all applications on the node using node's name
* @param os reference to the output stream
* @param nodeName name of the node registered using Names::Add
*/
- AppDelayTracer (boost::shared_ptr<std::ostream> os, const std::string &node);
+ AppDelayTracer(boost::shared_ptr<std::ostream> os, const std::string& node);
/**
* @brief Destructor
*/
- ~AppDelayTracer ();
+ ~AppDelayTracer();
/**
* @brief Print head of the trace (e.g., for post-processing)
@@ -133,18 +138,19 @@
* @param os reference to output stream
*/
void
- PrintHeader (std::ostream &os) const;
-
+ PrintHeader(std::ostream& os) const;
+
private:
void
- Connect ();
+ Connect();
- void
- LastRetransmittedInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, int32_t hopCount);
-
- void
- FirstInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, uint32_t rextCount, int32_t hopCount);
-
+ void
+ LastRetransmittedInterestDataDelay(Ptr<App> app, uint32_t seqno, Time delay, int32_t hopCount);
+
+ void
+ FirstInterestDataDelay(Ptr<App> app, uint32_t seqno, Time delay, uint32_t rextCount,
+ int32_t hopCount);
+
private:
std::string m_node;
Ptr<Node> m_nodePtr;
diff --git a/utils/tracers/ndn-cs-tracer.cpp b/utils/tracers/ndn-cs-tracer.cpp
index 74fa3dd..bc5d8de 100644
--- a/utils/tracers/ndn-cs-tracer.cpp
+++ b/utils/tracers/ndn-cs-tracer.cpp
@@ -38,164 +38,146 @@
#include <fstream>
-NS_LOG_COMPONENT_DEFINE ("ndn.CsTracer");
+NS_LOG_COMPONENT_DEFINE("ndn.CsTracer");
using namespace std;
namespace ns3 {
namespace ndn {
-static std::list< boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<CsTracer> > > > g_tracers;
+static std::list<boost::tuple<boost::shared_ptr<std::ostream>, std::list<Ptr<CsTracer>>>> g_tracers;
template<class T>
static inline void
-NullDeleter (T *ptr)
+NullDeleter(T* ptr)
{
}
void
-CsTracer::Destroy ()
+CsTracer::Destroy()
{
- g_tracers.clear ();
+ g_tracers.clear();
}
void
-CsTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
-{
- using namespace boost;
- using namespace std;
-
- std::list<Ptr<CsTracer> > tracers;
- boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
-
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
- }
-
- for (NodeList::Iterator node = NodeList::Begin ();
- node != NodeList::End ();
- node++)
- {
- Ptr<CsTracer> trace = Install (*node, outputStream, averagingPeriod);
- tracers.push_back (trace);
- }
-
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
-
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
-}
-
-void
-CsTracer::Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+CsTracer::InstallAll(const std::string& file, Time averagingPeriod /* = Seconds (0.5)*/)
{
using namespace boost;
using namespace std;
- std::list<Ptr<CsTracer> > tracers;
+ std::list<Ptr<CsTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeContainer::Iterator node = nodes.Begin ();
- node != nodes.End ();
- node++)
- {
- Ptr<CsTracer> trace = Install (*node, outputStream, averagingPeriod);
- tracers.push_back (trace);
- }
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++) {
+ Ptr<CsTracer> trace = Install(*node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
void
-CsTracer::Install (Ptr<Node> node, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+CsTracer::Install(const NodeContainer& nodes, const std::string& file,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
using namespace boost;
using namespace std;
- std::list<Ptr<CsTracer> > tracers;
+ std::list<Ptr<CsTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- Ptr<CsTracer> trace = Install (node, outputStream, averagingPeriod);
- tracers.push_back (trace);
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeContainer::Iterator node = nodes.Begin(); node != nodes.End(); node++) {
+ Ptr<CsTracer> trace = Install(*node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
+void
+CsTracer::Install(Ptr<Node> node, const std::string& file,
+ Time averagingPeriod /* = Seconds (0.5)*/)
+{
+ using namespace boost;
+ using namespace std;
+
+ std::list<Ptr<CsTracer>> tracers;
+ boost::shared_ptr<std::ostream> outputStream;
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
+
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
+ }
+
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
+
+ Ptr<CsTracer> trace = Install(node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
+
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
+}
Ptr<CsTracer>
-CsTracer::Install (Ptr<Node> node,
- boost::shared_ptr<std::ostream> outputStream,
- Time averagingPeriod/* = Seconds (0.5)*/)
+CsTracer::Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
- NS_LOG_DEBUG ("Node: " << node->GetId ());
+ NS_LOG_DEBUG("Node: " << node->GetId());
- Ptr<CsTracer> trace = Create<CsTracer> (outputStream, node);
- trace->SetAveragingPeriod (averagingPeriod);
+ Ptr<CsTracer> trace = Create<CsTracer>(outputStream, node);
+ trace->SetAveragingPeriod(averagingPeriod);
return trace;
}
@@ -204,106 +186,101 @@
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-CsTracer::CsTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node)
-: m_nodePtr (node)
-, m_os (os)
+CsTracer::CsTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node)
+ : m_nodePtr(node)
+ , m_os(os)
{
- m_node = boost::lexical_cast<string> (m_nodePtr->GetId ());
+ m_node = boost::lexical_cast<string>(m_nodePtr->GetId());
- Connect ();
+ Connect();
- string name = Names::FindName (node);
- if (!name.empty ())
- {
- m_node = name;
- }
+ string name = Names::FindName(node);
+ if (!name.empty()) {
+ m_node = name;
+ }
}
-CsTracer::CsTracer (boost::shared_ptr<std::ostream> os, const std::string &node)
-: m_node (node)
-, m_os (os)
+CsTracer::CsTracer(boost::shared_ptr<std::ostream> os, const std::string& node)
+ : m_node(node)
+ , m_os(os)
{
- Connect ();
+ Connect();
}
-CsTracer::~CsTracer ()
-{
-};
-
+CsTracer::~CsTracer(){};
void
-CsTracer::Connect ()
+CsTracer::Connect()
{
- Ptr<ContentStore> cs = m_nodePtr->GetObject<ContentStore> ();
- cs->TraceConnectWithoutContext ("CacheHits", MakeCallback (&CsTracer::CacheHits, this));
- cs->TraceConnectWithoutContext ("CacheMisses", MakeCallback (&CsTracer::CacheMisses, this));
+ Ptr<ContentStore> cs = m_nodePtr->GetObject<ContentStore>();
+ cs->TraceConnectWithoutContext("CacheHits", MakeCallback(&CsTracer::CacheHits, this));
+ cs->TraceConnectWithoutContext("CacheMisses", MakeCallback(&CsTracer::CacheMisses, this));
- Reset ();
+ Reset();
}
-
void
-CsTracer::SetAveragingPeriod (const Time &period)
+CsTracer::SetAveragingPeriod(const Time& period)
{
m_period = period;
- m_printEvent.Cancel ();
- m_printEvent = Simulator::Schedule (m_period, &CsTracer::PeriodicPrinter, this);
+ m_printEvent.Cancel();
+ m_printEvent = Simulator::Schedule(m_period, &CsTracer::PeriodicPrinter, this);
}
void
-CsTracer::PeriodicPrinter ()
+CsTracer::PeriodicPrinter()
{
- Print (*m_os);
- Reset ();
-
- m_printEvent = Simulator::Schedule (m_period, &CsTracer::PeriodicPrinter, this);
+ Print(*m_os);
+ Reset();
+
+ m_printEvent = Simulator::Schedule(m_period, &CsTracer::PeriodicPrinter, this);
}
void
-CsTracer::PrintHeader (std::ostream &os) const
+CsTracer::PrintHeader(std::ostream& os) const
{
- os << "Time" << "\t"
+ os << "Time"
+ << "\t"
- << "Node" << "\t"
+ << "Node"
+ << "\t"
- << "Type" << "\t"
- << "Packets" << "\t";
+ << "Type"
+ << "\t"
+ << "Packets"
+ << "\t";
}
void
-CsTracer::Reset ()
+CsTracer::Reset()
{
m_stats.Reset();
}
-#define PRINTER(printName, fieldName) \
- os << time.ToDouble (Time::S) << "\t" \
- << m_node << "\t" \
- << printName << "\t" \
- << m_stats.fieldName << "\n";
-
+#define PRINTER(printName, fieldName) \
+ os << time.ToDouble(Time::S) << "\t" << m_node << "\t" << printName << "\t" << m_stats.fieldName \
+ << "\n";
void
-CsTracer::Print (std::ostream &os) const
+CsTracer::Print(std::ostream& os) const
{
- Time time = Simulator::Now ();
+ Time time = Simulator::Now();
- PRINTER ("CacheHits", m_cacheHits);
- PRINTER ("CacheMisses", m_cacheMisses);
+ PRINTER("CacheHits", m_cacheHits);
+ PRINTER("CacheMisses", m_cacheMisses);
}
-void
-CsTracer::CacheHits (Ptr<const Interest>, Ptr<const Data>)
+void
+CsTracer::CacheHits(Ptr<const Interest>, Ptr<const Data>)
{
- m_stats.m_cacheHits ++;
+ m_stats.m_cacheHits++;
}
-void
-CsTracer::CacheMisses (Ptr<const Interest>)
+void
+CsTracer::CacheMisses(Ptr<const Interest>)
{
- m_stats.m_cacheMisses ++;
+ m_stats.m_cacheMisses++;
}
-
} // namespace ndn
} // namespace ns3
diff --git a/utils/tracers/ndn-cs-tracer.hpp b/utils/tracers/ndn-cs-tracer.hpp
index eb07585..939df9b 100644
--- a/utils/tracers/ndn-cs-tracer.hpp
+++ b/utils/tracers/ndn-cs-tracer.hpp
@@ -49,80 +49,87 @@
namespace cs {
/// @cond include_hidden
-struct Stats
-{
- inline void Reset ()
+struct Stats {
+ inline void
+ Reset()
{
- m_cacheHits = 0;
+ m_cacheHits = 0;
m_cacheMisses = 0;
}
double m_cacheHits;
double m_cacheMisses;
};
/// @endcond
-
-}
+}
/**
* @ingroup ndn-tracers
* @brief NDN tracer for cache performance (hits and misses)
*/
-class CsTracer : public SimpleRefCount<CsTracer>
-{
+class CsTracer : public SimpleRefCount<CsTracer> {
public:
/**
* @brief Helper method to install tracers on all simulation nodes
*
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
- *
+ *
*/
static void
- InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
+ InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on the selected simulation nodes
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(const NodeContainer& nodes, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (Ptr<Node> node, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(Ptr<Node> node, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param outputStream Smart pointer to a stream
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*/
static Ptr<CsTracer>
- Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream, Time averagingPeriod = Seconds (0.5));
+ Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+ Time averagingPeriod = Seconds(0.5));
/**
* @brief Explicit request to remove all statically created tracers
@@ -131,26 +138,26 @@
* or if it is desired to do a postprocessing of the resulting data
*/
static void
- Destroy ();
-
+ Destroy();
+
/**
* @brief Trace constructor that attaches to the node using node pointer
* @param os reference to the output stream
* @param node pointer to the node
*/
- CsTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
+ CsTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node);
/**
* @brief Trace constructor that attaches to the node using node name
* @param os reference to the output stream
* @param nodeName name of the node registered using Names::Add
*/
- CsTracer (boost::shared_ptr<std::ostream> os, const std::string &node);
+ CsTracer(boost::shared_ptr<std::ostream> os, const std::string& node);
/**
* @brief Destructor
*/
- ~CsTracer ();
+ ~CsTracer();
/**
* @brief Print head of the trace (e.g., for post-processing)
@@ -158,7 +165,7 @@
* @param os reference to output stream
*/
void
- PrintHeader (std::ostream &os) const;
+ PrintHeader(std::ostream& os) const;
/**
* @brief Print current trace data
@@ -166,28 +173,28 @@
* @param os reference to output stream
*/
void
- Print (std::ostream &os) const;
-
-private:
- void
- Connect ();
-
- void
- CacheHits (Ptr<const Interest>, Ptr<const Data>);
-
- void
- CacheMisses (Ptr<const Interest>);
+ Print(std::ostream& os) const;
private:
void
- SetAveragingPeriod (const Time &period);
+ Connect();
void
- Reset ();
+ CacheHits(Ptr<const Interest>, Ptr<const Data>);
void
- PeriodicPrinter ();
-
+ CacheMisses(Ptr<const Interest>);
+
+private:
+ void
+ SetAveragingPeriod(const Time& period);
+
+ void
+ Reset();
+
+ void
+ PeriodicPrinter();
+
private:
std::string m_node;
Ptr<Node> m_nodePtr;
@@ -196,19 +203,19 @@
Time m_period;
EventId m_printEvent;
- cs::Stats m_stats;
+ cs::Stats m_stats;
};
/**
* @brief Helper to dump the trace to an output stream
*/
inline std::ostream&
-operator << (std::ostream &os, const CsTracer &tracer)
+operator<<(std::ostream& os, const CsTracer& tracer)
{
os << "# ";
- tracer.PrintHeader (os);
+ tracer.PrintHeader(os);
os << "\n";
- tracer.Print (os);
+ tracer.Print(os);
return os;
}
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.cpp b/utils/tracers/ndn-l3-aggregate-tracer.cpp
index 556a792..d9fc671 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.cpp
+++ b/utils/tracers/ndn-l3-aggregate-tracer.cpp
@@ -36,388 +36,349 @@
#include <fstream>
-NS_LOG_COMPONENT_DEFINE ("ndn.L3AggregateTracer");
+NS_LOG_COMPONENT_DEFINE("ndn.L3AggregateTracer");
namespace ns3 {
namespace ndn {
-static std::list< boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<L3AggregateTracer> > > > g_tracers;
+static std::list<boost::tuple<boost::shared_ptr<std::ostream>, std::list<Ptr<L3AggregateTracer>>>>
+ g_tracers;
template<class T>
static inline void
-NullDeleter (T *ptr)
+NullDeleter(T* ptr)
{
}
void
-L3AggregateTracer::Destroy ()
+L3AggregateTracer::Destroy()
{
- g_tracers.clear ();
+ g_tracers.clear();
}
void
-L3AggregateTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+L3AggregateTracer::InstallAll(const std::string& file, Time averagingPeriod /* = Seconds (0.5)*/)
{
using namespace boost;
using namespace std;
- std::list<Ptr<L3AggregateTracer> > tracers;
+ std::list<Ptr<L3AggregateTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeList::Iterator node = NodeList::Begin ();
- node != NodeList::End ();
- node++)
- {
- Ptr<L3AggregateTracer> trace = Install (*node, outputStream, averagingPeriod);
- tracers.push_back (trace);
- }
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++) {
+ Ptr<L3AggregateTracer> trace = Install(*node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
void
-L3AggregateTracer::Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+L3AggregateTracer::Install(const NodeContainer& nodes, const std::string& file,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
using namespace boost;
using namespace std;
- std::list<Ptr<L3AggregateTracer> > tracers;
+ std::list<Ptr<L3AggregateTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeContainer::Iterator node = nodes.Begin ();
- node != nodes.End ();
- node++)
- {
- Ptr<L3AggregateTracer> trace = Install (*node, outputStream, averagingPeriod);
- tracers.push_back (trace);
- }
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeContainer::Iterator node = nodes.Begin(); node != nodes.End(); node++) {
+ Ptr<L3AggregateTracer> trace = Install(*node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
void
-L3AggregateTracer::Install (Ptr<Node> node, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+L3AggregateTracer::Install(Ptr<Node> node, const std::string& file,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
using namespace boost;
using namespace std;
- std::list<Ptr<L3AggregateTracer> > tracers;
+ std::list<Ptr<L3AggregateTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- Ptr<L3AggregateTracer> trace = Install (node, outputStream, averagingPeriod);
- tracers.push_back (trace);
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ Ptr<L3AggregateTracer> trace = Install(node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
-
Ptr<L3AggregateTracer>
-L3AggregateTracer::Install (Ptr<Node> node,
- boost::shared_ptr<std::ostream> outputStream,
- Time averagingPeriod/* = Seconds (0.5)*/)
+L3AggregateTracer::Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
- NS_LOG_DEBUG ("Node: " << node->GetId ());
+ NS_LOG_DEBUG("Node: " << node->GetId());
- Ptr<L3AggregateTracer> trace = Create<L3AggregateTracer> (outputStream, node);
- trace->SetAveragingPeriod (averagingPeriod);
+ Ptr<L3AggregateTracer> trace = Create<L3AggregateTracer>(outputStream, node);
+ trace->SetAveragingPeriod(averagingPeriod);
return trace;
}
-L3AggregateTracer::L3AggregateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node)
- : L3Tracer (node)
- , m_os (os)
+L3AggregateTracer::L3AggregateTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node)
+ : L3Tracer(node)
+ , m_os(os)
{
- Reset ();
+ Reset();
}
-L3AggregateTracer::L3AggregateTracer (boost::shared_ptr<std::ostream> os, const std::string &node)
- : L3Tracer (node)
- , m_os (os)
+L3AggregateTracer::L3AggregateTracer(boost::shared_ptr<std::ostream> os, const std::string& node)
+ : L3Tracer(node)
+ , m_os(os)
{
- Reset ();
+ Reset();
}
-L3AggregateTracer::~L3AggregateTracer ()
-{
-};
+L3AggregateTracer::~L3AggregateTracer(){};
void
-L3AggregateTracer::SetAveragingPeriod (const Time &period)
+L3AggregateTracer::SetAveragingPeriod(const Time& period)
{
m_period = period;
- m_printEvent.Cancel ();
- m_printEvent = Simulator::Schedule (m_period, &L3AggregateTracer::PeriodicPrinter, this);
+ m_printEvent.Cancel();
+ m_printEvent = Simulator::Schedule(m_period, &L3AggregateTracer::PeriodicPrinter, this);
}
void
-L3AggregateTracer::PeriodicPrinter ()
+L3AggregateTracer::PeriodicPrinter()
{
- Print (*m_os);
- Reset ();
+ Print(*m_os);
+ Reset();
- m_printEvent = Simulator::Schedule (m_period, &L3AggregateTracer::PeriodicPrinter, this);
+ m_printEvent = Simulator::Schedule(m_period, &L3AggregateTracer::PeriodicPrinter, this);
}
void
-L3AggregateTracer::PrintHeader (std::ostream &os) const
+L3AggregateTracer::PrintHeader(std::ostream& os) const
{
- os << "Time" << "\t"
+ os << "Time"
+ << "\t"
- << "Node" << "\t"
- << "FaceId" << "\t"
- << "FaceDescr" << "\t"
+ << "Node"
+ << "\t"
+ << "FaceId"
+ << "\t"
+ << "FaceDescr"
+ << "\t"
- << "Type" << "\t"
- << "Packets" << "\t"
+ << "Type"
+ << "\t"
+ << "Packets"
+ << "\t"
<< "Kilobytes";
}
void
-L3AggregateTracer::Reset ()
+L3AggregateTracer::Reset()
{
- for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats> >::iterator stats = m_stats.begin ();
- stats != m_stats.end ();
- stats++)
- {
- stats->second.get<0> ().Reset ();
- stats->second.get<1> ().Reset ();
- }
+ for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats>>::iterator stats = m_stats.begin();
+ stats != m_stats.end(); stats++) {
+ stats->second.get<0>().Reset();
+ stats->second.get<1>().Reset();
+ }
}
+#define STATS(INDEX) stats->second.get<INDEX>()
-#define STATS(INDEX) stats->second.get<INDEX> ()
-
-#define PRINTER(printName, fieldName) \
- os << time.ToDouble (Time::S) << "\t" \
- << m_node << "\t"; \
- if (stats->first) \
- { \
- os \
- << stats->first->GetId () << "\t" \
- << *stats->first << "\t"; \
- } \
- else \
- { \
- os << "-1\tall\t"; \
- } \
- os \
- << printName << "\t" \
- << STATS(0).fieldName << "\t" \
- << STATS(1).fieldName / 1024.0 << "\n";
-
+#define PRINTER(printName, fieldName) \
+ os << time.ToDouble(Time::S) << "\t" << m_node << "\t"; \
+ if (stats->first) { \
+ os << stats->first->GetId() << "\t" << *stats->first << "\t"; \
+ } \
+ else { \
+ os << "-1\tall\t"; \
+ } \
+ os << printName << "\t" << STATS(0).fieldName << "\t" << STATS(1).fieldName / 1024.0 << "\n";
void
-L3AggregateTracer::Print (std::ostream &os) const
+L3AggregateTracer::Print(std::ostream& os) const
{
- Time time = Simulator::Now ();
+ Time time = Simulator::Now();
- for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats> >::iterator stats = m_stats.begin ();
- stats != m_stats.end ();
- stats++)
- {
- if (!stats->first)
- continue;
+ for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats>>::iterator stats = m_stats.begin();
+ stats != m_stats.end(); stats++) {
+ if (!stats->first)
+ continue;
- PRINTER ("InInterests", m_inInterests);
- PRINTER ("OutInterests", m_outInterests);
- PRINTER ("DropInterests", m_dropInterests);
+ PRINTER("InInterests", m_inInterests);
+ PRINTER("OutInterests", m_outInterests);
+ PRINTER("DropInterests", m_dropInterests);
- PRINTER ("InNacks", m_inNacks);
- PRINTER ("OutNacks", m_outNacks);
- PRINTER ("DropNacks", m_dropNacks);
+ PRINTER("InNacks", m_inNacks);
+ PRINTER("OutNacks", m_outNacks);
+ PRINTER("DropNacks", m_dropNacks);
- PRINTER ("InData", m_inData);
- PRINTER ("OutData", m_outData);
- PRINTER ("DropData", m_dropData);
- }
+ PRINTER("InData", m_inData);
+ PRINTER("OutData", m_outData);
+ PRINTER("DropData", m_dropData);
+ }
{
- std::map<Ptr<const Face>, boost::tuple<Stats, Stats> >::iterator stats = m_stats.find (Ptr<const Face> (0));
- if (stats != m_stats.end ())
- {
- PRINTER ("SatisfiedInterests", m_satisfiedInterests);
- PRINTER ("TimedOutInterests", m_timedOutInterests);
- }
+ std::map<Ptr<const Face>, boost::tuple<Stats, Stats>>::iterator stats =
+ m_stats.find(Ptr<const Face>(0));
+ if (stats != m_stats.end()) {
+ PRINTER("SatisfiedInterests", m_satisfiedInterests);
+ PRINTER("TimedOutInterests", m_timedOutInterests);
+ }
}
}
void
-L3AggregateTracer::OutInterests (Ptr<const Interest> interest, Ptr<const Face> face)
+L3AggregateTracer::OutInterests(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_outInterests ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_outInterests += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_outInterests++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_outInterests += interest->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::InInterests (Ptr<const Interest> interest, Ptr<const Face> face)
+L3AggregateTracer::InInterests(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_inInterests ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_inInterests += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_inInterests++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_inInterests += interest->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::DropInterests (Ptr<const Interest> interest, Ptr<const Face> face)
+L3AggregateTracer::DropInterests(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_dropInterests ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_dropInterests += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_dropInterests++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_dropInterests += interest->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::OutNacks (Ptr<const Interest> nack, Ptr<const Face> face)
+L3AggregateTracer::OutNacks(Ptr<const Interest> nack, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_outNacks ++;
- if (nack->GetWire ())
- {
- m_stats[face].get<1> ().m_outNacks += nack->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_outNacks++;
+ if (nack->GetWire()) {
+ m_stats[face].get<1>().m_outNacks += nack->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::InNacks (Ptr<const Interest> nack, Ptr<const Face> face)
+L3AggregateTracer::InNacks(Ptr<const Interest> nack, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_inNacks ++;
- if (nack->GetWire ())
- {
- m_stats[face].get<1> ().m_inNacks += nack->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_inNacks++;
+ if (nack->GetWire()) {
+ m_stats[face].get<1>().m_inNacks += nack->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::DropNacks (Ptr<const Interest> nack, Ptr<const Face> face)
+L3AggregateTracer::DropNacks(Ptr<const Interest> nack, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_dropNacks ++;
- if (nack->GetWire ())
- {
- m_stats[face].get<1> ().m_dropNacks += nack->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_dropNacks++;
+ if (nack->GetWire()) {
+ m_stats[face].get<1>().m_dropNacks += nack->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::OutData (Ptr<const Data> data,
- bool fromCache, Ptr<const Face> face)
+L3AggregateTracer::OutData(Ptr<const Data> data, bool fromCache, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_outData ++;
- if (data->GetWire ())
- {
- m_stats[face].get<1> ().m_outData += data->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_outData++;
+ if (data->GetWire()) {
+ m_stats[face].get<1>().m_outData += data->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::InData (Ptr<const Data> data,
- Ptr<const Face> face)
+L3AggregateTracer::InData(Ptr<const Data> data, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_inData ++;
- if (data->GetWire ())
- {
- m_stats[face].get<1> ().m_inData += data->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_inData++;
+ if (data->GetWire()) {
+ m_stats[face].get<1>().m_inData += data->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::DropData (Ptr<const Data> data,
- Ptr<const Face> face)
+L3AggregateTracer::DropData(Ptr<const Data> data, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_dropData ++;
- if (data->GetWire ())
- {
- m_stats[face].get<1> ().m_dropData += data->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_dropData++;
+ if (data->GetWire()) {
+ m_stats[face].get<1>().m_dropData += data->GetWire()->GetSize();
+ }
}
void
-L3AggregateTracer::SatisfiedInterests (Ptr<const pit::Entry>)
+L3AggregateTracer::SatisfiedInterests(Ptr<const pit::Entry>)
{
- m_stats[0].get<0> ().m_satisfiedInterests ++;
+ m_stats[0].get<0>().m_satisfiedInterests++;
// no "size" stats
}
void
-L3AggregateTracer::TimedOutInterests (Ptr<const pit::Entry>)
+L3AggregateTracer::TimedOutInterests(Ptr<const pit::Entry>)
{
- m_stats[0].get<0> ().m_timedOutInterests ++;
+ m_stats[0].get<0>().m_timedOutInterests++;
// no "size" stats
}
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.hpp b/utils/tracers/ndn-l3-aggregate-tracer.hpp
index a94d2f5..bedfccc 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.hpp
+++ b/utils/tracers/ndn-l3-aggregate-tracer.hpp
@@ -39,49 +39,54 @@
* @ingroup ndn-tracers
* @brief NDN network-layer tracer for aggregate packet counts
*/
-class L3AggregateTracer : public L3Tracer
-{
+class L3AggregateTracer : public L3Tracer {
public:
/**
* @brief Helper method to install tracers on all simulation nodes
*
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
+ InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on the selected simulation nodes
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(const NodeContainer& nodes, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (Ptr<Node> node, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(Ptr<Node> node, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Explicit request to remove all statically created tracers
@@ -90,91 +95,93 @@
* or if it is desired to do a postprocessing of the resulting data
*/
static void
- Destroy ();
+ Destroy();
/**
* @brief Trace constructor that attaches to the node using node pointer
* @param os reference to the output stream
* @param node pointer to the node
*/
- L3AggregateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
+ L3AggregateTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node);
/**
* @brief Trace constructor that attaches to the node using node name
* @param os reference to the output stream
* @param nodeName name of the node registered using Names::Add
*/
- L3AggregateTracer (boost::shared_ptr<std::ostream> os, const std::string &nodeName);
+ L3AggregateTracer(boost::shared_ptr<std::ostream> os, const std::string& nodeName);
/**
* @brief Destructor
*/
- virtual ~L3AggregateTracer ();
+ virtual ~L3AggregateTracer();
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param outputStream Smart pointer to a stream
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*/
static Ptr<L3AggregateTracer>
- Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream, Time averagingPeriod = Seconds (0.5));
+ Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+ Time averagingPeriod = Seconds(0.5));
protected:
// from L3Tracer
virtual void
- PrintHeader (std::ostream &os) const;
+ PrintHeader(std::ostream& os) const;
virtual void
- Print (std::ostream &os) const;
+ Print(std::ostream& os) const;
virtual void
- OutInterests (Ptr<const Interest>, Ptr<const Face>);
+ OutInterests(Ptr<const Interest>, Ptr<const Face>);
virtual void
- InInterests (Ptr<const Interest>, Ptr<const Face>);
+ InInterests(Ptr<const Interest>, Ptr<const Face>);
virtual void
- DropInterests (Ptr<const Interest>, Ptr<const Face>);
+ DropInterests(Ptr<const Interest>, Ptr<const Face>);
virtual void
- OutNacks (Ptr<const Interest>, Ptr<const Face>);
+ OutNacks(Ptr<const Interest>, Ptr<const Face>);
virtual void
- InNacks (Ptr<const Interest>, Ptr<const Face>);
+ InNacks(Ptr<const Interest>, Ptr<const Face>);
virtual void
- DropNacks (Ptr<const Interest>, Ptr<const Face>);
+ DropNacks(Ptr<const Interest>, Ptr<const Face>);
virtual void
- OutData (Ptr<const Data>, bool fromCache, Ptr<const Face>);
+ OutData(Ptr<const Data>, bool fromCache, Ptr<const Face>);
virtual void
- InData (Ptr<const Data>, Ptr<const Face>);
+ InData(Ptr<const Data>, Ptr<const Face>);
virtual void
- DropData (Ptr<const Data>, Ptr<const Face>);
-
+ DropData(Ptr<const Data>, Ptr<const Face>);
virtual void
- SatisfiedInterests (Ptr<const pit::Entry>);
+ SatisfiedInterests(Ptr<const pit::Entry>);
virtual void
- TimedOutInterests (Ptr<const pit::Entry>);
+ TimedOutInterests(Ptr<const pit::Entry>);
protected:
void
- SetAveragingPeriod (const Time &period);
+ SetAveragingPeriod(const Time& period);
void
- Reset ();
+ Reset();
void
- PeriodicPrinter ();
+ PeriodicPrinter();
protected:
boost::shared_ptr<std::ostream> m_os;
@@ -182,7 +189,7 @@
Time m_period;
EventId m_printEvent;
- mutable std::map<Ptr<const Face>, boost::tuple<Stats, Stats> > m_stats;
+ mutable std::map<Ptr<const Face>, boost::tuple<Stats, Stats>> m_stats;
};
} // namespace ndn
diff --git a/utils/tracers/ndn-l3-rate-tracer.cpp b/utils/tracers/ndn-l3-rate-tracer.cpp
index ca80bef..38170bc 100644
--- a/utils/tracers/ndn-l3-rate-tracer.cpp
+++ b/utils/tracers/ndn-l3-rate-tracer.cpp
@@ -39,433 +39,392 @@
using namespace boost;
using namespace std;
-NS_LOG_COMPONENT_DEFINE ("ndn.L3RateTracer");
+NS_LOG_COMPONENT_DEFINE("ndn.L3RateTracer");
namespace ns3 {
namespace ndn {
-static std::list< boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<L3RateTracer> > > > g_tracers;
+static std::list<boost::tuple<boost::shared_ptr<std::ostream>, std::list<Ptr<L3RateTracer>>>>
+ g_tracers;
template<class T>
static inline void
-NullDeleter (T *ptr)
+NullDeleter(T* ptr)
{
}
void
-L3RateTracer::Destroy ()
+L3RateTracer::Destroy()
{
- g_tracers.clear ();
+ g_tracers.clear();
}
void
-L3RateTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+L3RateTracer::InstallAll(const std::string& file, Time averagingPeriod /* = Seconds (0.5)*/)
{
- std::list<Ptr<L3RateTracer> > tracers;
+ std::list<Ptr<L3RateTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeList::Iterator node = NodeList::Begin ();
- node != NodeList::End ();
- node++)
- {
- Ptr<L3RateTracer> trace = Install (*node, outputStream, averagingPeriod);
- tracers.push_back (trace);
- }
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++) {
+ Ptr<L3RateTracer> trace = Install(*node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
void
-L3RateTracer::Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+L3RateTracer::Install(const NodeContainer& nodes, const std::string& file,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
using namespace boost;
using namespace std;
- std::list<Ptr<L3RateTracer> > tracers;
+ std::list<Ptr<L3RateTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- for (NodeContainer::Iterator node = nodes.Begin ();
- node != nodes.End ();
- node++)
- {
- Ptr<L3RateTracer> trace = Install (*node, outputStream, averagingPeriod);
- tracers.push_back (trace);
- }
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ for (NodeContainer::Iterator node = nodes.Begin(); node != nodes.End(); node++) {
+ Ptr<L3RateTracer> trace = Install(*node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
+ }
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
void
-L3RateTracer::Install (Ptr<Node> node, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
+L3RateTracer::Install(Ptr<Node> node, const std::string& file,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
using namespace boost;
using namespace std;
- std::list<Ptr<L3RateTracer> > tracers;
+ std::list<Ptr<L3RateTracer>> tracers;
boost::shared_ptr<std::ostream> outputStream;
- if (file != "-")
- {
- boost::shared_ptr<std::ofstream> os (new std::ofstream ());
- os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc);
+ if (file != "-") {
+ boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
- if (!os->is_open ())
- {
- NS_LOG_ERROR ("File " << file << " cannot be opened for writing. Tracing disabled");
- return;
- }
-
- outputStream = os;
- }
- else
- {
- outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>);
+ if (!os->is_open()) {
+ NS_LOG_ERROR("File " << file << " cannot be opened for writing. Tracing disabled");
+ return;
}
- Ptr<L3RateTracer> trace = Install (node, outputStream, averagingPeriod);
- tracers.push_back (trace);
+ outputStream = os;
+ }
+ else {
+ outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ }
- if (tracers.size () > 0)
- {
- // *m_l3RateTrace << "# "; // not necessary for R's read.table
- tracers.front ()->PrintHeader (*outputStream);
- *outputStream << "\n";
- }
+ Ptr<L3RateTracer> trace = Install(node, outputStream, averagingPeriod);
+ tracers.push_back(trace);
- g_tracers.push_back (boost::make_tuple (outputStream, tracers));
+ if (tracers.size() > 0) {
+ // *m_l3RateTrace << "# "; // not necessary for R's read.table
+ tracers.front()->PrintHeader(*outputStream);
+ *outputStream << "\n";
+ }
+
+ g_tracers.push_back(boost::make_tuple(outputStream, tracers));
}
-
Ptr<L3RateTracer>
-L3RateTracer::Install (Ptr<Node> node,
- boost::shared_ptr<std::ostream> outputStream,
- Time averagingPeriod/* = Seconds (0.5)*/)
+L3RateTracer::Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+ Time averagingPeriod /* = Seconds (0.5)*/)
{
- NS_LOG_DEBUG ("Node: " << node->GetId ());
+ NS_LOG_DEBUG("Node: " << node->GetId());
- Ptr<L3RateTracer> trace = Create<L3RateTracer> (outputStream, node);
- trace->SetAveragingPeriod (averagingPeriod);
+ Ptr<L3RateTracer> trace = Create<L3RateTracer>(outputStream, node);
+ trace->SetAveragingPeriod(averagingPeriod);
return trace;
}
-
-L3RateTracer::L3RateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node)
- : L3Tracer (node)
- , m_os (os)
+L3RateTracer::L3RateTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node)
+ : L3Tracer(node)
+ , m_os(os)
{
- SetAveragingPeriod (Seconds (1.0));
+ SetAveragingPeriod(Seconds(1.0));
}
-L3RateTracer::L3RateTracer (boost::shared_ptr<std::ostream> os, const std::string &node)
- : L3Tracer (node)
- , m_os (os)
+L3RateTracer::L3RateTracer(boost::shared_ptr<std::ostream> os, const std::string& node)
+ : L3Tracer(node)
+ , m_os(os)
{
- SetAveragingPeriod (Seconds (1.0));
+ SetAveragingPeriod(Seconds(1.0));
}
-L3RateTracer::~L3RateTracer ()
+L3RateTracer::~L3RateTracer()
{
- m_printEvent.Cancel ();
+ m_printEvent.Cancel();
}
void
-L3RateTracer::SetAveragingPeriod (const Time &period)
+L3RateTracer::SetAveragingPeriod(const Time& period)
{
m_period = period;
- m_printEvent.Cancel ();
- m_printEvent = Simulator::Schedule (m_period, &L3RateTracer::PeriodicPrinter, this);
+ m_printEvent.Cancel();
+ m_printEvent = Simulator::Schedule(m_period, &L3RateTracer::PeriodicPrinter, this);
}
void
-L3RateTracer::PeriodicPrinter ()
+L3RateTracer::PeriodicPrinter()
{
- Print (*m_os);
- Reset ();
+ Print(*m_os);
+ Reset();
- m_printEvent = Simulator::Schedule (m_period, &L3RateTracer::PeriodicPrinter, this);
+ m_printEvent = Simulator::Schedule(m_period, &L3RateTracer::PeriodicPrinter, this);
}
void
-L3RateTracer::PrintHeader (std::ostream &os) const
+L3RateTracer::PrintHeader(std::ostream& os) const
{
- os << "Time" << "\t"
+ os << "Time"
+ << "\t"
- << "Node" << "\t"
- << "FaceId" << "\t"
- << "FaceDescr" << "\t"
+ << "Node"
+ << "\t"
+ << "FaceId"
+ << "\t"
+ << "FaceDescr"
+ << "\t"
- << "Type" << "\t"
- << "Packets" << "\t"
- << "Kilobytes" << "\t"
- << "PacketRaw" << "\t"
+ << "Type"
+ << "\t"
+ << "Packets"
+ << "\t"
+ << "Kilobytes"
+ << "\t"
+ << "PacketRaw"
+ << "\t"
<< "KilobytesRaw";
}
void
-L3RateTracer::Reset ()
+L3RateTracer::Reset()
{
- for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.begin ();
- stats != m_stats.end ();
- stats++)
- {
- stats->second.get<0> ().Reset ();
- stats->second.get<1> ().Reset ();
- }
+ for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats>>::iterator stats =
+ m_stats.begin();
+ stats != m_stats.end(); stats++) {
+ stats->second.get<0>().Reset();
+ stats->second.get<1>().Reset();
+ }
}
const double alpha = 0.8;
-#define STATS(INDEX) stats->second.get<INDEX> ()
-#define RATE(INDEX, fieldName) STATS(INDEX).fieldName / m_period.ToDouble (Time::S)
+#define STATS(INDEX) stats->second.get<INDEX>()
+#define RATE(INDEX, fieldName) STATS(INDEX).fieldName / m_period.ToDouble(Time::S)
-#define PRINTER(printName, fieldName) \
- STATS(2).fieldName = /*new value*/alpha * RATE(0, fieldName) + /*old value*/(1-alpha) * STATS(2).fieldName; \
- STATS(3).fieldName = /*new value*/alpha * RATE(1, fieldName) / 1024.0 + /*old value*/(1-alpha) * STATS(3).fieldName; \
- \
- os << time.ToDouble (Time::S) << "\t" \
- << m_node << "\t"; \
- if (stats->first) \
- { \
- os \
- << stats->first->GetId () << "\t" \
- << *stats->first << "\t"; \
- } \
- else \
- { \
- os << "-1\tall\t"; \
- } \
- os \
- << printName << "\t" \
- << STATS(2).fieldName << "\t" \
- << STATS(3).fieldName << "\t" \
- << STATS(0).fieldName << "\t" \
- << STATS(1).fieldName / 1024.0 << "\n";
+#define PRINTER(printName, fieldName) \
+ STATS(2).fieldName = \
+ /*new value*/ alpha * RATE(0, fieldName) + /*old value*/ (1 - alpha) * STATS(2).fieldName; \
+ STATS(3).fieldName = /*new value*/ alpha * RATE(1, fieldName) / 1024.0 \
+ + /*old value*/ (1 - alpha) * STATS(3).fieldName; \
+ \
+ os << time.ToDouble(Time::S) << "\t" << m_node << "\t"; \
+ if (stats->first) { \
+ os << stats->first->GetId() << "\t" << *stats->first << "\t"; \
+ } \
+ else { \
+ os << "-1\tall\t"; \
+ } \
+ os << printName << "\t" << STATS(2).fieldName << "\t" << STATS(3).fieldName << "\t" \
+ << STATS(0).fieldName << "\t" << STATS(1).fieldName / 1024.0 << "\n";
void
-L3RateTracer::Print (std::ostream &os) const
+L3RateTracer::Print(std::ostream& os) const
{
- Time time = Simulator::Now ();
+ Time time = Simulator::Now();
- for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.begin ();
- stats != m_stats.end ();
- stats++)
- {
- if (!stats->first)
- continue;
+ for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats>>::iterator stats =
+ m_stats.begin();
+ stats != m_stats.end(); stats++) {
+ if (!stats->first)
+ continue;
- PRINTER ("InInterests", m_inInterests);
- PRINTER ("OutInterests", m_outInterests);
- PRINTER ("DropInterests", m_dropInterests);
+ PRINTER("InInterests", m_inInterests);
+ PRINTER("OutInterests", m_outInterests);
+ PRINTER("DropInterests", m_dropInterests);
- PRINTER ("InNacks", m_inNacks);
- PRINTER ("OutNacks", m_outNacks);
- PRINTER ("DropNacks", m_dropNacks);
+ PRINTER("InNacks", m_inNacks);
+ PRINTER("OutNacks", m_outNacks);
+ PRINTER("DropNacks", m_dropNacks);
- PRINTER ("InData", m_inData);
- PRINTER ("OutData", m_outData);
- PRINTER ("DropData", m_dropData);
+ PRINTER("InData", m_inData);
+ PRINTER("OutData", m_outData);
+ PRINTER("DropData", m_dropData);
- PRINTER ("InSatisfiedInterests", m_satisfiedInterests);
- PRINTER ("InTimedOutInterests", m_timedOutInterests);
+ PRINTER("InSatisfiedInterests", m_satisfiedInterests);
+ PRINTER("InTimedOutInterests", m_timedOutInterests);
- PRINTER ("OutSatisfiedInterests", m_outSatisfiedInterests);
- PRINTER ("OutTimedOutInterests", m_outTimedOutInterests);
- }
+ PRINTER("OutSatisfiedInterests", m_outSatisfiedInterests);
+ PRINTER("OutTimedOutInterests", m_outTimedOutInterests);
+ }
{
- std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.find (Ptr<const Face> (0));
- if (stats != m_stats.end ())
- {
- PRINTER ("SatisfiedInterests", m_satisfiedInterests);
- PRINTER ("TimedOutInterests", m_timedOutInterests);
- }
+ std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats>>::iterator stats =
+ m_stats.find(Ptr<const Face>(0));
+ if (stats != m_stats.end()) {
+ PRINTER("SatisfiedInterests", m_satisfiedInterests);
+ PRINTER("TimedOutInterests", m_timedOutInterests);
+ }
}
}
-
void
-L3RateTracer::OutInterests (Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::OutInterests(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_outInterests ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_outInterests += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_outInterests++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_outInterests += interest->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::InInterests (Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::InInterests(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_inInterests ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_inInterests += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_inInterests++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_inInterests += interest->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::DropInterests (Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::DropInterests(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_dropInterests ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_dropInterests += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_dropInterests++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_dropInterests += interest->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::OutNacks (Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::OutNacks(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_outNacks ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_outNacks += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_outNacks++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_outNacks += interest->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::InNacks (Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::InNacks(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_inNacks ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_inNacks += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_inNacks++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_inNacks += interest->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::DropNacks (Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::DropNacks(Ptr<const Interest> interest, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_dropNacks ++;
- if (interest->GetWire ())
- {
- m_stats[face].get<1> ().m_dropNacks += interest->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_dropNacks++;
+ if (interest->GetWire()) {
+ m_stats[face].get<1>().m_dropNacks += interest->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::OutData (Ptr<const Data> data,
- bool fromCache, Ptr<const Face> face)
+L3RateTracer::OutData(Ptr<const Data> data, bool fromCache, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_outData ++;
- if (data->GetWire ())
- {
- m_stats[face].get<1> ().m_outData += data->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_outData++;
+ if (data->GetWire()) {
+ m_stats[face].get<1>().m_outData += data->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::InData (Ptr<const Data> data,
- Ptr<const Face> face)
+L3RateTracer::InData(Ptr<const Data> data, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_inData ++;
- if (data->GetWire ())
- {
- m_stats[face].get<1> ().m_inData += data->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_inData++;
+ if (data->GetWire()) {
+ m_stats[face].get<1>().m_inData += data->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::DropData (Ptr<const Data> data,
- Ptr<const Face> face)
+L3RateTracer::DropData(Ptr<const Data> data, Ptr<const Face> face)
{
- m_stats[face].get<0> ().m_dropData ++;
- if (data->GetWire ())
- {
- m_stats[face].get<1> ().m_dropData += data->GetWire ()->GetSize ();
- }
+ m_stats[face].get<0>().m_dropData++;
+ if (data->GetWire()) {
+ m_stats[face].get<1>().m_dropData += data->GetWire()->GetSize();
+ }
}
void
-L3RateTracer::SatisfiedInterests (Ptr<const pit::Entry> entry)
+L3RateTracer::SatisfiedInterests(Ptr<const pit::Entry> entry)
{
- m_stats[0].get<0> ().m_satisfiedInterests ++;
+ m_stats[0].get<0>().m_satisfiedInterests++;
// no "size" stats
- for (pit::Entry::in_container::const_iterator i = entry->GetIncoming ().begin ();
- i != entry->GetIncoming ().end ();
- i++)
- {
- m_stats[i->m_face].get<0> ().m_satisfiedInterests ++;
-}
+ for (pit::Entry::in_container::const_iterator i = entry->GetIncoming().begin();
+ i != entry->GetIncoming().end(); i++) {
+ m_stats[i->m_face].get<0>().m_satisfiedInterests++;
+ }
- for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing ().begin ();
- i != entry->GetOutgoing ().end ();
- i++)
- {
- m_stats[i->m_face].get<0> ().m_outSatisfiedInterests ++;
- }
+ for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing().begin();
+ i != entry->GetOutgoing().end(); i++) {
+ m_stats[i->m_face].get<0>().m_outSatisfiedInterests++;
+ }
}
void
-L3RateTracer::TimedOutInterests (Ptr<const pit::Entry> entry)
+L3RateTracer::TimedOutInterests(Ptr<const pit::Entry> entry)
{
- m_stats[0].get<0> ().m_timedOutInterests ++;
+ m_stats[0].get<0>().m_timedOutInterests++;
// no "size" stats
-
- for (pit::Entry::in_container::const_iterator i = entry->GetIncoming ().begin ();
- i != entry->GetIncoming ().end ();
- i++)
- {
- m_stats[i->m_face].get<0> ().m_timedOutInterests ++;
-}
- for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing ().begin ();
- i != entry->GetOutgoing ().end ();
- i++)
- {
- m_stats[i->m_face].get<0> ().m_outTimedOutInterests ++;
- }
-}
+ for (pit::Entry::in_container::const_iterator i = entry->GetIncoming().begin();
+ i != entry->GetIncoming().end(); i++) {
+ m_stats[i->m_face].get<0>().m_timedOutInterests++;
+ }
+ for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing().begin();
+ i != entry->GetOutgoing().end(); i++) {
+ m_stats[i->m_face].get<0>().m_outTimedOutInterests++;
+ }
+}
} // namespace ndn
} // namespace ns3
diff --git a/utils/tracers/ndn-l3-rate-tracer.hpp b/utils/tracers/ndn-l3-rate-tracer.hpp
index 1a6a401..21bb06c 100644
--- a/utils/tracers/ndn-l3-rate-tracer.hpp
+++ b/utils/tracers/ndn-l3-rate-tracer.hpp
@@ -39,38 +39,40 @@
* @ingroup ndn-tracers
* @brief NDN network-layer rate tracer
*/
-class L3RateTracer : public L3Tracer
-{
+class L3RateTracer : public L3Tracer {
public:
/**
* @brief Helper method to install tracers on all simulation nodes
*
* @param file File to which traces will be written. If filename is -, then std::out is used
* @param averagingPeriod Defines averaging period for the rate calculation,
- * as well as how often data will be written into the trace file (default, every half second)
+ * as well as how often data will be written into the trace file (default, every half
+ *second)
*/
static void
- InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
+ InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on the selected simulation nodes
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*/
static void
- Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(const NodeContainer& nodes, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*/
static void
- Install (Ptr<Node> node, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(Ptr<Node> node, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Explicit request to remove all statically created tracers
@@ -79,98 +81,101 @@
* or if it is desired to do a postprocessing of the resulting data
*/
static void
- Destroy ();
-
+ Destroy();
+
/**
* @brief Trace constructor that attaches to the node using node pointer
* @param os reference to the output stream
* @param node pointer to the node
*/
- L3RateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
+ L3RateTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node);
/**
* @brief Trace constructor that attaches to the node using node name
* @param os reference to the output stream
* @param nodeName name of the node registered using Names::Add
*/
- L3RateTracer (boost::shared_ptr<std::ostream> os, const std::string &node);
+ L3RateTracer(boost::shared_ptr<std::ostream> os, const std::string& node);
/**
* @brief Destructor
*/
- virtual ~L3RateTracer ();
+ virtual ~L3RateTracer();
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param outputStream Smart pointer to a stream
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*/
static Ptr<L3RateTracer>
- Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream, Time averagingPeriod = Seconds (0.5));
-
+ Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+ Time averagingPeriod = Seconds(0.5));
+
// from L3Tracer
virtual void
- PrintHeader (std::ostream &os) const;
+ PrintHeader(std::ostream& os) const;
virtual void
- Print (std::ostream &os) const;
+ Print(std::ostream& os) const;
protected:
// from L3Tracer
virtual void
- OutInterests (Ptr<const Interest>, Ptr<const Face>);
+ OutInterests(Ptr<const Interest>, Ptr<const Face>);
virtual void
- InInterests (Ptr<const Interest>, Ptr<const Face>);
+ InInterests(Ptr<const Interest>, Ptr<const Face>);
virtual void
- DropInterests (Ptr<const Interest>, Ptr<const Face>);
+ DropInterests(Ptr<const Interest>, Ptr<const Face>);
virtual void
- OutNacks (Ptr<const Interest>, Ptr<const Face>);
+ OutNacks(Ptr<const Interest>, Ptr<const Face>);
virtual void
- InNacks (Ptr<const Interest>, Ptr<const Face>);
+ InNacks(Ptr<const Interest>, Ptr<const Face>);
virtual void
- DropNacks (Ptr<const Interest>, Ptr<const Face>);
+ DropNacks(Ptr<const Interest>, Ptr<const Face>);
virtual void
- OutData (Ptr<const Data>, bool fromCache, Ptr<const Face>);
+ OutData(Ptr<const Data>, bool fromCache, Ptr<const Face>);
virtual void
- InData (Ptr<const Data>, Ptr<const Face>);
+ InData(Ptr<const Data>, Ptr<const Face>);
virtual void
- DropData (Ptr<const Data>, Ptr<const Face>);
+ DropData(Ptr<const Data>, Ptr<const Face>);
virtual void
- SatisfiedInterests (Ptr<const pit::Entry>);
+ SatisfiedInterests(Ptr<const pit::Entry>);
virtual void
- TimedOutInterests (Ptr<const pit::Entry>);
+ TimedOutInterests(Ptr<const pit::Entry>);
private:
void
- SetAveragingPeriod (const Time &period);
+ SetAveragingPeriod(const Time& period);
void
- PeriodicPrinter ();
+ PeriodicPrinter();
void
- Reset ();
+ Reset();
private:
boost::shared_ptr<std::ostream> m_os;
Time m_period;
EventId m_printEvent;
- mutable std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats> > m_stats;
+ mutable std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats>> m_stats;
};
} // namespace ndn
diff --git a/utils/tracers/ndn-l3-tracer.cpp b/utils/tracers/ndn-l3-tracer.cpp
index c69a4d3..8d59eb0 100644
--- a/utils/tracers/ndn-l3-tracer.cpp
+++ b/utils/tracers/ndn-l3-tracer.cpp
@@ -38,52 +38,50 @@
namespace ns3 {
namespace ndn {
-L3Tracer::L3Tracer (Ptr<Node> node)
-: m_nodePtr (node)
+L3Tracer::L3Tracer(Ptr<Node> node)
+ : m_nodePtr(node)
{
- m_node = boost::lexical_cast<string> (m_nodePtr->GetId ());
+ m_node = boost::lexical_cast<string>(m_nodePtr->GetId());
- Connect ();
+ Connect();
- string name = Names::FindName (node);
- if (!name.empty ())
- {
- m_node = name;
- }
+ string name = Names::FindName(node);
+ if (!name.empty()) {
+ m_node = name;
+ }
}
-L3Tracer::L3Tracer (const std::string &node)
-: m_node (node)
+L3Tracer::L3Tracer(const std::string& node)
+ : m_node(node)
{
- Connect ();
+ Connect();
}
-L3Tracer::~L3Tracer ()
-{
-};
-
+L3Tracer::~L3Tracer(){};
void
-L3Tracer::Connect ()
+L3Tracer::Connect()
{
- Ptr<ForwardingStrategy> fw = m_nodePtr->GetObject<ForwardingStrategy> ();
-
- fw->TraceConnectWithoutContext ("OutInterests", MakeCallback (&L3Tracer::OutInterests, this));
- fw->TraceConnectWithoutContext ("InInterests", MakeCallback (&L3Tracer::InInterests, this));
- fw->TraceConnectWithoutContext ("DropInterests", MakeCallback (&L3Tracer::DropInterests, this));
-
- fw->TraceConnectWithoutContext ("OutData", MakeCallback (&L3Tracer::OutData, this));
- fw->TraceConnectWithoutContext ("InData", MakeCallback (&L3Tracer::InData, this));
- fw->TraceConnectWithoutContext ("DropData", MakeCallback (&L3Tracer::DropData, this));
+ Ptr<ForwardingStrategy> fw = m_nodePtr->GetObject<ForwardingStrategy>();
+
+ fw->TraceConnectWithoutContext("OutInterests", MakeCallback(&L3Tracer::OutInterests, this));
+ fw->TraceConnectWithoutContext("InInterests", MakeCallback(&L3Tracer::InInterests, this));
+ fw->TraceConnectWithoutContext("DropInterests", MakeCallback(&L3Tracer::DropInterests, this));
+
+ fw->TraceConnectWithoutContext("OutData", MakeCallback(&L3Tracer::OutData, this));
+ fw->TraceConnectWithoutContext("InData", MakeCallback(&L3Tracer::InData, this));
+ fw->TraceConnectWithoutContext("DropData", MakeCallback(&L3Tracer::DropData, this));
// only for some strategies
- fw->TraceConnectWithoutContext ("OutNacks", MakeCallback (&L3Tracer::OutNacks, this));
- fw->TraceConnectWithoutContext ("InNacks", MakeCallback (&L3Tracer::InNacks, this));
- fw->TraceConnectWithoutContext ("DropNacks", MakeCallback (&L3Tracer::DropNacks, this));
-
+ fw->TraceConnectWithoutContext("OutNacks", MakeCallback(&L3Tracer::OutNacks, this));
+ fw->TraceConnectWithoutContext("InNacks", MakeCallback(&L3Tracer::InNacks, this));
+ fw->TraceConnectWithoutContext("DropNacks", MakeCallback(&L3Tracer::DropNacks, this));
+
// satisfied/timed out PIs
- fw->TraceConnectWithoutContext ("SatisfiedInterests", MakeCallback (&L3Tracer::SatisfiedInterests, this));
- fw->TraceConnectWithoutContext ("TimedOutInterests", MakeCallback (&L3Tracer::TimedOutInterests, this));
+ fw->TraceConnectWithoutContext("SatisfiedInterests",
+ MakeCallback(&L3Tracer::SatisfiedInterests, this));
+ fw->TraceConnectWithoutContext("TimedOutInterests",
+ MakeCallback(&L3Tracer::TimedOutInterests, this));
}
} // namespace ndn
diff --git a/utils/tracers/ndn-l3-tracer.hpp b/utils/tracers/ndn-l3-tracer.hpp
index 2f132bd..d3534fa 100644
--- a/utils/tracers/ndn-l3-tracer.hpp
+++ b/utils/tracers/ndn-l3-tracer.hpp
@@ -49,25 +49,24 @@
* @ingroup ndn-tracers
* @brief Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack
*/
-class L3Tracer : public SimpleRefCount<L3Tracer>
-{
+class L3Tracer : public SimpleRefCount<L3Tracer> {
public:
/**
* @brief Trace constructor that attaches to the node using node pointer
* @param node pointer to the node
*/
- L3Tracer (Ptr<Node> node);
+ L3Tracer(Ptr<Node> node);
/**
* @brief Trace constructor that attaches to the node using node name
* @param nodeName name of the node registered using Names::Add
*/
- L3Tracer (const std::string &node);
+ L3Tracer(const std::string& node);
/**
* @brief Destructor
*/
- virtual ~L3Tracer ();
+ virtual ~L3Tracer();
/**
* @brief Print head of the trace (e.g., for post-processing)
@@ -75,7 +74,7 @@
* @param os reference to output stream
*/
virtual void
- PrintHeader (std::ostream &os) const = 0;
+ PrintHeader(std::ostream& os) const = 0;
/**
* @brief Print current trace data
@@ -83,63 +82,62 @@
* @param os reference to output stream
*/
virtual void
- Print (std::ostream &os) const = 0;
+ Print(std::ostream& os) const = 0;
protected:
void
- Connect ();
+ Connect();
virtual void
- OutInterests (Ptr<const Interest>, Ptr<const Face>) = 0;
+ OutInterests(Ptr<const Interest>, Ptr<const Face>) = 0;
virtual void
- InInterests (Ptr<const Interest>, Ptr<const Face>) = 0;
+ InInterests(Ptr<const Interest>, Ptr<const Face>) = 0;
virtual void
- DropInterests (Ptr<const Interest>, Ptr<const Face>) = 0;
+ DropInterests(Ptr<const Interest>, Ptr<const Face>) = 0;
virtual void
- OutNacks (Ptr<const Interest>, Ptr<const Face>) = 0;
+ OutNacks(Ptr<const Interest>, Ptr<const Face>) = 0;
virtual void
- InNacks (Ptr<const Interest>, Ptr<const Face>) = 0;
+ InNacks(Ptr<const Interest>, Ptr<const Face>) = 0;
virtual void
- DropNacks (Ptr<const Interest>, Ptr<const Face>) = 0;
-
+ DropNacks(Ptr<const Interest>, Ptr<const Face>) = 0;
virtual void
- OutData (Ptr<const Data>, bool fromCache, Ptr<const Face>) = 0;
+ OutData(Ptr<const Data>, bool fromCache, Ptr<const Face>) = 0;
virtual void
- InData (Ptr<const Data>, Ptr<const Face>) = 0;
+ InData(Ptr<const Data>, Ptr<const Face>) = 0;
virtual void
- DropData (Ptr<const Data>, Ptr<const Face>) = 0;
+ DropData(Ptr<const Data>, Ptr<const Face>) = 0;
virtual void
- SatisfiedInterests (Ptr<const pit::Entry>) = 0;
+ SatisfiedInterests(Ptr<const pit::Entry>) = 0;
virtual void
- TimedOutInterests (Ptr<const pit::Entry>) = 0;
+ TimedOutInterests(Ptr<const pit::Entry>) = 0;
protected:
std::string m_node;
Ptr<Node> m_nodePtr;
- struct Stats
- {
- inline void Reset ()
+ struct Stats {
+ inline void
+ Reset()
{
- m_inInterests = 0;
- m_outInterests = 0;
+ m_inInterests = 0;
+ m_outInterests = 0;
m_dropInterests = 0;
- m_inNacks = 0;
- m_outNacks = 0;
- m_dropNacks = 0;
- m_inData = 0;
- m_outData = 0;
- m_dropData = 0;
+ m_inNacks = 0;
+ m_outNacks = 0;
+ m_dropNacks = 0;
+ m_inData = 0;
+ m_outData = 0;
+ m_dropData = 0;
m_satisfiedInterests = 0;
m_timedOutInterests = 0;
@@ -167,12 +165,12 @@
* @brief Helper to dump the trace to an output stream
*/
inline std::ostream&
-operator << (std::ostream &os, const L3Tracer &tracer)
+operator<<(std::ostream& os, const L3Tracer& tracer)
{
os << "# ";
- tracer.PrintHeader (os);
+ tracer.PrintHeader(os);
os << "\n";
- tracer.Print (os);
+ tracer.Print(os);
return os;
}