Control the virtual time and the execution of simulation events. More...
Topics | |
| Realtime Simulator | |
| Realtime simulator implementation. | |
Files | |
| file | default-simulator-impl.cc |
| ns3::DefaultSimulatorImpl implementation. | |
| file | default-simulator-impl.h |
| ns3::DefaultSimulatorImpl declaration. | |
| file | des-metrics.cc |
| ns3::DesMetrics implementation. | |
| file | des-metrics.h |
| ns3::DesMetrics declaration. | |
| file | node-printer.cc |
| ns3::DefaultNodePrinter implementation. | |
| file | sample-simulator.cc |
| Example program demonstrating use of various Schedule functions. | |
| file | sample-simulator.py |
| Python example program demonstrating use of various Schedule functions. | |
| file | simulator-impl.cc |
| ns3::SimulatorImpl implementation. | |
| file | simulator-impl.h |
| ns3::SimulatorImpl declaration. | |
| file | simulator.cc |
| ns3::Simulator implementation, as well as implementation pointer, global scheduler implementation. | |
| file | simulator.h |
| ns3::Simulator declaration. | |
Classes | |
| class | ns3::DefaultSimulatorImpl |
| The default single process simulator implementation. More... | |
| class | ns3::DistributedSimulatorImpl |
| Distributed simulator implementation using lookahead. More... | |
| class | ns3::Simulator |
| Control the scheduling of simulation events. More... | |
| class | ns3::SimulatorImpl |
| The SimulatorImpl base class. More... | |
| class | ns3::VisualSimulatorImpl |
| A replacement simulator that starts the visualizer. More... | |
Functions | |
| static SimulatorImpl * | ns3::GetImpl () |
| Get the SimulatorImpl singleton. | |
| void | ns3::Initialize (std::vector< std::string > args, std::string outDir="") |
| Event trace data collector for the DES Metrics project. | |
| Time | ns3::Now () |
| create an ns3::Time instance which contains the current simulation time. | |
| static SimulatorImpl ** | ns3::PeekImpl () |
| Get the static SimulatorImpl instance. | |
Variables | |
| static GlobalValue | ns3::g_simTypeImpl |
| The specific simulator implementation to use. | |
Control the virtual time and the execution of simulation events.
|
static |
Get the SimulatorImpl singleton.
Definition at line 93 of file simulator.cc.
References ns3::ObjectFactory::Create(), DefaultNodePrinter(), DefaultTimePrinter(), g_schedTypeImpl, g_simTypeImpl, ns3::StringValue::Get(), GetPointer(), LogSetNodePrinter(), LogSetTimePrinter(), PeekImpl(), and ns3::ObjectFactory::SetTypeId().
Referenced by ns3::Simulator::Cancel(), ns3::Simulator::DoSchedule(), ns3::Simulator::DoScheduleDestroy(), ns3::Simulator::DoScheduleNow(), ns3::Simulator::GetContext(), ns3::Simulator::GetDelayLeft(), ns3::Simulator::GetEventCount(), ns3::Simulator::GetImplementation(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Simulator::GetSystemId(), ns3::Simulator::IsExpired(), ns3::Simulator::IsFinished(), ns3::Simulator::Now(), ns3::Simulator::Remove(), ns3::Simulator::Run(), ns3::Simulator::ScheduleWithContext(), ns3::Simulator::SetScheduler(), ns3::Simulator::Stop(), and ns3::Simulator::Stop().
| void ns3::Initialize | ( | std::vector< std::string > | args, |
| std::string | outDir = "" ) |
Event trace data collector for the DES Metrics project.
This feature generates a JSON file with event trace data, including the source and destination context for each event, and the (virtual) times when the event was scheduled and when it will execute.
See the DES Metrics Project page: https://github.com/wilseypa/desMetrics for more information and analysis tools.
If enabled (see below), ns-3 scripts should use CommandLine to parse arguments, which will open the JSON file with the same name as the script, and write the JSON header. Failure to use CommandLine when DES Metrics is enabled will put the trace data in the file desTraceFile.json instead. All examples accessible from test.py use CommandLine, and so generate JSON files.
Output from scripts ends up in the current working directory (normally the top level directory). When test.py is used to run tests or examples the trace files are generated in a time-stamped subdirectory of testpy-output/, which test.py normally deletes. To keep the output of examples, use the --retain argument to test.py.
The output file has the following form:
{
"simulator_name" : "ns-3",
"model_name" : "ipv4-raw",
"capture_date" : "Fri May 27 00:34:27 2016",
"command_line_arguments" : "ipv4-raw [ns3-dev-test-runner-debug] --test-name=ipv4-raw
--stop-on-failure --fullness=QUICK --xml --tempdir=testpy-output/2016-05-27-04-33-35-CUT
--out=testpy-output/2016-05-27-04-33-35-CUT/ipv4-raw.xml", "events" : [
["0",0,"0",0],
["1",0,"0",0],
["0",0,"0",0],
...
["0",0,"0",0]
]
} The first few fields are self-explanatory. The event record consists of the source context, the event send time, the destination context, and the event execution time. Times are given in the current Time resolution.
Enabling DES Metrics
Enable DES Metrics at configure time with
$ ns3 configure ... --enable-des-metrics
Working with DES Metrics
Some useful shell pipelines:
testpy-output/, so move there: */ class DesMetrics : public Singleton<DesMetrics> { public: /** Open the DesMetrics trace file and print the header.
The trace file will have the same base name as the main program, '.json' as the extension.
| args | [in] Command line arguments. |
| outDir | [in] Directory where the trace file should be written. |
References Initialize().
Referenced by Initialize(), and TraceWithContext().
| Time ns3::Now | ( | ) |
create an ns3::Time instance which contains the current simulation time.
This is really a shortcut for the ns3::Simulator::Now method. It is typically used as shown below to schedule an event which expires at the absolute time "2 seconds":
Definition at line 294 of file simulator.cc.
References ns3::Simulator::Now().
Referenced by ns3::dsr::DsrErrorBuffEntry::DsrErrorBuffEntry(), ns3::dsr::DsrLinkStab::DsrLinkStab(), ns3::dsr::DsrMaintainBuffEntry::DsrMaintainBuffEntry(), ns3::dsr::DsrNodeStab::DsrNodeStab(), ns3::dsr::DsrPassiveBuffEntry::DsrPassiveBuffEntry(), ns3::dsr::DsrRouteCacheEntry::DsrRouteCacheEntry(), ns3::dsr::DsrSendBuffEntry::DsrSendBuffEntry(), ns3::Event::Event(), ns3::aodv::QueueEntry::QueueEntry(), ns3::aodv::RoutingTableEntry::RoutingTableEntry(), ns3::SeqTsEchoHeader::SeqTsEchoHeader(), ns3::SeqTsHeader::SeqTsHeader(), ChannelAccessManagerTest< TxopType >::AddAccessRequestWithAckTimeout(), ChannelAccessManagerTest< TxopType >::AddAccessRequestWithSuccessfulAck(), ChannelAccessManagerTest< TxopType >::AddAckTimeoutReset(), ChannelAccessManagerTest< TxopType >::AddCcaBusyEvt(), ChannelAccessManagerTest< TxopType >::AddNavReset(), ChannelAccessManagerTest< TxopType >::AddNavStart(), ChannelAccessManagerTest< TxopType >::AddPhyDisconnectEvt(), ChannelAccessManagerTest< TxopType >::AddPhyOffEvt(), ChannelAccessManagerTest< TxopType >::AddPhyReconnectEvt(), ChannelAccessManagerTest< TxopType >::AddPhySleepEvt(), ChannelAccessManagerTest< TxopType >::AddRxErrorEvt(), ChannelAccessManagerTest< TxopType >::AddRxErrorEvt(), ChannelAccessManagerTest< TxopType >::AddRxInsideSifsEvt(), ChannelAccessManagerTest< TxopType >::AddRxOkEvt(), ChannelAccessManagerTest< TxopType >::AddRxStartEvt(), ChannelAccessManagerTest< TxopType >::AddSwitchingEvt(), ChannelAccessManagerTest< TxopType >::AddTxEvt(), ns3::UanMacRc::Associate(), ns3::ThreeGppChannelModel::CalcAttenuationOfBlockage(), ns3::UanPhyCalcSinrDual::CalcSinrDb(), ns3::WifiRemoteStationInfo::CalculateAveragingCoefficient(), ns3::ThreeGppChannelModel::ChannelParamsNeedsUpdate(), ns3::LteInterference::ConditionallyEvaluateChunk(), ns3::SpectrumInterference::ConditionallyEvaluateChunk(), ns3::SpectrumInterference::DoAddSignal(), ns3::PieQueueDisc::DoDequeue(), ns3::PieQueueDisc::DoEnqueue(), ns3::SpectrumInterference::DoSubtractSignal(), ns3::UanMacRcGw::EndCycle(), ns3::UanMacCw::EndTx(), ns3::UanMacAloha::Enqueue(), ns3::UanMacCw::Enqueue(), ChannelAccessManagerTest< TxopType >::ExpectBusy(), ns3::Watchdog::Expire(), ns3::UanMacRcGw::FindOptA(), ns3::JakesProcess::GetComplexGain(), ns3::WifiTxStatsHelper::GetDuration(), ns3::WifiTxStatsHelper::NotifyAcked(), ns3::UanMacCw::NotifyCcaEnd(), ns3::UanMacCw::NotifyCcaStart(), ns3::WifiTxStatsHelper::NotifyMacDropped(), ns3::UanMacCw::NotifyRxEndError(), ns3::UanMacCw::NotifyRxEndOk(), ns3::UanMacCw::NotifyRxStart(), ns3::UanMacCw::NotifyTxStart(), ns3::WifiTxStatsHelper::NotifyTxStart(), SimulatorEventsTestCase::NowUs(), ns3::Watchdog::Ping(), ns3::NixVectorRouting< T >::PrintRoutingPath(), ns3::aodv::RoutingProtocol::PrintRoutingTable(), ns3::dsdv::RoutingProtocol::PrintRoutingTable(), ns3::Ipv4GlobalRouting::PrintRoutingTable(), ns3::Ipv4ListRouting::PrintRoutingTable(), ns3::Ipv4StaticRouting::PrintRoutingTable(), ns3::Ipv6ListRouting::PrintRoutingTable(), ns3::Ipv6StaticRouting::PrintRoutingTable(), ns3::NixVectorRouting< T >::PrintRoutingTable(), ns3::olsr::RoutingProtocol::PrintRoutingTable(), ns3::Rip::PrintRoutingTable(), ns3::RipNg::PrintRoutingTable(), ns3::UanMacRc::ProcessAck(), ns3::UanTransducerHd::Receive(), ns3::UanMacRc::ReceiveOkFromPhy(), ns3::UanMacRcGw::ReceivePacket(), ns3::WifiTxStatsHelper::Reset(), Experiment::ResetData(), ns3::UanMacRc::RtsTimeout(), ns3::UanPhyDual::RxOkFromSubPhy(), ns3::UanMacCw::SaveTimer(), ns3::UanMacRc::ScheduleData(), ns3::UanMacCw::SendPacket(), ns3::UanMacRc::SendPacket(), ns3::UanMacRcGw::SendPacket(), ns3::UanPhyDual::SendPacket(), ns3::WaveformGenerator::Start(), ns3::WifiTxStatsHelper::Start(), ns3::Ping::StartApplication(), ns3::UanMacRcGw::StartCycle(), ns3::LteInterference::StartRx(), ns3::SpectrumInterference::StartRx(), ns3::UanMacCw::StartTimer(), ns3::WifiTxStatsHelper::Stop(), TraceFirstCwnd(), TraceFirstDctcp(), TraceFirstThroughput(), TraceThroughput(), TraceThroughput(), WaveformGeneratorTestCase::TraceWave(), ns3::SpectrumAnalyzer::UpdateEnergyReceivedSoFar(), Experiment::UpdatePositions(), and WriteAveragePowerSpectralDensityReport().
|
static |
Get the static SimulatorImpl instance.
Definition at line 80 of file simulator.cc.
Referenced by ns3::Simulator::Cancel(), ns3::Simulator::Destroy(), GetImpl(), ns3::Simulator::GetSystemId(), ns3::Simulator::IsExpired(), ns3::Simulator::Remove(), and ns3::Simulator::SetImplementation().
|
static |
The specific simulator implementation to use.
Must be derived from SimulatorImpl.
Definition at line 55 of file simulator.cc.
Referenced by GetImpl().