A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
des-metrics.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 LLNL
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
18
*/
19
20
#ifndef DESMETRICS_H
21
#define DESMETRICS_H
22
29
#include "
nstime.h
"
30
#include "
singleton.h
"
31
32
#include <fstream>
33
#include <mutex>
34
#include <stdint.h>
// uint32_t
35
#include <string>
36
#include <vector>
37
38
namespace
ns3
39
{
40
109
class
DesMetrics
:
public
Singleton
<DesMetrics>
110
{
111
public
:
121
void
Initialize
(std::vector<std::string> args, std::string outDir =
""
);
122
129
void
Trace
(
const
Time
& now,
const
Time
& delay);
130
138
void
TraceWithContext
(
uint32_t
context,
const
Time
& now,
const
Time
& delay);
139
143
~DesMetrics
()
override
;
144
145
private
:
147
void
Close
();
148
155
static
std::string
m_outputDir
;
156
157
bool
m_initialized
;
158
std::ofstream
m_os
;
159
char
m_separator
;
160
162
std::mutex
m_mutex
;
163
164
};
// class DesMetrics
165
166
}
// namespace ns3
167
168
#endif
/* DESMETRICS_H */
ns3::DesMetrics
Event trace data collector for the DES Metrics project.
Definition:
des-metrics.h:110
ns3::DesMetrics::~DesMetrics
~DesMetrics() override
Destructor, closes the trace file.
Definition:
des-metrics.cc:137
ns3::DesMetrics::m_initialized
bool m_initialized
Have we been initialized.
Definition:
des-metrics.h:157
ns3::DesMetrics::m_mutex
std::mutex m_mutex
Mutex to control access to the output file.
Definition:
des-metrics.h:162
ns3::DesMetrics::Initialize
void Initialize(std::vector< std::string > args, std::string outDir="")
Open the DesMetrics trace file and print the header.
Definition:
des-metrics.cc:42
ns3::DesMetrics::Close
void Close()
Close the output file.
Definition:
des-metrics.cc:143
ns3::DesMetrics::m_separator
char m_separator
The separator between event records.
Definition:
des-metrics.h:159
ns3::DesMetrics::Trace
void Trace(const Time &now, const Time &delay)
Trace an event to self at the time it is scheduled.
Definition:
des-metrics.cc:101
ns3::DesMetrics::TraceWithContext
void TraceWithContext(uint32_t context, const Time &now, const Time &delay)
Trace an event (with context) at the time it is scheduled.
Definition:
des-metrics.cc:107
ns3::DesMetrics::m_os
std::ofstream m_os
The output JSON trace file stream.
Definition:
des-metrics.h:158
ns3::DesMetrics::m_outputDir
static std::string m_outputDir
Cache the last-used output directory.
Definition:
des-metrics.h:155
ns3::Singleton
A template singleton.
Definition:
singleton.h:61
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
nstime.h
Declaration of classes ns3::Time and ns3::TimeWithUnit, and the TimeValue implementation classes.
singleton.h
ns3::Singleton declaration and template implementation.
src
core
model
des-metrics.h
Generated on Sun Jul 2 2023 18:21:31 for ns-3 by
1.9.6