From eddac53ff60c579eff28134bde84783fe36d6214 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 15 Apr 2011 10:44:32 -0700 Subject: trace: reimplement the DTRACE function so it doesn't use a vector At the same time, rename the trace flags to debug flags since they have broader usage than simply tracing. This means that --trace-flags is now --debug-flags and --trace-help is now --debug-help --- src/base/trace.cc | 63 +------------------------------------------------------ 1 file changed, 1 insertion(+), 62 deletions(-) (limited to 'src/base/trace.cc') diff --git a/src/base/trace.cc b/src/base/trace.cc index 7783b6d42..1a035d400 100644 --- a/src/base/trace.cc +++ b/src/base/trace.cc @@ -32,9 +32,7 @@ #include #include #include -#include #include -#include #include "base/misc.hh" #include "base/output.hh" @@ -45,8 +43,8 @@ using namespace std; namespace Trace { + const string DefaultName("global"); -FlagVec flags(NumFlags, false); bool enabled = false; // @@ -149,63 +147,4 @@ dump(Tick when, const std::string &name, const void *d, int len) } } -bool -changeFlag(const char *s, bool value) -{ - using namespace Trace; - std::string str(s); - - for (int i = 0; i < numFlagStrings; ++i) { - if (str != flagStrings[i]) - continue; - - if (i < NumFlags) { - flags[i] = value; - } else { - i -= NumFlags; - - const Flags *flagVec = compoundFlags[i]; - for (int j = 0; flagVec[j] != -1; ++j) { - if (flagVec[j] < NumFlags) - flags[flagVec[j]] = value; - } - } - - return true; - } - - // the flag was not found. - return false; -} - -void -dumpStatus() -{ - using namespace Trace; - for (int i = 0; i < numFlagStrings; ++i) { - if (flags[i]) - cprintf("%s\n", flagStrings[i]); - } -} - } // namespace Trace - - -// add a set of functions that can easily be invoked from gdb -void -setTraceFlag(const char *string) -{ - Trace::changeFlag(string, true); -} - -void -clearTraceFlag(const char *string) -{ - Trace::changeFlag(string, false); -} - -void -dumpTraceStatus() -{ - Trace::dumpStatus(); -} -- cgit v1.2.3