diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2004-03-11 18:52:29 -0500 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2004-03-11 18:52:29 -0500 |
commit | 3bc8cffc75c2e03a6a8fe5f4425940a16405f672 (patch) | |
tree | 1d44dba1a7dbd4aef6fad45753b7607928d3414a /base | |
parent | 1039028d408d5a374a67d8d3ecc640a0e6559fbb (diff) | |
parent | 2c60d7aa9e4b48f30ab8c48436ff2dfec8e390f2 (diff) | |
download | gem5-3bc8cffc75c2e03a6a8fe5f4425940a16405f672.tar.xz |
merge with m5 head
--HG--
extra : convert_revision : c90339248d1ee74df1c6b90a77ec9ea41f646311
Diffstat (limited to 'base')
-rw-r--r-- | base/statistics.cc | 14 | ||||
-rw-r--r-- | base/statistics.hh | 17 | ||||
-rw-r--r-- | base/trace.cc | 66 | ||||
-rw-r--r-- | base/trace.hh | 4 |
4 files changed, 83 insertions, 18 deletions
diff --git a/base/statistics.cc b/base/statistics.cc index 49294ad27..dce545f18 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -57,7 +57,7 @@ __nan() } #endif -#ifdef STAT_DEBUG +#ifdef DEBUG static int total_stats = 0; #endif @@ -409,6 +409,14 @@ DataAccess::setPrint() Database::StatDB().regPrint(this); } +StatData::StatData() + : flags(none), precision(-1), prereq(0) +{ +#ifdef DEBUG + number = total_stats++; +#endif +} + StatData::~StatData() { } @@ -443,8 +451,8 @@ bool StatData::baseCheck() const { if (!(flags & init)) { -#ifdef STAT_DEBUG - cprintf("this is stat number %d\n",(*i)->number); +#ifdef DEBUG + cprintf("this is stat number %d\n", number); #endif panic("Not all stats have been initialized"); return false; diff --git a/base/statistics.hh b/base/statistics.hh index d8b78fbff..0dad31a5a 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -60,12 +60,6 @@ #include "base/str.hh" #include "sim/host.hh" -// -// Un-comment this to enable weirdo-stat debugging -// -// #define STAT_DEBUG - - #ifndef NAN float __nan(); /** Define Not a number. */ @@ -146,10 +140,7 @@ struct StatData /** A pointer to a prerequisite Stat. */ const StatData *prereq; - StatData() - : flags(none), precision(-1), prereq(0) - {} - + StatData(); virtual ~StatData(); /** @@ -193,6 +184,10 @@ struct StatData * @return stat1's name is alphabetically before stat2's */ static bool less(StatData *stat1, StatData *stat2); + +#ifdef DEBUG + int number; +#endif }; struct ScalarDataBase : public StatData @@ -2503,7 +2498,7 @@ struct NoBin * binned. If the typedef is NoBin, nothing is binned. If it is * MainBin, then all stats are binned under that Bin. */ -#ifdef FS_MEASURE +#if defined(FS_MEASURE) typedef MainBin DefaultBin; #else typedef NoBin DefaultBin; diff --git a/base/trace.cc b/base/trace.cc index 156110376..e56bdb11b 100644 --- a/base/trace.cc +++ b/base/trace.cc @@ -208,8 +208,7 @@ PrintfRecord::dump(ostream &os) -RawDataRecord::RawDataRecord(Tick _cycle, - const uint8_t *_data, int _len) +RawDataRecord::RawDataRecord(Tick _cycle, const void *_data, int _len) : Record(_cycle), len(_len) { data = new uint8_t[len]; @@ -320,3 +319,66 @@ echoTrace(bool on) } } } + +extern "C" +void +printTraceFlags() +{ + using namespace Trace; + for (int i = 0; i < numFlagStrings; ++i) + if (flags[i]) + cprintf("%s\n", flagStrings[i]); +} + +void +tweakTraceFlag(const char *string, bool value) +{ + using namespace Trace; + std::string str(string); + + for (int i = 0; i < numFlagStrings; ++i) { + if (str != flagStrings[i]) + continue; + + int idx = i; + + if (idx < NumFlags) { + flags[idx] = value; + } else { + idx -= NumFlags; + if (idx >= NumCompoundFlags) { + ccprintf(cerr, "Invalid compound flag"); + return; + } + + const Flags *flagVec = compoundFlags[idx]; + + for (int j = 0; flagVec[j] != -1; ++j) { + if (flagVec[j] >= NumFlags) { + ccprintf(cerr, "Invalid compound flag"); + return; + } + flags[flagVec[j]] = value; + } + } + + cprintf("flag %s was %s\n", string, value ? "set" : "cleared"); + return; + } + + cprintf("could not find flag %s\n", string); +} + +extern "C" +void +setTraceFlag(const char *string) +{ + tweakTraceFlag(string, true); +} + +extern "C" +void +clearTraceFlag(const char *string) +{ + tweakTraceFlag(string, false); +} diff --git a/base/trace.hh b/base/trace.hh index 9e5952765..e49d7aa61 100644 --- a/base/trace.hh +++ b/base/trace.hh @@ -108,7 +108,7 @@ namespace Trace { int len; public: - RawDataRecord(Tick cycle, const uint8_t *_data, int _len); + RawDataRecord(Tick cycle, const void *_data, int _len); virtual ~RawDataRecord(); virtual void dump(std::ostream &); @@ -149,7 +149,7 @@ namespace Trace { } inline void - rawDump(const uint8_t *data, int len) + rawDump(const void *data, int len) { theLog.append(new Trace::RawDataRecord(curTick, data, len)); } |