25 #include "ns3/nstime.h" 53 .SetGroupName (
"Stats")
71 bool decimalPtSeen =
false;
72 bool exponentSeen =
false;
75 for (std::string::const_iterator it = s.begin (); it != s.end (); it++)
77 if ((*it ==
'.') && (decimalPtSeen))
81 else if ((*it ==
'e') && exponentSeen)
86 decimalPtSeen =
false;
88 else if (*it ==
'-' && it != s.begin () && last !=
'e')
101 std::ofstream scalarFile;
103 scalarFile.open (fn.c_str (), std::ios_base::out);
106 scalarFile <<
"run " << dc.
GetRunLabel () << std::endl;
108 <<
"\"" << std::endl;
110 <<
"\"" << std::endl;
112 <<
"\"" << std::endl;
114 <<
"\"" << std::endl;
118 std::pair<std::string, std::string> blob = (*i);
119 scalarFile <<
"attr \"" << blob.first <<
"\" \"" << blob.second <<
"\"" 123 scalarFile << std::endl;
125 scalarFile <<
"scalar . measurement \"" << dc.
GetInputLabel ()
126 <<
"\"" << std::endl;
130 std::pair<std::string, std::string> blob = (*i);
132 scalarFile <<
"scalar . \"" << blob.first <<
"\" \"" << blob.second <<
"\"" 140 (*i)->Output (callback);
143 scalarFile << std::endl << std::endl;
151 (std::ostream *scalar) :
168 (*m_scalar) <<
"statistic " << context <<
" " << name << std::endl;
170 (*m_scalar) <<
"field count " << statSum->
getCount () << std::endl;
172 (*m_scalar) <<
"field sum " << statSum->
getSum () << std::endl;
174 (*m_scalar) <<
"field mean " << statSum->
getMean () << std::endl;
176 (*m_scalar) <<
"field min " << statSum->
getMin () << std::endl;
178 (*m_scalar) <<
"field max " << statSum->
getMax () << std::endl;
180 (*m_scalar) <<
"field sqrsum " << statSum->
getSqrSum () << std::endl;
182 (*m_scalar) <<
"field stddev " << statSum->
getStddev () << std::endl;
196 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
211 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
226 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
241 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
256 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val.
GetTimeStep () << std::endl;
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
Simulation virtual time values and global simulation resolution.
Abstract Data Output Interface class s
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual double getMin() const =0
Returns the minimum of the values.
Outputs data in a format compatible with OMNeT library and framework.
Abstract class for calculating statistical data.
virtual double getSqrSum() const =0
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void Output(DataCollector &dc)
Outputs information from the provided DataCollector.
std::string GetInputLabel() const
Return the input label.
std::string GetStrategyLabel() const
Return the strategy label.
virtual ~OmnetDataOutput()
virtual double getStddev() const =0
Returns the standard deviation of the (weighted) observations.
virtual double getMean() const =0
Returns the mean of the (weighted) observations.
MetadataList::iterator MetadataBegin()
Returns an iterator to the beginning of the metadata list.
virtual double getMax() const =0
Returns the maximum of the values.
OmnetOutputCallback(std::ostream *scalar)
Constructor.
virtual void DoDispose()
Destructor implementation.
std::string GetExperimentLabel() const
Return the experiment label.
std::string GetDescription() const
Return the description label.
void OutputStatistic(std::string context, std::string name, const StatisticalSummary *statSum)
Generates data statistics.
Class to generate OMNeT output.
bool isNumeric(const std::string &s)
std::string GetRunLabel() const
Return the runID label.
std::string m_filePrefix
File prefix for the DataOutputInterface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Register this type.
virtual double getSum() const =0
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
bool isNaN(double x)
true if x is NaN
void OutputSingleton(std::string context, std::string name, int val)
Generates a single data output.
virtual void DoDispose()
Destructor implementation.
virtual long getCount() const =0
Returns the number of observations.
a unique identifier for an interface.
MetadataList::iterator MetadataEnd()
Returns an iterator to the past-the-end of the metadata list.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
int64_t GetTimeStep(void) const
Get the raw time value, in the current resolution unit.