}
-void
+bool
MySql::configure(const StatData &data, string type)
{
stat.init();
stat.total = data.flags & total;
stat.pdf = data.flags & pdf;
stat.cdf = data.flags & cdf;
+
+ return stat.print;
}
void
MySql::configure(const ScalarData &data)
{
- configure(data, "SCALAR");
+ if (!configure(data, "SCALAR"))
+ return;
+
insert(data.id, stat.setup());
}
void
MySql::configure(const VectorData &data)
{
- configure(data, "VECTOR");
+ if (!configure(data, "VECTOR"))
+ return;
+
uint16_t statid = stat.setup();
if (!data.subnames.empty()) {
void
MySql::configure(const DistData &data)
{
- configure(data, "DIST");
+ if (!configure(data, "DIST"))
+ return;
+
if (!data.data.fancy) {
stat.size = data.data.size;
stat.min = data.data.min;
void
MySql::configure(const VectorDistData &data)
{
- configure(data, "VECTORDIST");
+ if (!configure(data, "VECTORDIST"))
+ return;
if (!data.data[0].fancy) {
stat.size = data.data[0].size;
void
MySql::configure(const Vector2dData &data)
{
- configure(data, "VECTOR2D");
+ if (!configure(data, "VECTOR2D"))
+ return;
+
uint16_t statid = stat.setup();
if (!data.subnames.empty()) {
}
void
-MySql::output(const string &bin)
+MySql::output(MainBin *bin)
{
- // set up new bin in database if there is a bin name
- newdata.bin = bin.empty() ? 0 : SetupBin(bin);
+ if (bin) {
+ bin->activate();
+ newdata.bin = SetupBin(bin->name());
+ } else {
+ newdata.bin = 0;
+ }
Database::stat_list_t::const_iterator i, end = Database::stats().end();
- for (i = Database::stats().begin(); i != end; ++i)
- (*i)->visit(*this);
+ for (i = Database::stats().begin(); i != end; ++i) {
+ StatData *stat = *i;
+ if (bin && stat->binned() || !bin && !stat->binned())
+ stat->visit(*this);
+ }
}
bool
// store sample #
newdata.tick = curTick;
- if (bins().empty()) {
- output(string(""));
- } else {
+ output(NULL);
+ if (!bins().empty()) {
bin_list_t::iterator i, end = bins().end();
- for (i = bins().begin(); i != end; ++i) {
- MainBin *bin = *i;
- bin->activate();
- output(bin->name());
- }
+ for (i = bins().begin(); i != end; ++i)
+ output(*i);
}
newdata.flush();
void
MySql::output(const ScalarData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
newdata.x = 0;
newdata.y = 0;
void
MySql::output(const VectorData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
newdata.y = 0;
void
MySql::output(const DistData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
newdata.y = 0;
output(data.data);
void
MySql::output(const VectorDistData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
int size = data.data.size();
void
MySql::output(const Vector2dData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
int index = 0;
namespace MySQL { class Connection; }
namespace Stats {
+class MainBin;
class DistDataData;
class MySqlRun;
bool MySqlConnected();
protected:
// Output helper
- void output(const std::string &bin);
+ void output(MainBin *bin);
void output(const DistDataData &data);
void output(const ScalarData &data);
void output(const VectorData &data);
void output(const FormulaData &data);
void configure();
- void configure(const StatData &data, std::string type);
+ bool configure(const StatData &data, std::string type);
void configure(const ScalarData &data);
void configure(const VectorData &data);
void configure(const DistData &data);