From a51cec66694a550417dcf792c72cbecbd79f3da7 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 20 Feb 2004 15:19:55 -0500 Subject: Make it so dump takes a void * base/trace.cc: base/trace.hh: take a void * for the raw data --HG-- extra : convert_revision : fc336dc82b4d533c3a0f319977074f26342445ea --- base/trace.cc | 3 +-- base/trace.hh | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'base') diff --git a/base/trace.cc b/base/trace.cc index 156110376..cca58d669 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]; 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)); } -- cgit v1.2.3 From b678152277d5f876efcf7bcac99926a977fdccac Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 25 Feb 2004 16:12:48 -0500 Subject: Fix stats debugging and always compile it in for the debug target --HG-- extra : convert_revision : aa16e6256a056e6df9affec6fd973e62e812e23c --- base/statistics.cc | 14 +++++++++++--- base/statistics.hh | 15 +++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'base') 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..71d2aa8c8 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 -- cgit v1.2.3 From 45f377bcd8c07b100aacc2de07023c836af04174 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 29 Feb 2004 19:29:30 -0500 Subject: more debugging support base/trace.cc: code to set/clear/print trace flags from the debugger. --HG-- extra : convert_revision : f2a549e9af05c4a177186b9f1792a0493ce15c95 --- base/trace.cc | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'base') diff --git a/base/trace.cc b/base/trace.cc index cca58d669..e56bdb11b 100644 --- a/base/trace.cc +++ b/base/trace.cc @@ -319,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); +} -- cgit v1.2.3 From ee967995196739b90c0b1c384d7e245d1dffdc80 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 29 Feb 2004 20:22:32 -0500 Subject: Initial cleanup pass of lisa's function call tracking code. base/statistics.hh: We're getting rid of FS_MEASURE, but for now, we're going to still use a compile time flag to turn on and off binning of statistics. (The flag is STATS_BINNING) cpu/exec_context.cc: cpu/exec_context.hh: kern/tru64/tru64_system.cc: get rid of FS_MEASURE cpu/simple_cpu/simple_cpu.cc: yank the function call tracking code out of the cpu and move it into the software context class itself. kern/tru64/tru64_system.hh: get rid of FS_MEASURE move all of the tacking stuff to the same place. sim/system.hh: cleanup --HG-- extra : convert_revision : 73d3843afe1b3ba0d5445421c39c1148d3f4e7c0 --- base/statistics.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base') diff --git a/base/statistics.hh b/base/statistics.hh index 71d2aa8c8..c99aadab5 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -2498,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(STATS_BINNING) typedef MainBin DefaultBin; #else typedef NoBin DefaultBin; -- cgit v1.2.3 From f3861d0cc7d3574f985b3aeb37ddf6038b6c9a11 Mon Sep 17 00:00:00 2001 From: Lisa Hsu Date: Thu, 4 Mar 2004 21:57:09 -0500 Subject: Overall gist of this is to 'dynamicize' the tracking of functions so you can choose them at the .ini stage rather than at compile time. to do it: in .ini file set binned_fns=foo null bar foo what this says is, track foo when it is called by null (i.e. anything). bin bar only when it is called by foo. essentially, if you have a path of functions to track, the 0th, 2nd, 4th fn listed are the fns to track, and the 1st, 3rd, 5th are their respective callers. base/statistics.hh: turn it back to FS_MEASURE since we already have a build in place kern/tru64/tru64_events.cc: remove FS_MEASURE #defs. add more DPRINTF's. manage an anomaly that happens when tracking idle_thread. kern/tru64/tru64_events.hh: remove FS_MEASURE #defs kern/tru64/tru64_system.cc: make DumpState print all the time, but only with DPRINTF. add a new parameter to tru64System a vector binned_fns, to read in from .ini file. now all this binning stuff is dynamically generated. kern/tru64/tru64_system.hh: remove all static binning stuff, add support for dynamic sim/system.cc: change nonPath bin name to Kernel, remove FS_MEASURE sim/system.hh: change nonPath to Kernel --HG-- extra : convert_revision : 9ee813c0a64273bab4125815b7bc8145c5897ec1 --- base/statistics.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base') diff --git a/base/statistics.hh b/base/statistics.hh index c99aadab5..0dad31a5a 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -2498,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. */ -#if defined(STATS_BINNING) +#if defined(FS_MEASURE) typedef MainBin DefaultBin; #else typedef NoBin DefaultBin; -- cgit v1.2.3