75#include "ns3/command-line.h"
77#include "ns3/nstime.h"
78#include "ns3/random-variable-stream.h"
79#include "ns3/simulator.h"
106 std::cout <<
"Replacing time printer function after Simulator::Run ()" << std::endl;
113main(
int argc,
char* argv[])
115 bool replaceTimePrinter =
false;
116 std::string resolution =
"Time::NS";
120 std::map<std::string, Time::Unit> resolutionMap = {
128 cmd.AddValue(
"replaceTimePrinter",
"replace time printing function", replaceTimePrinter);
129 cmd.AddValue(
"resolution",
"time resolution", resolution);
130 cmd.Parse(argc, argv);
132 auto search = resolutionMap.find(resolution);
133 if (search != resolutionMap.end())
140 if (replaceTimePrinter)
148 &UniformRandomVariable::SetAntithetic,
152 &UniformRandomVariable::SetAntithetic,
Parse command-line arguments.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
static void SetResolution(Unit resolution)
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
void LogSetTimePrinter(TimePrinter printer)
Set the TimePrinter function to be used to prepend log messages with the simulation time.
@ LOG_LEVEL_ALL
Print everything.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.