changeset 5f32f9e3c65a in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=5f32f9e3c65a
description:
stats: remove simplescalar compatibility for printing
diffstat:
5 files changed, 76 insertions(+), 191 deletions(-)
src/base/stats/flags.hh | 4
src/base/stats/text.cc | 254 +++++++++++++----------------------------------
src/base/stats/text.hh | 3
src/python/m5/stats.py | 4
src/python/swig/stats.i | 2
diffs (truncated from 492 to 300 lines):
diff -r 3bbbdd324a60 -r 5f32f9e3c65a src/base/stats/flags.hh
--- a/src/base/stats/flags.hh Wed Apr 22 06:44:29 2009 -0700
+++ b/src/base/stats/flags.hh Wed Apr 22 10:25:14 2009 -0700
@@ -57,11 +57,9 @@
const StatFlags nozero = 0x00000100;
/** Don't print if this is NAN */
const StatFlags nonan = 0x00000200;
-/** Used for SS compatability. */
-const StatFlags __substat = 0x80000000;
/** Mask of flags that can't be set directly */
-const StatFlags __reserved = init | print | __substat;
+const StatFlags __reserved = init | print;
enum DisplayMode
{
diff -r 3bbbdd324a60 -r 5f32f9e3c65a src/base/stats/text.cc
--- a/src/base/stats/text.cc Wed Apr 22 06:44:29 2009 -0700
+++ b/src/base/stats/text.cc Wed Apr 22 10:25:14 2009 -0700
@@ -73,18 +73,18 @@
namespace Stats {
Text::Text()
- : mystream(false), stream(NULL), compat(false), descriptions(false)
+ : mystream(false), stream(NULL), descriptions(false)
{
}
Text::Text(std::ostream &stream)
- : mystream(false), stream(NULL), compat(false), descriptions(false)
+ : mystream(false), stream(NULL), descriptions(false)
{
open(stream);
}
Text::Text(const std::string &file)
- : mystream(false), stream(NULL), compat(false), descriptions(false)
+ : mystream(false), stream(NULL), descriptions(false)
{
open(file);
}
@@ -152,7 +152,7 @@
}
string
-ValueToString(Result value, int precision, bool compat)
+ValueToString(Result value, int precision)
{
stringstream val;
@@ -166,7 +166,7 @@
val.setf(ios::fixed);
val << value;
} else {
- val << (compat ? "<err: div-0>" : "no value");
+ val << "no_value";
}
return val.str();
@@ -178,7 +178,6 @@
string name;
string desc;
StatFlags flags;
- bool compat;
bool descriptions;
int precision;
Result pdf;
@@ -202,13 +201,8 @@
if (!isnan(cdf))
ccprintf(cdfstr, "%.2f%%", cdf * 100.0);
- if (compat && flags & __substat) {
- ccprintf(stream, "%32s %12s %10s %10s", name,
- ValueToString(value, precision, compat), pdfstr, cdfstr);
- } else {
- ccprintf(stream, "%-40s %12s %10s %10s", name,
- ValueToString(value, precision, compat), pdfstr, cdfstr);
- }
+ ccprintf(stream, "%-40s %12s %10s %10s", name,
+ ValueToString(value, precision), pdfstr, cdfstr);
if (descriptions) {
if (!desc.empty())
@@ -224,7 +218,6 @@
vector<string> subnames;
vector<string> subdescs;
StatFlags flags;
- bool compat;
bool descriptions;
int precision;
VResult vec;
@@ -245,12 +238,11 @@
}
}
- string base = name + (compat ? "_" : "::");
+ string base = name + "::";
ScalarPrint print;
print.name = name;
print.desc = desc;
- print.compat = compat;
print.precision = precision;
print.descriptions = descriptions;
print.flags = flags;
@@ -262,83 +254,32 @@
if (_size == 1) {
print.value = vec[0];
print(stream);
- } else if (!compat) {
- for (off_type i = 0; i < _size; ++i) {
- if (havesub && (i >= subnames.size() || subnames[i].empty()))
- continue;
+ return;
+ }
- print.name = base + (havesub ? subnames[i] : to_string(i));
- print.desc = subdescs.empty() ? desc : subdescs[i];
- print.value = vec[i];
+ for (off_type i = 0; i < _size; ++i) {
+ if (havesub && (i >= subnames.size() || subnames[i].empty()))
+ continue;
- if (_total && (flags & pdf)) {
- print.pdf = vec[i] / _total;
- print.cdf += print.pdf;
- }
+ print.name = base + (havesub ? subnames[i] : to_string(i));
+ print.desc = subdescs.empty() ? desc : subdescs[i];
+ print.value = vec[i];
- print(stream);
+ if (_total && flags & pdf) {
+ print.pdf = vec[i] / _total;
+ print.cdf += print.pdf;
}
- if (flags & ::Stats::total) {
- print.name = base + "total";
- print.desc = desc;
- print.value = total;
- print(stream);
- }
- } else {
- if (flags & ::Stats::total) {
- print.value = total;
- print(stream);
- }
+ print(stream);
+ }
- Result _pdf = 0.0;
- Result _cdf = 0.0;
- if (flags & dist) {
- ccprintf(stream, "%s.start_dist\n", name);
- for (off_type i = 0; i < _size; ++i) {
- print.name = havesub ? subnames[i] : to_string(i);
- print.desc = subdescs.empty() ? desc : subdescs[i];
- print.flags |= __substat;
- print.value = vec[i];
-
- if (_total) {
- _pdf = vec[i] / _total;
- _cdf += _pdf;
- }
-
- if (flags & pdf)
- print.pdf = _pdf;
- if (flags & cdf)
- print.cdf = _cdf;
-
- print(stream);
- }
- ccprintf(stream, "%s.end_dist\n", name);
- } else {
- for (off_type i = 0; i < _size; ++i) {
- if (havesub && subnames[i].empty())
- continue;
-
- print.name = base;
- print.name += havesub ? subnames[i] : to_string(i);
- print.desc = subdescs.empty() ? desc : subdescs[i];
- print.value = vec[i];
-
- if (_total) {
- _pdf = vec[i] / _total;
- _cdf += _pdf;
- } else {
- _pdf = _cdf = NAN;
- }
-
- if (flags & pdf) {
- print.pdf = _pdf;
- print.cdf = _cdf;
- }
-
- print(stream);
- }
- }
+ if (flags & ::Stats::total) {
+ print.pdf = NAN;
+ print.cdf = NAN;
+ print.name = base + "total";
+ print.desc = desc;
+ print.value = total;
+ print(stream);
}
}
@@ -347,7 +288,6 @@
string name;
string desc;
StatFlags flags;
- bool compat;
bool descriptions;
int precision;
@@ -390,7 +330,6 @@
desc = info.desc;
flags = info.flags;
precision = info.precision;
- compat = text->compat;
descriptions = text->descriptions;
fancy = params->fancy;
@@ -410,11 +349,10 @@
if (fancy) {
ScalarPrint print;
- string base = name + (compat ? "_" : "::");
+ string base = name + "::";
print.precision = precision;
print.flags = flags;
- print.compat = compat;
print.descriptions = descriptions;
print.desc = desc;
print.pdf = NAN;
@@ -443,24 +381,16 @@
total += data.cvec[i];
total += data.overflow;
- string base = name + (compat ? "." : "::");
+ string base = name + "::";
ScalarPrint print;
- print.desc = compat ? "" : desc;
+ print.desc = desc;
print.flags = flags;
- print.compat = compat;
print.descriptions = descriptions;
print.precision = precision;
print.pdf = NAN;
print.cdf = NAN;
- if (compat) {
- ccprintf(stream, "%-42s", base + "start_dist");
- if (descriptions && !desc.empty())
- ccprintf(stream, " # %s", desc);
- stream << endl;
- }
-
print.name = base + "samples";
print.value = data.samples;
print(stream);
@@ -469,100 +399,62 @@
print.value = data.min_val;
print(stream);
- if (!compat || data.underflow > 0.0) {
- print.name = base + "underflows";
- print.value = data.underflow;
- if (!compat && total) {
- print.pdf = data.underflow / total;
+ print.name = base + "underflows";
+ print.value = data.underflow;
+ if (total) {
+ print.pdf = data.underflow / total;
+ print.cdf += print.pdf;
+ }
+ print(stream);
+
+ for (off_type i = 0; i < size; ++i) {
+ stringstream namestr;
+ namestr << base;
+
+ Counter low = i * bucket_size + min;
+ Counter high = ::min(low + bucket_size, max);
+ namestr << low;
+ if (low < high)
+ namestr << "-" << high;
+
+ print.name = namestr.str();
+ print.value = data.cvec[i];
+ if (total) {
+ print.pdf = data.cvec[i] / total;
print.cdf += print.pdf;
}
print(stream);
}
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev