25 #include "ns3/nstime.h"
52 .SetGroupName (
"Stats")
69 res =
m_sqliteOut->SpinExec (
"CREATE TABLE IF NOT EXISTS Experiments (run, experiment, strategy, input, description text)");
74 "INSERT INTO Experiments " \
75 "(run, experiment, strategy, input, description)" \
76 "values (?, ?, ?, ?, ?)");
105 res =
m_sqliteOut->WaitExec (
"CREATE TABLE IF NOT EXISTS " \
106 "Metadata ( run text, key text, value)");
110 "INSERT INTO Metadata " \
111 "(run, key, value)" \
118 std::pair<std::string, std::string> blob = (*i);
133 (*i)->Output (callback);
147 m_db->WaitExec (
"CREATE TABLE IF NOT EXISTS Singletons " \
148 "( run text, name text, variable text, value )");
151 "(run, name, variable, value)" \
152 "values (?, ?, ?, ?)");
158 m_db->SpinFinalize (m_insertSingletonStatement);
168 OutputSingleton (key,
variable +
"-count",
static_cast<double> (statSum->
getCount ()));
199 m_db->SpinReset (m_insertSingletonStatement);
200 m_db->Bind (m_insertSingletonStatement, 2, key);
201 m_db->Bind (m_insertSingletonStatement, 3,
variable);
202 m_db->Bind (m_insertSingletonStatement, 4, val);
203 m_db->SpinStep (m_insertSingletonStatement);
212 m_db->SpinReset (m_insertSingletonStatement);
213 m_db->Bind (m_insertSingletonStatement, 2, key);
214 m_db->Bind (m_insertSingletonStatement, 3,
variable);
215 m_db->Bind (m_insertSingletonStatement, 4, val);
216 m_db->SpinStep (m_insertSingletonStatement);
226 m_db->SpinReset (m_insertSingletonStatement);
227 m_db->Bind (m_insertSingletonStatement, 2, key);
228 m_db->Bind (m_insertSingletonStatement, 3,
variable);
229 m_db->Bind (m_insertSingletonStatement, 4, val);
230 m_db->SpinStep (m_insertSingletonStatement);
240 m_db->SpinReset (m_insertSingletonStatement);
241 m_db->Bind (m_insertSingletonStatement, 2, key);
242 m_db->Bind (m_insertSingletonStatement, 3,
variable);
243 m_db->Bind (m_insertSingletonStatement, 4, val);
244 m_db->SpinStep (m_insertSingletonStatement);
254 m_db->SpinReset (m_insertSingletonStatement);
255 m_db->Bind (m_insertSingletonStatement, 2, key);
256 m_db->Bind (m_insertSingletonStatement, 3,
variable);
257 m_db->Bind (m_insertSingletonStatement, 4, val.
GetTimeStep ());
258 m_db->SpinStep (m_insertSingletonStatement);
std::string GetExperimentLabel() const
Return the experiment label.
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
std::string GetDescription() const
Return the description label.
MetadataList::iterator MetadataBegin()
Returns an iterator to the beginning of the metadata list.
MetadataList::iterator MetadataEnd()
Returns an iterator to the past-the-end of the metadata list.
std::string GetStrategyLabel() const
Return the strategy label.
std::string GetRunLabel() const
Return the runID label.
std::string GetInputLabel() const
Return the input label.
Abstract Data Output Interface class s.
std::string m_filePrefix
File prefix for the DataOutputInterface.
Smart pointer class similar to boost::intrusive_ptr.
A C++ interface towards an SQLITE database.
Class to generate OMNeT output.
sqlite3_stmt * m_insertSingletonStatement
Pointer to a Sqlite3 singleton statement.
void OutputSingleton(std::string key, std::string variable, int val)
Generates a single data output.
SqliteOutputCallback(const Ptr< SQLiteOutput > &db, std::string run)
Constructor.
Ptr< SQLiteOutput > m_db
Db.
std::string m_runLabel
Run label.
void OutputStatistic(std::string key, std::string variable, const StatisticalSummary *statSum)
Generates data statistics.
~SqliteOutputCallback()
Destructor.
Outputs data in a format compatible with SQLite.
virtual void Output(DataCollector &dc) override
Outputs information from the provided DataCollector.
Ptr< SQLiteOutput > m_sqliteOut
Database.
virtual ~SqliteDataOutput() override
static TypeId GetTypeId(void)
Register this type.
Abstract class for calculating statistical data.
virtual double getMax() const =0
Returns the maximum of the values.
virtual double getStddev() const =0
Returns the standard deviation of the (weighted) observations.
virtual long getCount() const =0
Returns the number of observations.
virtual double getMin() const =0
Returns the minimum of the values.
virtual double getSum() const =0
virtual double getSqrSum() const =0
Simulation virtual time values and global simulation resolution.
int64_t GetTimeStep(void) const
Get the raw time value, in the current resolution unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
std::string variable
variable or class member
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool isNaN(double x)
true if x is NaN