summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-07-22 23:59:12 -0400
committerNathan Binkert <binkertn@umich.edu>2004-07-22 23:59:12 -0400
commit1987dd82d181f76a4627273dd9345b4141a6b416 (patch)
treeac222bd57e153c36195386a949e5e14a5f474284 /base
parentc9e6a15196a87fd1aa923b9ee0f6ff736ad6d33b (diff)
downloadgem5-1987dd82d181f76a4627273dd9345b4141a6b416.tar.xz
Stats database fixes to avoid naming conflicts in the database
and to do proper dumping of non-binned stats. base/stats/mysql.cc: have configure return whether or not the stat is a printable stat. This avoids naming problems in the database. don't store non printable stats. dump non-binned stats into the special bin 0 base/stats/mysql.hh: have configure return whether or not the stat is a printable stat. This avoids naming problems in the database. --HG-- extra : convert_revision : e33b115d605226a838eee2e6489e03b8d77ffc02
Diffstat (limited to 'base')
-rw-r--r--base/stats/mysql.cc67
-rw-r--r--base/stats/mysql.hh5
2 files changed, 51 insertions, 21 deletions
diff --git a/base/stats/mysql.cc b/base/stats/mysql.cc
index a749b573a..523494743 100644
--- a/base/stats/mysql.cc
+++ b/base/stats/mysql.cc
@@ -486,7 +486,7 @@ MySql::configure()
}
-void
+bool
MySql::configure(const StatData &data, string type)
{
stat.init();
@@ -500,19 +500,25 @@ MySql::configure(const StatData &data, string type)
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()) {
@@ -535,7 +541,9 @@ MySql::configure(const VectorData &data)
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;
@@ -548,7 +556,8 @@ MySql::configure(const DistData &data)
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;
@@ -578,7 +587,9 @@ MySql::configure(const VectorDistData &data)
void
MySql::configure(const Vector2dData &data)
{
- configure(data, "VECTOR2D");
+ if (!configure(data, "VECTOR2D"))
+ return;
+
uint16_t statid = stat.setup();
if (!data.subnames.empty()) {
@@ -619,14 +630,21 @@ MySql::configure(const FormulaData &data)
}
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
@@ -647,15 +665,11 @@ MySql::output()
// 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();
@@ -664,6 +678,9 @@ MySql::output()
void
MySql::output(const ScalarData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
newdata.x = 0;
newdata.y = 0;
@@ -675,6 +692,9 @@ MySql::output(const ScalarData &data)
void
MySql::output(const VectorData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
newdata.y = 0;
@@ -740,6 +760,9 @@ MySql::output(const DistDataData &data)
void
MySql::output(const DistData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
newdata.y = 0;
output(data.data);
@@ -748,6 +771,9 @@ MySql::output(const DistData &data)
void
MySql::output(const VectorDistData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
int size = data.data.size();
@@ -760,6 +786,9 @@ MySql::output(const VectorDistData &data)
void
MySql::output(const Vector2dData &data)
{
+ if (!(data.flags & print))
+ return;
+
newdata.stat = find(data.id);
int index = 0;
diff --git a/base/stats/mysql.hh b/base/stats/mysql.hh
index fcbe8c5e0..5b6d8a138 100644
--- a/base/stats/mysql.hh
+++ b/base/stats/mysql.hh
@@ -37,6 +37,7 @@
namespace MySQL { class Connection; }
namespace Stats {
+class MainBin;
class DistDataData;
class MySqlRun;
bool MySqlConnected();
@@ -130,7 +131,7 @@ class MySql : public Output
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);
@@ -140,7 +141,7 @@ class MySql : public Output
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);