30#include "ns3/core-module.h"
31#include "ns3/stats-module.h"
68 .SetGroupName (
"Stats")
70 .AddTraceSource (
"Counter",
73 "ns3::TracedValueCallback::Double")
82 m_var = CreateObject<ExponentialRandomVariable> ();
101int main (
int argc,
char *argv[])
104 cmd.Parse (argc, argv);
112 Names::Add (
"/Names/Emitter", emitter);
123 FileAggregator::FORMATTED);
126 fileHelper.
Set2dFormat (
"Time (Seconds) = %.3f\tCount = %.0f");
130 fileHelper.
WriteProbe (
"ns3::Uinteger32Probe",
131 "/Names/Emitter/Counter",
138 Simulator::Stop (
Seconds (100.0));
140 Simulator::Destroy ();
This is our test object, an object that increments counters at various times and emits one of them as...
static TypeId GetTypeId(void)
Register this type.
TracedValue< uint32_t > m_counter
Simple counter.
TracedValue< double > m_counter
Sample counter, normally this would be integer type.
void Count(void)
Counts how many time this function is called.
void DoInitialize(void)
Initialize() implementation.
Ptr< ExponentialRandomVariable > m_var
Random number generator.
static TypeId GetTypeId(void)
Register this type.
Parse command-line arguments.
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
Helper class used to put data values into a file.
void Set2dFormat(const std::string &format)
Sets the 2D format string for the C-style sprintf() function.
void WriteProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource)
void ConfigureFile(const std::string &outputFileNameWithoutExtension, enum FileAggregator::FileType fileType=FileAggregator::SPACE_SEPARATED)
A base class which provides memory management and object aggregation.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.