--- a/src/stats/examples/double-event-driven-collector-example.cc Tue Mar 03 14:41:09 2015 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014 Bucknell University
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Li Li (ll024@bucknell.edu)
- */
-
-/*
- * This example is designed to show the main features of an
- * ns3::DoubleEventDrivenCollector. The example is modified from double-probe-example.cc.
- * The ns3::DoubleEventDrivenCollector is the simplest collector. It collects
- * a single volumn of double valued data and outputs the data downstream.
- * The example below uses a ns3::DoubleEventDrivenCollector to collect data
- * generated from an Emitter object and dumps the data to a txt file with
- * a FileAggregator object.
- */
-
-#include <iostream>
-#include <string>
-
-#include "ns3/core-module.h"
-#include "ns3/double-probe.h"
-#include "ns3/double-event-driven-collector.h"
-#include "ns3/stats-module.h"
-
-using namespace ns3;
-
-NS_LOG_COMPONENT_DEFINE ("DoubleEventDrivenCollectorExample");
-
-
-// Declare a BatchingCollector as a global variable
-Ptr<DoubleEventDrivenCollector> collector = CreateObject<DoubleEventDrivenCollector> ();
-
-
-/*
- * This is our test object, an object that increments counters at
- * various times and emits one of them as a trace source.
- */
-class Emitter : public Object
-{
-public:
- static TypeId GetTypeId (void);
- Emitter ();
-private:
- void DoInitialize (void);
- void Emit (void);
- void Count (void);
-
- TracedValue<double> m_counter; // normally this would be integer type
- Ptr<ExponentialRandomVariable> m_var;
-
-};
-
-NS_OBJECT_ENSURE_REGISTERED (Emitter)
- ;
-
-TypeId
-Emitter::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::Emitter")
- .AddConstructor<Emitter> ()
- .SetParent<Object> ()
- .AddTraceSource ("Counter",
- "sample counter",
- MakeTraceSourceAccessor (&Emitter::m_counter))
- ;
- return tid;
-}
-
-Emitter::Emitter (void)
-{
- NS_LOG_FUNCTION (this);
- m_counter = 0;
- m_var = CreateObject<ExponentialRandomVariable> ();
-}
-
-void
-Emitter::DoInitialize (void)
-{
- NS_LOG_FUNCTION (this);
- Simulator::Schedule (Seconds (m_var->GetValue ()), &Emitter::Emit, this);
- Simulator::Schedule (Seconds (m_var->GetValue ()), &Emitter::Count, this);
-}
-
-void
-Emitter::Emit (void)
-{
- NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("Emitting at " << Simulator::Now ().GetSeconds ());
- Simulator::Schedule (Seconds (m_var->GetValue ()), &Emitter::Emit, this);
-}
-
-void
-Emitter::Count (void)
-{
- NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("Counting at " << Simulator::Now ().GetSeconds ());
- m_counter += 1.0;
- DoubleProbe::SetValueByPath ("/Names/StaticallyAccessedProbe", m_counter);
- Simulator::Schedule (Seconds (m_var->GetValue ()), &Emitter::Count, this);
-}
-
-
-int main (int argc, char *argv[])
-{
- CommandLine cmd;
- cmd.Parse (argc, argv);
- bool connected;
-
- Ptr<Emitter> emitter = CreateObject<Emitter> ();
- Names::Add ("/Names/Emitter", emitter);
-
- //
- // testProbe will be called by the emitter directly through the
- // static method SetValueByPath().
- //
- Ptr<DoubleProbe> testProbe = CreateObject<DoubleProbe> ();
- testProbe ->SetName ("StaticallyAccessedProbe");
- // We must add it to the config database
- Names::Add ("/Names/Probes", testProbe ->GetName (), testProbe);
-
- // hook the probe to the callback function
- connected = testProbe ->TraceConnectWithoutContext ("Output", MakeCallback (&DoubleEventDrivenCollector::TraceSinkDouble, collector));
- NS_ASSERT (connected == true);
-
- // enable the collector
- collector->Enable();
-
- // Set up a FileAggregator
- std::string outputFileName = "double-event-driven-collector-output.txt";
- enum FileAggregator::FileType m_fileType = FileAggregator::SPACE_SEPARATED;
-
- Ptr<FileAggregator> aggregator = CreateObject<FileAggregator> (outputFileName, m_fileType);
-
- aggregator-> SetHeading("time value");
- aggregator-> Enable();
-
- // connect the collector with the aggregator
- connected = collector-> TraceConnect("Output", "/Names/Probes/StaticallyAccessedProbe/Output", MakeCallback(&FileAggregator::Write2d, aggregator));
- NS_ASSERT (connected == true);
- NS_UNUSED (connected);
-
- // The Emitter object is not associated with an ns-3 node, so
- // it won't get started automatically, so we need to do this ourselves
- Simulator::Schedule (Seconds (0.0), &Emitter::Initialize, emitter);
-
- Simulator::Stop (Seconds (100.0));
- Simulator::Run ();
- Simulator::Destroy ();
-
- return 0;
-}
--- a/src/stats/examples/wscript Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/examples/wscript Fri Mar 13 18:22:08 2015 -0400
@@ -28,8 +28,8 @@
program = bld.create_ns3_program('file-helper-example', ['network', 'stats'])
program.source = 'file-helper-example.cc'
- program = bld.create_ns3_program('double-event-driven-collector-example', ['network', 'stats'])
- program.source = 'double-event-driven-collector-example.cc'
+ program = bld.create_ns3_program('event-driven-collector-example', ['network', 'stats'])
+ program.source = 'event-driven-collector-example.cc'
program = bld.create_ns3_program('double-time-driven-collector-example', ['network', 'stats'])
program.source = 'double-time-driven-collector-example.cc'
--- a/src/stats/helper/collectorplot-helper.cc Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/helper/collectorplot-helper.cc Fri Mar 13 18:22:08 2015 -0400
@@ -235,7 +235,7 @@
}
void
-CollectorplotHelper::AddDoubleEventDrivenCollector (const std::string &collectorName)
+CollectorplotHelper::AddEventDrivenCollector (const std::string &collectorName)
{
NS_LOG_FUNCTION (this << collectorName);
@@ -246,13 +246,13 @@
}
// Create the double event driven collector.
- Ptr<DoubleEventDrivenCollector> doubleEventDrivenCollector = CreateObject<DoubleEventDrivenCollector> ();
+ Ptr<EventDrivenCollector> eventDrivenCollector = CreateObject<EventDrivenCollector> ();
// Enable logging of data for the double event driven collector.
- doubleEventDrivenCollector->Enable ();
+ eventDrivenCollector->Enable ();
// Add this double event driven collector to the map so that can be used.
- m_eventDrivenCollectorMap[collectorName] = doubleEventDrivenCollector;
+ m_eventDrivenCollectorMap[collectorName] = eventDrivenCollector;
}
Ptr<Probe>
@@ -352,70 +352,70 @@
// Because the callbacks to the collectors' trace sources don't use
// the probe's context, a unique adaptor needs to be created for each
// collector context so that information is not last.
- AddDoubleEventDrivenCollector (collectorContext);
+ AddEventDrivenCollector (collectorContext);
// Connect the collecor to the adaptor.
if (m_probeMap[probeName].second == "ns3::DoubleProbe")
{
m_collectorMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkDouble,
+ MakeCallback (&EventDrivenCollector::TraceSinkDouble,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::BooleanProbe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkBoolean,
+ MakeCallback (&EventDrivenCollector::TraceSinkBoolean,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::PacketProbe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::ApplicationPacketProbe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::Ipv4PacketProbe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::Ipv6PacketProbe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::Uinteger8Probe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger8,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger8,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::Uinteger16Probe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger16,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger16,
m_eventDrivenCollectorMap[collectorContext]));
}
else if (m_probeMap[probeName].second == "ns3::Uinteger32Probe")
{
m_probeMap[collectorName].first->TraceConnectWithoutContext
(collectorTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[collectorContext]));
}
else
--- a/src/stats/helper/collectorplot-helper.h Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/helper/collectorplot-helper.h Fri Mar 13 18:22:08 2015 -0400
@@ -29,7 +29,7 @@
#include "ns3/ptr.h"
#include "ns3/probe.h"
#include "ns3/gnuplot-aggregator.h"
-#include "ns3/double-event-driven-collector.h"
+#include "ns3/event-driven-collector.h"
#include "ns3/data-collection-object.h"
namespace ns3 {
@@ -146,11 +146,11 @@
const std::string &path) = 0;
/**
- * \param collectorName the DoubleEventDrivenCollector's name.
+ * \param collectorName the EventDrivenCollector's name.
*
- * \brief Adds a DoubleEventDrivenCollector to be used to collect data.
+ * \brief Adds a EventDrivenCollector to be used to collect data.
*/
- void AddDoubleEventDrivenCollector (const std::string &collectorName);
+ void AddEventDrivenCollector (const std::string &collectorName);
/**
* \param probeName the probe's name.
@@ -202,8 +202,8 @@
/// Maps collector names to collectors.
std::map<std::string, std::pair <Ptr<DataCollectionObject>, std::string> > m_collectorMap;
- /// Maps DoubleEventDrivenCollector names to DoubleEventDrivenCollectors.
- std::map<std::string, Ptr<DoubleEventDrivenCollector> > m_eventDrivenCollectorMap;
+ /// Maps EventDrivenCollector names to EventDrivenCollectors.
+ std::map<std::string, Ptr<EventDrivenCollector> > m_eventDrivenCollectorMap;
/// Number of plot probes that have been created.
uint32_t m_plotProbeCount;
--- a/src/stats/helper/file-helper.cc Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/helper/file-helper.cc Fri Mar 13 18:22:08 2015 -0400
@@ -221,7 +221,7 @@
}
void
-FileHelper::AddDoubleEventDrivenCollector (const std::string &collectorName)
+FileHelper::AddEventDrivenCollector (const std::string &collectorName)
{
NS_LOG_FUNCTION (this << collectorName);
@@ -231,14 +231,14 @@
NS_ABORT_MSG ("That double event driven collector has already been added");
}
- // Create the DoubleEventDrivenCollector.
- Ptr<DoubleEventDrivenCollector> doubleEventDrivenCollector = CreateObject<DoubleEventDrivenCollector> ();
+ // Create the EventDrivenCollector.
+ Ptr<EventDrivenCollector> eventDrivenCollector = CreateObject<EventDrivenCollector> ();
// Enable logging of data for the time series adaptor.
- doubleEventDrivenCollector -> Enable ();
+ eventDrivenCollector -> Enable ();
// Add this time series adaptor to the map so that it can be used.
- m_eventDrivenCollectorMap[collectorName] = doubleEventDrivenCollector;
+ m_eventDrivenCollectorMap[collectorName] = eventDrivenCollector;
}
void
@@ -485,7 +485,7 @@
// Because the callbacks to the probes' trace sources don't use the
// probe's context, a unique collector needs to be created for each
// probe context so that information is not lost.
- AddDoubleEventDrivenCollector (probeContext);
+ AddEventDrivenCollector (probeContext);
bool outputIs2d = true;
int outputDimension = 0;
@@ -495,70 +495,70 @@
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkDouble,
+ MakeCallback (&EventDrivenCollector::TraceSinkDouble,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::BooleanProbe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkBoolean,
+ MakeCallback (&EventDrivenCollector::TraceSinkBoolean,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::PacketProbe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::ApplicationPacketProbe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::Ipv4PacketProbe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::Ipv6PacketProbe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));;
}
else if (m_probeMap[probeName].second == "ns3::Uinteger8Probe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger8,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger8,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::Uinteger16Probe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger16,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger16,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::Uinteger32Probe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::TimeProbe")
{
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkDouble,
+ MakeCallback (&EventDrivenCollector::TraceSinkDouble,
m_eventDrivenCollectorMap[probeContext]));
}
else if (m_probeMap[probeName].second == "ns3::UlSchedulingProbe")
--- a/src/stats/helper/file-helper.h Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/helper/file-helper.h Fri Mar 13 18:22:08 2015 -0400
@@ -28,7 +28,7 @@
#include "ns3/ptr.h"
#include "ns3/probe.h"
#include "ns3/file-aggregator.h"
-#include "ns3/double-event-driven-collector.h"
+#include "ns3/event-driven-collector.h"
namespace ns3 {
@@ -109,11 +109,11 @@
const std::string &probeTraceSource);
/**
- * \param collectorName the DoubleEventDrivenCollector's name.
+ * \param collectorName the EventDrivenCollector's name.
*
- * \brief Adds a DoubleEventDrivenCollector to be used to write the file.
+ * \brief Adds a EventDrivenCollector to be used to write the file.
*/
- void AddDoubleEventDrivenCollector (const std::string &collectorName);
+ void AddEventDrivenCollector (const std::string &collectorName);
/**
* \param aggregatorName the aggregator's name.
@@ -293,8 +293,8 @@
/// Maps probe names to probes.
std::map<std::string, std::pair <Ptr<Probe>, std::string> > m_probeMap;
- /// Maps DoubleEventDrivenCollect names to DoubleEventDrivenCollectors.
- std::map<std::string, Ptr<DoubleEventDrivenCollector> > m_eventDrivenCollectorMap;
+ /// Maps DoubleEventDrivenCollect names to EventDrivenCollectors.
+ std::map<std::string, Ptr<EventDrivenCollector> > m_eventDrivenCollectorMap;
/// Number of file probes that have been created.
uint32_t m_fileProbeCount;
--- a/src/stats/helper/gnuplot-helper.cc Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/helper/gnuplot-helper.cc Fri Mar 13 18:22:08 2015 -0400
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013 University of Washington
+ * Copyright (c) 2015 Bucknell University
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -30,7 +30,6 @@
#include "ns3/config.h"
#include "ns3/log.h"
#include "ns3/get-wildcard-matches.h"
-#include "ns3/scaling-factor.h"
namespace ns3 {
@@ -45,8 +44,7 @@
m_yLegend ("Y Values"),
m_terminalType ("png"),
m_mode (event_driven),
- m_plotPeriod (Seconds(1)),
- m_prefix (ScalingFactor::NP)
+ m_plotPeriod (Seconds(1))
{
NS_LOG_FUNCTION (this);
@@ -59,7 +57,7 @@
const std::string &xLegend,
const std::string &yLegend,
const std::string &terminalType,
- ScalingFactor::Prefix prefix)
+ const double eventDrivenCollectorScalingFactor)
: m_aggregator (0),
m_plotProbeCount (0),
m_outputFileNameWithoutExtension (outputFileNameWithoutExtension),
@@ -69,7 +67,7 @@
m_terminalType (terminalType),
m_mode (event_driven),
m_plotPeriod (Seconds(1)),
- m_prefix (prefix)
+ m_eventDrivenCollectorScalingFactor (eventDrivenCollectorScalingFactor)
{
NS_LOG_FUNCTION (this);
@@ -108,7 +106,8 @@
const std::string &xLegend,
const std::string &yLegend,
const std::string &terminalType,
- ScalingFactor::Prefix prefix)
+ const double eventDrivenCollectorScalingFactor)
+
{
NS_LOG_FUNCTION (this << outputFileNameWithoutExtension << title
<< xLegend << yLegend << terminalType);
@@ -126,7 +125,7 @@
m_xLegend = xLegend;
m_yLegend = yLegend;
m_terminalType = terminalType;
- m_prefix = prefix;
+ m_eventDrivenCollectorScalingFactor = eventDrivenCollectorScalingFactor;
// Construct the aggregator.
ConstructAggregator ();
@@ -291,24 +290,27 @@
}
void
-GnuplotHelper::AddDoubleEventDrivenCollector (const std::string &collectorName)
+GnuplotHelper::AddEventDrivenCollector (const std::string &collectorName)
{
NS_LOG_FUNCTION (this << collectorName);
// See if this event driven collector had already been added.
if (m_eventDrivenCollectorMap.count (collectorName) > 0)
{
- NS_ABORT_MSG ("That DoubleEventDrivenCollector has already been added");
+ NS_ABORT_MSG ("That EventDrivenCollector has already been added");
}
- // Create the DoubleEventDrivenCollector.
- Ptr<DoubleEventDrivenCollector> doubleEventDrivenCollector = CreateObject<DoubleEventDrivenCollector> ();
+ // Create the EventDrivenCollector.
+ Ptr<EventDrivenCollector> eventDrivenCollector = CreateObject<EventDrivenCollector> ();
- // Enable logging of data for the DoubleEventDrivenCollector.
- doubleEventDrivenCollector->Enable ();
+ // Set the scaling factor of the EventDrivenCollector
+ eventDrivenCollector->SetScalingFactor(m_eventDrivenCollectorScalingFactor);
+
+ // Enable logging of data for the EventDrivenCollector.
+ eventDrivenCollector->Enable ();
// Add this collector to the map so that it can be used.
- m_eventDrivenCollectorMap[collectorName] = doubleEventDrivenCollector;
+ m_eventDrivenCollectorMap[collectorName] = eventDrivenCollector;
}
@@ -356,7 +358,6 @@
m_aggregator->SetTerminal (m_terminalType);
m_aggregator->SetTitle (m_title);
m_aggregator->SetLegend (m_xLegend, m_yLegend);
- m_aggregator->SetScalingFactorPrefix(m_prefix);
// Enable logging of data for the aggregator.
m_aggregator->Enable ();
@@ -403,11 +404,11 @@
AddProbe (typeId, probeName, path);
// check the mode and create a unique DoubleTimeDrivenCollector or
- // DoubleEventDrivenCollector for each probe.
+ // EventDrivenCollector for each probe.
if (m_mode == time_driven) {
AddDoubleTimeDrivenCollector (probeContext);
} else {
- AddDoubleEventDrivenCollector (probeContext);
+ AddEventDrivenCollector (probeContext);
}
// Connect the probe to the adaptor.
@@ -421,7 +422,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkDouble,
+ MakeCallback (&EventDrivenCollector::TraceSinkDouble,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -435,7 +436,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkBoolean,
+ MakeCallback (&EventDrivenCollector::TraceSinkBoolean,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -449,7 +450,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -463,7 +464,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -477,7 +478,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -491,7 +492,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -505,7 +506,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger8,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger8,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -519,7 +520,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger16,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger16,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -533,7 +534,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkUinteger32,
+ MakeCallback (&EventDrivenCollector::TraceSinkUinteger32,
m_eventDrivenCollectorMap[probeContext]));
}
}
@@ -547,7 +548,7 @@
} else {
m_probeMap[probeName].first->TraceConnectWithoutContext
(probeTraceSource,
- MakeCallback (&DoubleEventDrivenCollector::TraceSinkDouble,
+ MakeCallback (&EventDrivenCollector::TraceSinkDouble,
m_eventDrivenCollectorMap[probeContext]));
}
--- a/src/stats/helper/gnuplot-helper.h Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/helper/gnuplot-helper.h Fri Mar 13 18:22:08 2015 -0400
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013 University of Washington
+ * Copyright (c) 2015 Bucknell University
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -30,9 +30,8 @@
#include "ns3/probe.h"
#include "ns3/gnuplot-aggregator.h"
#include "ns3/double-time-driven-collector.h"
-#include "ns3/double-event-driven-collector.h"
+#include "ns3/event-driven-collector.h"
#include "ns3/nstime.h"
-#include "ns3/scaling-factor.h"
namespace ns3 {
@@ -60,8 +59,8 @@
* \param yLegend the legend for the y vertical axis.
* \param terminalType terminal type setting string for output. The
* default terminal type is "png"
- * \param prefix the scaling factor prefix. The default prefix is "NP",
- * meaning there is no prefix.
+ * \param eventDrivenCollectorScalingFactor the scaling factor of
+ * the EventDrivenCollector. The default is 1
*
* Constructs a gnuplot helper that will create a space separated
* gnuplot data file named outputFileNameWithoutExtension + ".dat",
@@ -74,7 +73,7 @@
const std::string &xLegend,
const std::string &yLegend,
const std::string &terminalType = "png",
- ScalingFactor::Prefix prefix = ScalingFactor::NP);
+ const double eventDrivenCollectorScalingFactor = 1);
virtual ~GnuplotHelper ();
@@ -118,8 +117,8 @@
* \param yLegend the legend for the y vertical axis.
* \param terminalType terminal type setting string for output. The
* default terminal type is "png"
- * \param prefix the scaling factor prefix. The default prefix is "NP",
- * meaning there is no prefix.
+ * \param eventDrivenCollectorScalingFactor the scaling factor of
+ * the EventDrivenCollector. The default is 1
*
* Configures plot related parameters for this gnuplot helper so
* that it will create a space separated gnuplot data file named
@@ -132,8 +131,8 @@
const std::string &title,
const std::string &xLegend,
const std::string &yLegend,
- const std::string &terminalType = "png",
- ScalingFactor::Prefix prefix = ScalingFactor::NP);
+ const std::string &terminalType = "png",
+ const double eventDrivenCollectorScalingFactor = 1);
/**
* \param typeId the type ID for the probe used when it is created.
@@ -172,15 +171,19 @@
* \param collectorName the DoubleTimeDrivenCollector's name.
*
* \brief Adds a DoubleTimeDrivenCollector to be used to make the plot.
+ *
+ * This function creates and adds a DoubleTimeDrivenCollector object based on the collectorName
*/
void AddDoubleTimeDrivenCollector (const std::string &collectorName);
/**
- * \param collectorName the DoubleEventDrivenCollector's name.
+ * \param collectorName the EventDrivenCollector's name.
+ *
+ * \brief Adds a EventDrivenCollector to be used to make the plot.
*
- * \brief Adds a DoubleEventDrivenCollector to be used to make the plot.
+ * This function creates and adds a EventDrivenCollector object based on the collectorName
*/
- void AddDoubleEventDrivenCollector (const std::string &collectorName);
+ void AddEventDrivenCollector (const std::string &collectorName);
/**
* \param probeName the probe's name.
@@ -247,8 +250,8 @@
/// Maps DoubleTimeDrivenCollector names to DoubleTimeDrivenCollectors.
std::map<std::string, Ptr<DoubleTimeDrivenCollector> > m_timeDrivenCollectorMap;
- /// Maps DoubleEventDrivenCollect names to DoubleEventDrivenCollectors.
- std::map<std::string, Ptr<DoubleEventDrivenCollector> > m_eventDrivenCollectorMap;
+ /// Maps DoubleEventDrivenCollect names to EventDrivenCollectors.
+ std::map<std::string, Ptr<EventDrivenCollector> > m_eventDrivenCollectorMap;
/// Number of plot probes that have been created.
uint32_t m_plotProbeCount;
@@ -271,9 +274,11 @@
/// The mode of the GnuplotHelper.
Mode m_mode;
+ /// Time period for the TimeDrivenCollector
Time m_plotPeriod;
-
- ScalingFactor::Prefix m_prefix;
+
+ /// The scaling factor of the EventDrivenCollector
+ double m_eventDrivenCollectorScalingFactor;
}; // class GnuplotHelper
--- a/src/stats/model/double-event-driven-collector.cc Tue Mar 03 14:41:09 2015 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2014 Bucknell University
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Li Li (ll024@bucknell.edu)
- */
-
-#include "ns3/object.h"
-#include "ns3/log.h"
-#include "ns3/simulator.h"
-#include "ns3/double-event-driven-collector.h"
-
-
-NS_LOG_COMPONENT_DEFINE("DoubleEventDrivenCollector");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (DoubleEventDrivenCollector);
-
-TypeId
-DoubleEventDrivenCollector::GetTypeId(void)
-{
- static TypeId tid = TypeId("ns3::DoubleEventDrivenCollector")
- .SetParent<DataCollectionObject> ()
- .AddConstructor<DoubleEventDrivenCollector> ()
- .AddTraceSource("Output",
- "The double value received by the trace sink",
- MakeTraceSourceAccessor (&DoubleEventDrivenCollector::m_output))
- ;
- return tid;
-}
-
-DoubleEventDrivenCollector::DoubleEventDrivenCollector()
- : m_outputScalingFactor (1)
-{
- NS_LOG_FUNCTION(this);
-}
-
-DoubleEventDrivenCollector::~DoubleEventDrivenCollector()
-{
- NS_LOG_FUNCTION(this);
-}
-
-void
-DoubleEventDrivenCollector::TraceSinkDouble(double oldValue, double newValue)
-{
- NS_LOG_FUNCTION(this << oldValue << newValue);
- if (!IsEnabled())
- {
- NS_LOG_DEBUG("Collector not enabled");
- return;
- }
- m_doubleValue = newValue * m_outputScalingFactor;
- ReportData();
-}
-
-void
-DoubleEventDrivenCollector::TraceSinkBoolean(bool oldValue, bool newValue)
-{
- NS_LOG_FUNCTION(this << oldValue << newValue);
- TraceSinkDouble(oldValue, newValue);
-}
-
-void
-DoubleEventDrivenCollector::TraceSinkUinteger32(uint32_t oldValue, uint32_t newValue)
-{
- NS_LOG_FUNCTION(this << oldValue << newValue);
- TraceSinkDouble(oldValue, newValue);
-}
-
-void
-DoubleEventDrivenCollector::TraceSinkUinteger16(uint16_t oldValue, uint16_t newValue)
-{
- NS_LOG_FUNCTION(this << oldValue << newValue);
- TraceSinkDouble(oldValue, newValue);
-}
-
-void
-DoubleEventDrivenCollector::TraceSinkUinteger8(uint8_t oldValue, uint8_t newValue)
-{
- NS_LOG_FUNCTION(this << oldValue << newValue);
- TraceSinkDouble(oldValue, newValue);
-}
-
-void
-DoubleEventDrivenCollector::ReportData(void)
-{
- NS_LOG_FUNCTION(this);
- if (!IsEnabled()) {
- return;
- }
- double time = Simulator::Now ().GetSeconds();
- m_output(time, m_doubleValue);
-}
-
-void
-DoubleEventDrivenCollector::SetScalingFactor(double scalingFactor)
-{
- NS_LOG_FUNCTION(this);
- m_outputScalingFactor = scalingFactor;
-}
-
-} // namespace ns3
--- a/src/stats/model/double-event-driven-collector.h Tue Mar 03 14:41:09 2015 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2014 Bucknell University
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Li Li (ll024@bucknell.edu)
- */
-
-
-#ifndef DOUBLE_EVENT_DRIVEN_COLLECTOR_H
-#define DOUBLE_EVENT_DRIVEN_COLLECTOR_H
-
-#include "ns3/object.h"
-#include "ns3/data-collection-object.h"
-#include "ns3/event-id.h"
-#include "ns3/type-id.h"
-#include "ns3/traced-value.h"
-
-namespace ns3 {
-
-class DoubleEventDrivenCollector : public DataCollectionObject
-{
-public:
- static TypeId GetTypeId(void);
-
- DoubleEventDrivenCollector();
- virtual ~DoubleEventDrivenCollector();
-
- void TraceSinkDouble(double oldValue, double newValue);
- void TraceSinkBoolean(bool oldValue, bool newValue);
- void TraceSinkUinteger32(uint32_t oldValue, uint32_t newValue);
- void TraceSinkUinteger16(uint16_t oldValue, uint16_t newValue);
- void TraceSinkUinteger8(uint8_t oldValue, uint8_t newValue);
- void SetScalingFactor(double scalingFactor = 1);
-
-protected:
-
- TracedCallback<double, double> m_output;
- double m_outputScalingFactor;
-
-private:
- void ReportData(void);
- // keep track of the double value received by the trace sink
- double m_doubleValue;
-};
-
-} //namespace ns3
-
-#endif // DOUBLE_EVENT_DRIVEN_COLLECTOR_H
--- a/src/stats/model/gnuplot-aggregator.cc Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/model/gnuplot-aggregator.cc Fri Mar 13 18:22:08 2015 -0400
@@ -26,7 +26,6 @@
#include "gnuplot-aggregator.h"
#include "ns3/abort.h"
#include "ns3/log.h"
-#include "ns3/scaling-factor.h"
namespace ns3 {
@@ -106,7 +105,7 @@
void
GnuplotAggregator::Write2d (std::string context, double x, double y)
{
- NS_LOG_FUNCTION (this << context << x << m_scalingFactor.ConvertValue(y));
+ NS_LOG_FUNCTION (this << context << x);
if (m_2dDatasetMap.count (context) == 0)
{
@@ -116,7 +115,7 @@
if (m_enabled)
{
// Add this 2D data point to its dataset.
- m_2dDatasetMap[context].Add (x, m_scalingFactor.ConvertValue(y));
+ m_2dDatasetMap[context].Add (x, y);
}
}
@@ -126,7 +125,7 @@
double y,
double errorDelta)
{
- NS_LOG_FUNCTION (this << context << x << m_scalingFactor.ConvertValue(y) << errorDelta);
+ NS_LOG_FUNCTION (this << context << x << y << errorDelta);
if (m_2dDatasetMap.count (context) == 0)
{
@@ -136,7 +135,7 @@
if (m_enabled)
{
// Add this 2D data point with its error bar to its dataset.
- m_2dDatasetMap[context].Add (x, m_scalingFactor.ConvertValue(y), errorDelta);
+ m_2dDatasetMap[context].Add (x,y, errorDelta);
}
}
@@ -146,7 +145,7 @@
double y,
double errorDelta)
{
- NS_LOG_FUNCTION (this << context << x << m_scalingFactor.ConvertValue(y) << errorDelta);
+ NS_LOG_FUNCTION (this << context << x << y << errorDelta);
if (m_2dDatasetMap.count (context) == 0)
{
@@ -156,7 +155,7 @@
if (m_enabled)
{
// Add this 2D data point with its error bar to its dataset.
- m_2dDatasetMap[context].Add (x, m_scalingFactor.ConvertValue(y), errorDelta);
+ m_2dDatasetMap[context].Add (x, y, errorDelta);
}
}
@@ -167,7 +166,7 @@
double xErrorDelta,
double yErrorDelta)
{
- NS_LOG_FUNCTION (this << context << x << m_scalingFactor.ConvertValue(y) << xErrorDelta << yErrorDelta);
+ NS_LOG_FUNCTION (this << context << x << y << xErrorDelta << yErrorDelta);
if (m_2dDatasetMap.count (context) == 0)
{
@@ -177,7 +176,7 @@
if (m_enabled)
{
// Add this 2D data point with its error bar to its dataset.
- m_2dDatasetMap[context].Add (x, m_scalingFactor.ConvertValue(y), xErrorDelta, yErrorDelta);
+ m_2dDatasetMap[context].Add (x, y, xErrorDelta, yErrorDelta);
}
}
@@ -204,8 +203,7 @@
GnuplotAggregator::SetLegend (const std::string &xLegend, const std::string &yLegend)
{
NS_LOG_FUNCTION (this << xLegend << yLegend);
- m_gnuplot.SetLegend (xLegend, yLegend + " (" +
- m_scalingFactor.GetPrefixString() +")");
+ m_gnuplot.SetLegend (xLegend, yLegend);
m_xAndYLegendsSet = true;
}
@@ -361,17 +359,5 @@
m_gnuplot.AppendExtra (output.str ());
}
-void
-GnuplotAggregator::SetScalingFactorPrefix(enum ScalingFactor::Prefix prefix)
-{
- m_scalingFactor.SetPrefix(prefix);
-}
-
-enum ScalingFactor::Prefix
-GnuplotAggregator::GetScalingFactorPrefix()
-{
- return m_scalingFactor.GetPrefix();
-}
-
} // namespace ns3
--- a/src/stats/model/gnuplot-aggregator.h Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/model/gnuplot-aggregator.h Fri Mar 13 18:22:08 2015 -0400
@@ -262,18 +262,6 @@
void AddVerticalReferenceLine (double x);
void AddHorizontalReferenceLine (double y);
- /**
- * \param prefix the prefix of the scaling factor.
- *
- * \brief Set the scaling factor of the output data
- */
- void SetScalingFactorPrefix(enum ScalingFactor::Prefix prefix);
-
- /**
- * \brief Get the current scaling factor of the output data
- */
- enum ScalingFactor::Prefix GetScalingFactorPrefix();
-
private:
/// The output file name without any extension.
std::string m_outputFileNameWithoutExtension;
@@ -309,9 +297,6 @@
/// Maps context strings to 2D datasets.
std::map<std::string, Gnuplot2dDataset> m_2dDatasetMap;
- /// The Scaling factor
- ScalingFactor m_scalingFactor;
-
}; // class GnuplotAggregator
--- a/src/stats/test/double-event-driven-collector-test-suite.cc Tue Mar 03 14:41:09 2015 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014 Bucknell University
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Li Li (ll024@bucknell.edu)
- */
-
-#include <iostream>
-#include <string>
-#include "ns3/double-event-driven-collector.h"
-#include "ns3/double-probe.h"
-#include "ns3/test.h"
-#include "ns3/core-module.h"
-
-using namespace ns3;
-
-class DoubleEventDrivenCollectorSampleEmitter : public Object
-{
-public:
- static TypeId GetTypeId (void);
- DoubleEventDrivenCollectorSampleEmitter ()
- {
- }
- virtual ~DoubleEventDrivenCollectorSampleEmitter ()
- {
- }
- void Start ()
- {
- Reschedule ();
- }
- void Reschedule ()
- {
- m_time = m_var.GetValue ();
- Simulator::Schedule (Seconds (m_time), &DoubleEventDrivenCollectorSampleEmitter::Report, this);
- m_time += Simulator::Now ().GetSeconds ();
- }
- double GetTime ()
- {
- return m_time;
- }
- double GetValue ()
- {
- return aux;
- }
-private:
- void Report ()
- {
- aux = m_var.GetValue ();
- m_trace = aux;
- Reschedule ();
- }
- ExponentialVariable m_var;
- double m_time;
- TracedValue<double> m_trace;
- double aux;
-};
-
-
-TypeId
-DoubleEventDrivenCollectorSampleEmitter::GetTypeId (void)
-{
- static TypeId tid = TypeId ("DoubleEventDrivenCollectorSampleEmitter")
- .SetParent<Object> ()
- .AddTraceSource ("Emitter", "XX", MakeTraceSourceAccessor (&DoubleEventDrivenCollectorSampleEmitter::m_trace))
- ;
- return tid;
-}
-
-
-// ===========================================================================
-// Test case
-// ===========================================================================
-
-class DoubleEventDrivenCollectorTestCase1 : public TestCase
-{
-public:
- DoubleEventDrivenCollectorTestCase1 ();
- virtual ~DoubleEventDrivenCollectorTestCase1 ();
-
-private:
- virtual void DoRun (void);
- void TraceSinkCallback(std::string context, double oldValue, double newValue);
- void ReceiveDouble(std::string context, double oldValue, double newValue);
- double receivedDouble;
- Ptr<DoubleEventDrivenCollector> collector ;
- Ptr<DoubleEventDrivenCollectorSampleEmitter> s;
-};
-
-DoubleEventDrivenCollectorTestCase1::DoubleEventDrivenCollectorTestCase1 ()
- : TestCase ("DoubleEventDrivenCollector test case 1")
-{
- collector = CreateObject<DoubleEventDrivenCollector> ();
- s = CreateObject<DoubleEventDrivenCollectorSampleEmitter> ();
-}
-
-DoubleEventDrivenCollectorTestCase1::~DoubleEventDrivenCollectorTestCase1 ()
-{
-}
-
-void
-DoubleEventDrivenCollectorTestCase1::DoRun (void)
-{
- Ptr<DoubleProbe> p = CreateObject<DoubleProbe> ();
- p->SetName ("DoubleEventDrivenCollectorSampleProbe");
-
- Simulator::Schedule (Seconds (1), &DoubleEventDrivenCollectorSampleEmitter::Start, s);
- p->SetAttribute ("Start", TimeValue (Seconds (100.0)));
- p->SetAttribute ("Stop", TimeValue (Seconds (200.0)));
- Simulator::Stop (Seconds (300));
-
- Names::Add ("/Names/DoubleEventDrivenCollectorSampleEmitter", s);
-
- // Hook probe to the emitter.
- p->ConnectByObject ("Emitter", s);
-
- // update the variable that keeps track of the data received
- bool connected = p ->TraceConnect ("Output", p-> GetName(), MakeCallback (&DoubleEventDrivenCollectorTestCase1::ReceiveDouble, this));
- NS_UNUSED (connected);
-
- // Hook the collector to the probe
- connected = p ->TraceConnectWithoutContext ("Output", MakeCallback (&DoubleEventDrivenCollector::TraceSinkDouble, collector));
-
- // connect the collector to the TraceSinkCallback.
- connected = collector-> TraceConnect("Output", p->GetName(), MakeCallback(&DoubleEventDrivenCollectorTestCase1::TraceSinkCallback, this));
-
- Simulator::Run ();
- Simulator::Destroy ();
-}
-
-void
-DoubleEventDrivenCollectorTestCase1::TraceSinkCallback(std::string context, double oldValue, double newValue)
-{
- NS_TEST_ASSERT_MSG_EQ_TOL (receivedDouble, newValue, 0.0001, "Value generated by the collector different than the actual value");
-}
-
-void
-DoubleEventDrivenCollectorTestCase1::ReceiveDouble(std::string context, double oldValue, double newValue)
-{
- receivedDouble = newValue;
-}
-
-
-class DoubleEventDrivenCollectorTestSuite : public TestSuite
-{
-public:
- DoubleEventDrivenCollectorTestSuite();
-};
-
-DoubleEventDrivenCollectorTestSuite::DoubleEventDrivenCollectorTestSuite()
- : TestSuite("double-event-driven-collector", UNIT)
-{
- AddTestCase(new DoubleEventDrivenCollectorTestCase1, TestCase::QUICK);
-}
-
-static DoubleEventDrivenCollectorTestSuite DoubleEventDrivenCollectorTestSuite;
-
--- a/src/stats/wscript Tue Mar 03 14:41:09 2015 -0500
+++ b/src/stats/wscript Fri Mar 13 18:22:08 2015 -0400
@@ -39,7 +39,7 @@
'model/sum-collector.cc',
'model/batching-collector.cc',
'model/double-time-driven-collector.cc',
- 'model/double-event-driven-collector.cc',
+ 'model/event-driven-collector.cc',
'model/bivariate-collector.cc',
'model/steady-state-collector.cc',
'model/mean-crossings-steady-state-collector.cc',
@@ -57,7 +57,7 @@
'test/basic-stats-collector-test-suite.cc',
'test/sum-collector-test-suite.cc',
'test/batching-collector-test-suite.cc',
- 'test/double-event-driven-collector-test-suite.cc',
+ 'test/event-driven-collector-test-suite.cc',
'test/double-time-driven-collector-test-suite.cc',
'test/bivariate-collector-test-suite.cc',
'test/steady-state-collector-test-suite.cc',
@@ -94,7 +94,7 @@
'model/sum-collector.h',
'model/batching-collector.h',
'model/double-time-driven-collector.h',
- 'model/double-event-driven-collector.h',
+ 'model/event-driven-collector.h',
'model/bivariate-collector.h',
'model/steady-state-collector.h',
'model/mean-crossings-steady-state-collector.h',