26 #include "ns3/nstime.h"
54 .SetGroupName (
"Stats")
79 res = sqlite3_get_table (
m_db,
81 &result, &nrows, &ncols,
84 if (res != SQLITE_OK) {
107 sqlite3_free_table (result);
121 if (sqlite3_open (m_dbFile.c_str (), &
m_db)) {
122 NS_LOG_ERROR (
"Could not open sqlite3 database \"" << m_dbFile <<
"\"");
124 sqlite3_close (
m_db);
131 Exec (
"create table if not exists Experiments (run, experiment, strategy, input, description text)");
132 Exec (
"insert into Experiments (run,experiment,strategy,input,description) values ('" +
139 Exec (
"create table if not exists Metadata ( run text, key text, value)");
143 std::pair<std::string, std::string> blob = (*i);
144 Exec (
"insert into Metadata (run,key,value) values ('" +
146 blob.first +
"', '" +
154 (*i)->Output (callback);
158 sqlite3_close (
m_db);
170 m_owner->Exec (
"create table if not exists Singletons ( run text, name text, variable text, value )");
203 std::stringstream sstr;
204 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
205 m_runLabel <<
"', '" <<
209 m_owner->Exec (sstr.str ());
220 std::stringstream sstr;
221 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
222 m_runLabel <<
"', '" <<
226 m_owner->Exec (sstr.str ());
236 std::stringstream sstr;
237 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
238 m_runLabel <<
"', '" <<
242 m_owner->Exec (sstr.str ());
252 std::stringstream sstr;
253 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
254 m_runLabel <<
"', '" <<
256 variable <<
"', '" <<
258 m_owner->Exec (sstr.str ());
268 std::stringstream sstr;
269 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
270 m_runLabel <<
"', '" <<
274 m_owner->Exec (sstr.str ());
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.
Smart pointer class similar to boost::intrusive_ptr.
#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.
virtual ~SqliteDataOutput()
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.
std::string GetRunLabel() const
Return the runID label.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Class to generate OMNeT output.
virtual double getStddev() const =0
Returns the standard deviation 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.
virtual void DoDispose()
Destructor implementation.
std::string variable
variable or class member
std::string GetStrategyLabel() const
Return the strategy label.
std::string GetExperimentLabel() const
Return the experiment label.
SqliteOutputCallback(Ptr< SqliteDataOutput > owner, std::string run)
Constructor.
std::string m_filePrefix
File prefix for the DataOutputInterface.
Outputs data in a format compatible with SQLite.
int64_t GetTimeStep(void) const
Get the raw time value, in the current resolution unit.
virtual double getSum() const =0
static TypeId GetTypeId(void)
Register this type.
void OutputSingleton(std::string key, std::string variable, int val)
Generates a single data output.
std::string GetDescription() const
Return the description label.
virtual void DoDispose()
Destructor implementation.
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
sqlite3 * m_db
pointer to the SQL database
bool isNaN(double x)
true if x is NaN
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
void OutputStatistic(std::string key, std::string variable, const StatisticalSummary *statSum)
Generates data statistics.
std::string GetInputLabel() const
Return the input label.
int Exec(std::string exe)
Execute a sqlite3 query.
virtual long getCount() const =0
Returns the number of observations.
virtual void Output(DataCollector &dc)
Outputs information from the provided DataCollector.
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.