utils/tracers: Adding *::Destroy () method in Tracers
This way it becomes possible to do clean up before applications
terminates (useful if the same scenario is used for several simulation
runs or if there is a need for post-processing of the resulting files)
diff --git a/utils/tracers/l2-rate-tracer.cc b/utils/tracers/l2-rate-tracer.cc
index 48d2589..a4c86b9 100644
--- a/utils/tracers/l2-rate-tracer.cc
+++ b/utils/tracers/l2-rate-tracer.cc
@@ -47,6 +47,12 @@
}
void
+L2RateTracer::Destroy ()
+{
+ g_tracers.clear ();
+}
+
+void
L2RateTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
{
std::list<Ptr<L2RateTracer> > tracers;
diff --git a/utils/tracers/l2-rate-tracer.h b/utils/tracers/l2-rate-tracer.h
index 8dba680..bdf2263 100644
--- a/utils/tracers/l2-rate-tracer.h
+++ b/utils/tracers/l2-rate-tracer.h
@@ -61,6 +61,15 @@
static void
InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
+ /**
+ * @brief Explicit request to remove all statically created tracers
+ *
+ * This method can be helpful if simulation scenario contains several independent run,
+ * or if it is desired to do a postprocessing of the resulting data
+ */
+ static void
+ Destroy ();
+
void
SetAveragingPeriod (const Time &period);
diff --git a/utils/tracers/ndn-app-delay-tracer.cc b/utils/tracers/ndn-app-delay-tracer.cc
index c0f881d..6eeeeb9 100644
--- a/utils/tracers/ndn-app-delay-tracer.cc
+++ b/utils/tracers/ndn-app-delay-tracer.cc
@@ -53,6 +53,12 @@
}
void
+AppDelayTracer::Destroy ()
+{
+ g_tracers.clear ();
+}
+
+void
AppDelayTracer::InstallAll (const std::string &file)
{
using namespace boost;
diff --git a/utils/tracers/ndn-app-delay-tracer.h b/utils/tracers/ndn-app-delay-tracer.h
index d7b1a72..d911fc9 100644
--- a/utils/tracers/ndn-app-delay-tracer.h
+++ b/utils/tracers/ndn-app-delay-tracer.h
@@ -98,6 +98,15 @@
*/
static Ptr<AppDelayTracer>
Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream);
+
+ /**
+ * @brief Explicit request to remove all statically created tracers
+ *
+ * This method can be helpful if simulation scenario contains several independent run,
+ * or if it is desired to do a postprocessing of the resulting data
+ */
+ static void
+ Destroy ();
/**
* @brief Trace constructor that attaches to all applications on the node using node's pointer
diff --git a/utils/tracers/ndn-cs-tracer.cc b/utils/tracers/ndn-cs-tracer.cc
index 0c1becb..7f2553d 100644
--- a/utils/tracers/ndn-cs-tracer.cc
+++ b/utils/tracers/ndn-cs-tracer.cc
@@ -53,6 +53,12 @@
}
void
+CsTracer::Destroy ()
+{
+ g_tracers.clear ();
+}
+
+void
CsTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
{
using namespace boost;
diff --git a/utils/tracers/ndn-cs-tracer.h b/utils/tracers/ndn-cs-tracer.h
index 0bddfb6..eb07585 100644
--- a/utils/tracers/ndn-cs-tracer.h
+++ b/utils/tracers/ndn-cs-tracer.h
@@ -123,6 +123,15 @@
*/
static Ptr<CsTracer>
Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream, Time averagingPeriod = Seconds (0.5));
+
+ /**
+ * @brief Explicit request to remove all statically created tracers
+ *
+ * This method can be helpful if simulation scenario contains several independent run,
+ * or if it is desired to do a postprocessing of the resulting data
+ */
+ static void
+ Destroy ();
/**
* @brief Trace constructor that attaches to the node using node pointer
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.cc b/utils/tracers/ndn-l3-aggregate-tracer.cc
index c6fc5e3..5a2d662 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.cc
+++ b/utils/tracers/ndn-l3-aggregate-tracer.cc
@@ -50,6 +50,12 @@
}
void
+L3AggregateTracer::Destroy ()
+{
+ g_tracers.clear ();
+}
+
+void
L3AggregateTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
{
using namespace boost;
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.h b/utils/tracers/ndn-l3-aggregate-tracer.h
index b7d4ce7..dadd6ff 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.h
+++ b/utils/tracers/ndn-l3-aggregate-tracer.h
@@ -84,6 +84,15 @@
Install (Ptr<Node> node, const std::string &file, Time averagingPeriod = Seconds (0.5));
/**
+ * @brief Explicit request to remove all statically created tracers
+ *
+ * This method can be helpful if simulation scenario contains several independent run,
+ * or if it is desired to do a postprocessing of the resulting data
+ */
+ static void
+ 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
diff --git a/utils/tracers/ndn-l3-rate-tracer.cc b/utils/tracers/ndn-l3-rate-tracer.cc
index 435a652..7951213 100644
--- a/utils/tracers/ndn-l3-rate-tracer.cc
+++ b/utils/tracers/ndn-l3-rate-tracer.cc
@@ -53,6 +53,12 @@
}
void
+L3RateTracer::Destroy ()
+{
+ g_tracers.clear ();
+}
+
+void
L3RateTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/)
{
std::list<Ptr<L3RateTracer> > tracers;
diff --git a/utils/tracers/ndn-l3-rate-tracer.h b/utils/tracers/ndn-l3-rate-tracer.h
index e2931d9..8e5b1d5 100644
--- a/utils/tracers/ndn-l3-rate-tracer.h
+++ b/utils/tracers/ndn-l3-rate-tracer.h
@@ -71,6 +71,15 @@
*/
static void
Install (Ptr<Node> node, const std::string &file, Time averagingPeriod = Seconds (0.5));
+
+ /**
+ * @brief Explicit request to remove all statically created tracers
+ *
+ * This method can be helpful if simulation scenario contains several independent run,
+ * or if it is desired to do a postprocessing of the resulting data
+ */
+ static void
+ Destroy ();
/**
* @brief Trace constructor that attaches to the node using node pointer