A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
des-metrics.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2016 LLNL
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
19
*/
20
21
#ifndef DESMETRICS_H
22
#define DESMETRICS_H
23
30
#include "
nstime.h
"
31
#include "
singleton.h
"
32
33
#include <stdint.h>
// uint32_t
34
#include <fstream>
35
#include <mutex>
36
#include <string>
37
#include <vector>
38
39
namespace
ns3
{
40
108
class
DesMetrics
:
public
Singleton
<DesMetrics>
109
{
110
public
:
111
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
(
void
);
144
145
private
:
146
148
void
Close
(
void
);
149
156
static
std::string
m_outputDir
;
157
158
bool
m_initialized
;
159
std::ofstream
m_os
;
160
char
m_separator
;
161
163
std::mutex
m_mutex
;
164
165
};
// class DesMetrics
166
167
168
}
// namespace ns3
169
170
#endif
/* DESMETRICS_H */
ns3::DesMetrics
Event trace data collector for the DES Metrics project.
Definition:
des-metrics.h:109
ns3::DesMetrics::Close
void Close(void)
Close the output file.
Definition:
des-metrics.cc:147
ns3::DesMetrics::m_initialized
bool m_initialized
Have we been initialized.
Definition:
des-metrics.h:158
ns3::DesMetrics::m_mutex
std::mutex m_mutex
Mutex to control access to the output file.
Definition:
des-metrics.h:163
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::m_separator
char m_separator
The separator between event records.
Definition:
des-metrics.h:160
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:102
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:108
ns3::DesMetrics::m_os
std::ofstream m_os
The output JSON trace file stream.
Definition:
des-metrics.h:159
ns3::DesMetrics::~DesMetrics
~DesMetrics(void)
Destructor, closes the trace file.
Definition:
des-metrics.cc:141
ns3::DesMetrics::m_outputDir
static std::string m_outputDir
Cache the last-used output directory.
Definition:
des-metrics.h:156
ns3::Singleton
A template singleton.
Definition:
singleton.h:61
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:103
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 Tue Feb 6 2024 19:21:16 for ns-3 by
1.9.1