30 #include "ns3/core-module.h"
31 #include "ns3/stats-module.h"
49 static TypeId GetTypeId (
void);
52 void DoInitialize (
void);
67 .SetGroupName (
"Stats")
69 .AddTraceSource (
"Counter",
72 "ns3::TracedValueCallback::Double")
81 m_var = CreateObject<ExponentialRandomVariable> ();
100 int main (
int argc,
char *argv[])
103 cmd.
Parse (argc, argv);
125 fileHelper.
Set2dFormat (
"Time (Seconds) = %.3f\tCount = %.0f");
129 fileHelper.
WriteProbe (
"ns3::Uinteger32Probe",
130 "/Names/Emitter/Counter",
#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.
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
TracedValue< double > m_counter
static TypeId GetTypeId(void)
Register this type.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Helper class used to put data values into a file.
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
void DoInitialize(void)
Initialize() implementation.
void ConfigureFile(const std::string &outputFileNameWithoutExtension, enum FileAggregator::FileType fileType=FileAggregator::SPACE_SEPARATED)
static Time Now(void)
Return the current simulation virtual time.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
void WriteProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource)
void Parse(int argc, char *argv[])
Parse the program arguments.
TracedValue< uint32_t > m_counter
A base class which provides memory management and object aggregation.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
void Set2dFormat(const std::string &format)
Sets the 2D format string for the C-style sprintf() function.