diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/misc.cc | 12 | ||||
-rw-r--r-- | base/statistics.cc | 15 | ||||
-rw-r--r-- | base/statistics.hh | 16 |
3 files changed, 36 insertions, 7 deletions
diff --git a/base/misc.cc b/base/misc.cc index e798dd656..8190caddd 100644 --- a/base/misc.cc +++ b/base/misc.cc @@ -42,7 +42,8 @@ void __panic(const string &format, cp::ArgList &args, const char *func, const char *file, int line) { - string fmt = "panic: " + format + " [%s:%s, line %d]\n"; + string fmt = "panic: " + format + " @ cycle %d\n[%s:%s, line %d]\n"; + args.append(curTick); args.append(func); args.append(file); args.append(line); @@ -62,13 +63,13 @@ void __fatal(const string &format, cp::ArgList &args, const char *func, const char *file, int line) { - string fmt = "fatal: " + format + " [%s:%s, line %d]\n" - "\n%d\nMemory Usage: %ld KBytes\n"; + string fmt = "fatal: " + format + " @ cycle %d\n[%s:%s, line %d]\n" + "Memory Usage: %ld KBytes\n"; + args.append(curTick); args.append(func); args.append(file); args.append(line); - args.append(curTick); args.append(memUsage()); args.dump(cerr, fmt); @@ -83,7 +84,8 @@ __warn(const string &format, cp::ArgList &args, const char *func, { string fmt = "warn: " + format; #ifdef VERBOSE_WARN - fmt += " [%s:%s, line %d]\n"; + fmt += " @ cycle %d\n[%s:%s, line %d]\n"; + args.append(curTick); args.append(func); args.append(file); args.append(line); diff --git a/base/statistics.cc b/base/statistics.cc index 14bdb32f6..5c1844327 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -161,6 +161,7 @@ void Database::dump(ostream &stream) { +#ifndef FS_MEASURE list_t::iterator i = printStats.begin(); list_t::iterator end = printStats.end(); while (i != end) { @@ -169,6 +170,7 @@ Database::dump(ostream &stream) binnedStats.push_back(stat); ++i; } +#endif //FS_MEASURE list<GenBin *>::iterator j = bins.begin(); list<GenBin *>::iterator bins_end=bins.end(); @@ -183,8 +185,13 @@ Database::dump(ostream &stream) panic("a binned stat not found in names map!"); ccprintf(stream,"---%s Bin------------\n", (*iter).second); +#ifdef FS_MEASURE + list_t::iterator i = printStats.begin(); + list_t::iterator end = printStats.end(); +#else list_t::iterator i = binnedStats.begin(); list_t::iterator end = binnedStats.end(); +#endif while (i != end) { Stat *stat = *i; if (stat->dodisplay()) @@ -194,9 +201,16 @@ Database::dump(ostream &stream) ++j; ccprintf(stream, "---------------------------------\n"); } +#ifndef FS_MEASURE ccprintf(stream, "**************ALL STATS************\n"); +#endif } +/** + * get bin totals working, then print the stat here (as total), even if + * its' binned. (this is only for the case you selectively bin a few stats + */ +#ifndef FS_MEASURE list_t::iterator k = printStats.begin(); list_t::iterator endprint = printStats.end(); while (k != endprint) { @@ -205,6 +219,7 @@ Database::dump(ostream &stream) stat->display(stream); ++k; } +#endif } StatData * diff --git a/base/statistics.hh b/base/statistics.hh index 2fe6988b0..aa3489727 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -60,6 +60,9 @@ #include <math.h> #include "sim/host.hh" +#ifdef FS_MEASURE +#include "base/trace.hh" +#endif // // Un-comment this to enable weirdo-stat debugging // @@ -2167,6 +2170,7 @@ class GenBin : public Detail::BinBase virtual ~GenBin() {}; virtual void activate() = 0; + virtual std::string name() const = 0; void regBin(GenBin *bin, std::string name); }; @@ -2198,7 +2202,6 @@ struct StatBin : public GenBin // That one is for the last trailing flags byte. offset() += (size + 1 + mask) & ~mask; - return off; } @@ -2212,7 +2215,12 @@ struct StatBin : public GenBin return Detail::BinBase::memory() + off; } - virtual void activate() { setCurBin(this); } + virtual void activate() { + setCurBin(this); +#ifdef FS_MEASURE + DPRINTF(TCPIP, "activating %s Bin\n", name()); +#endif + } static void activate(StatBin &bin) { setCurBin(&bin); } class BinBase @@ -2426,7 +2434,11 @@ struct NoBin * is NoBin, nothing is binned. If it is MainBin (or whatever *Bin), then all stats are binned * under that Bin. */ +#ifdef FS_MEASURE +typedef MainBin DefaultBin; +#else typedef NoBin DefaultBin; +#endif /** * This is a simple scalar statistic, like a counter. |