A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
data-collector.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 Drexel University
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: Joe Kopena (tjkopena@cs.drexel.edu)
19
*/
20
21
#include "ns3/object.h"
22
#include "ns3/log.h"
23
24
#include "
data-collector.h
"
25
#include "
data-calculator.h
"
26
27
using namespace
ns3
;
28
29
NS_LOG_COMPONENT_DEFINE
(
"DataCollector"
);
30
31
//--------------------------------------------------------------
32
//----------------------------------------------
33
DataCollector::DataCollector
() {
34
NS_LOG_FUNCTION
(
this
);
35
// end DataCollector::DataCollector
36
}
37
38
DataCollector::~DataCollector
() {
39
NS_LOG_FUNCTION
(
this
);
40
// end DataCollector::~DataCollector
41
}
42
43
/* static */
44
TypeId
45
DataCollector::GetTypeId
(
void
)
46
{
47
static
TypeId
tid =
TypeId
(
"ns3::DataCollector"
)
48
.
SetParent
<
Object
> ()
49
.SetGroupName (
"Stats"
)
50
.AddConstructor<
DataCollector
> ()
51
;
52
return
tid;
53
}
54
55
void
DataCollector::DoDispose
() {
56
NS_LOG_FUNCTION
(
this
);
57
58
m_calcList
.clear ();
59
m_metadata
.clear ();
60
61
Object::DoDispose
();
62
// end DataCollector::DoDispose
63
}
64
65
void
66
DataCollector::DescribeRun
(std::string
experiment
,
67
std::string strategy,
68
std::string input,
69
std::string runID,
70
std::string description)
71
{
72
NS_LOG_FUNCTION
(
this
<<
experiment
<< strategy << input << runID << description);
73
74
m_experimentLabel
=
experiment
;
75
m_strategyLabel
= strategy;
76
m_inputLabel
= input;
77
m_runLabel
= runID;
78
m_description
= description;
79
80
// end DataCollector::DescribeRun
81
}
82
83
void
84
DataCollector::AddDataCalculator
(
Ptr<DataCalculator>
datac)
85
{
86
NS_LOG_FUNCTION
(
this
<< datac);
87
88
m_calcList
.push_back (datac);
89
90
// end DataCollector::AddDataCalculator
91
}
92
93
DataCalculatorList::iterator
94
DataCollector::DataCalculatorBegin
()
95
{
96
return
m_calcList
.begin ();
97
// end DataCollector::DataCalculatorBegin
98
}
99
DataCalculatorList::iterator
100
DataCollector::DataCalculatorEnd
()
101
{
102
return
m_calcList
.end ();
103
// end DataCollector::DataCalculatorEnd
104
}
105
106
void
107
DataCollector::AddMetadata
(std::string key, std::string value)
108
{
109
NS_LOG_FUNCTION
(
this
<< key << value);
110
111
std::pair<std::string, std::string> blob (key, value);
112
m_metadata
.push_back (blob);
113
// end DataCollector::AddMetadata
114
}
115
void
116
DataCollector::AddMetadata
(std::string key, uint32_t value)
117
{
118
NS_LOG_FUNCTION
(
this
<< key << value);
119
120
std::stringstream st;
121
st << value;
122
123
std::pair<std::string, std::string> blob (key, st.str ());
124
m_metadata
.push_back (blob);
125
// end DataCollector::AddMetadata
126
}
127
void
128
DataCollector::AddMetadata
(std::string key,
double
value)
129
{
130
NS_LOG_FUNCTION
(
this
<< key << value);
131
132
std::stringstream st;
133
st << value;
134
135
std::pair<std::string, std::string> blob (key, st.str ());
136
m_metadata
.push_back (blob);
137
// end DataCollector::AddMetadata
138
}
139
140
MetadataList::iterator
141
DataCollector::MetadataBegin
()
142
{
143
return
m_metadata
.begin ();
144
// end DataCollector::MetadataBegin
145
}
146
MetadataList::iterator
147
DataCollector::MetadataEnd
()
148
{
149
return
m_metadata
.end ();
150
// end DataCollector::MetadataEnd
151
}
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
ns3::DataCollector::AddMetadata
void AddMetadata(std::string key, std::string value)
Add the key and the value as a pair of strings to the metadata list.
Definition:
data-collector.cc:107
ns3::DataCollector::DataCollector
DataCollector()
Definition:
data-collector.cc:33
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::DataCollector::AddDataCalculator
void AddDataCalculator(Ptr< DataCalculator > datac)
Add a DataCalculator object to the DataCollector.
Definition:
data-collector.cc:84
ns3::DataCollector::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition:
data-collector.cc:55
ns3::DataCollector
Collects data.
Definition:
data-collector.h:49
ns3::DataCollector::m_metadata
MetadataList m_metadata
List of experiment metadata.
Definition:
data-collector.h:155
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
ns3::Ptr< DataCalculator >
experiment
void experiment(std::string queue_disc_type)
Definition:
cobalt-vs-codel.cc:74
ns3::DataCollector::DescribeRun
void DescribeRun(std::string experiment, std::string strategy, std::string input, std::string runID, std::string description="")
Provide specific parameters to the DataCollector.
Definition:
data-collector.cc:66
ns3::DataCollector::m_strategyLabel
std::string m_strategyLabel
Strategy label.
Definition:
data-collector.h:150
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
ns3::DataCollector::DataCalculatorBegin
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
Definition:
data-collector.cc:94
ns3::DataCollector::~DataCollector
virtual ~DataCollector()
Definition:
data-collector.cc:38
ns3::DataCollector::MetadataEnd
MetadataList::iterator MetadataEnd()
Returns an iterator to the past-the-end of the metadata list.
Definition:
data-collector.cc:147
ns3::DataCollector::m_experimentLabel
std::string m_experimentLabel
Experiment label.
Definition:
data-collector.h:149
data-collector.h
ns3::DataCollector::m_description
std::string m_description
Description label.
Definition:
data-collector.h:153
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:244
ns3::DataCollector::MetadataBegin
MetadataList::iterator MetadataBegin()
Returns an iterator to the beginning of the metadata list.
Definition:
data-collector.cc:141
ns3::DataCollector::m_calcList
DataCalculatorList m_calcList
List of data calculators.
Definition:
data-collector.h:156
ns3::DataCollector::m_runLabel
std::string m_runLabel
Run label.
Definition:
data-collector.h:152
ns3::DataCollector::DataCalculatorEnd
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
Definition:
data-collector.cc:100
data-calculator.h
ns3::Object::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
object.cc:346
ns3::DataCollector::m_inputLabel
std::string m_inputLabel
Input label.
Definition:
data-collector.h:151
ns3::DataCollector::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
data-collector.cc:45
src
stats
model
data-collector.cc
Generated on Fri Oct 1 2021 17:03:36 for ns-3 by
1.8.20