52   std::string model_name (
"desTraceFile");
 
   55       std::string arg0 = argv[0];
 
   58   std::string jsonFile = model_name + 
".json";
 
   61       DesMetrics::m_outputDir = outDir;
 
   63   if (DesMetrics::m_outputDir != 
"")
 
   70   const char * date = ctime (¤t_time);
 
   71   std::string capture_date (date, 24);  
 
   73   m_os.open (jsonFile.c_str ());
 
   74   m_os << 
"{" << std::endl;
 
   75   m_os << 
" \"simulator_name\" : \"ns-3\"," << std::endl;
 
   76   m_os << 
" \"model_name\" : \"" << model_name << 
"\"," << std::endl;
 
   77   m_os << 
" \"capture_date\" : \"" << capture_date << 
"\"," << std::endl;
 
   78   m_os << 
" \"command_line_arguments\" : \"";
 
   81       for (
int i = 0; i < argc; ++i) 
 
   83           if (i > 0) 
m_os << 
" ";
 
   89       m_os << 
"[argv empty or not available]";
 
   91   m_os << 
"\"," << std::endl;
 
   92   m_os << 
" \"events\" : [" << std::endl;
 
  112   std::ostringstream ss;
 
  127      << (now + delay).GetTimeStep () << 
"\"]";
 
  147   m_os << 
" ]" << std::endl;
 
  148   m_os << 
"}" << std::endl;
 
Simulation virtual time values and global simulation resolution. 
 
void Initialize(int argc, char *argv[], std::string outDir="")
Open the DesMetrics trace file and print the header. 
 
static uint32_t GetContext(void)
Get the current simulation context. 
 
std::ofstream m_os
The output JSON trace file stream. 
 
void Close(void)
Close the output file. 
 
ns3::Simulator declaration. 
 
ns3::DesMetrics declaration. 
 
std::list< std::string > Split(std::string path)
Split a file system path into directories according to the local path separator. 
 
ns3::SystemPath declarations. 
 
A class which provides a simple way to implement a Critical Section. 
 
~DesMetrics(void)
Destructor, closes the trace file. 
 
char m_separator
The separator between event records. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
SystemMutex m_mutex
Mutex to control access to the output file. 
 
void TraceWithContext(uint32_t context, const Time &now, const Time &delay)
Trace an event (with context) at the time it is scheduled. 
 
int64_t GetTimeStep(void) const 
Get the raw time value, in the current resolution unit. 
 
bool m_initialized
Have we been initialized. 
 
Flag for events not associated with any particular context. 
 
std::string Append(std::string left, std::string right)
Join two file system path elements. 
 
void Trace(const Time &now, const Time &delay)
Trace an event to self at the time it is scheduled. 
 
static std::string m_outputDir
Cache the last-used output directory.