diff options
author | Nathan Binkert <nate@binkert.org> | 2011-04-15 10:44:32 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2011-04-15 10:44:32 -0700 |
commit | eddac53ff60c579eff28134bde84783fe36d6214 (patch) | |
tree | 9095c6b64a6fdabf4e0d00b2c8f2ca40ad495f49 /src/base/trace.hh | |
parent | f946d7bcdb4d0b4327857d319dd4ecdd1c320d62 (diff) | |
download | gem5-eddac53ff60c579eff28134bde84783fe36d6214.tar.xz |
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
Diffstat (limited to 'src/base/trace.hh')
-rw-r--r-- | src/base/trace.hh | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/base/trace.hh b/src/base/trace.hh index a03a34018..dbeffdc8b 100644 --- a/src/base/trace.hh +++ b/src/base/trace.hh @@ -33,23 +33,22 @@ #define __BASE_TRACE_HH__ #include <string> -#include <vector> #include "base/cprintf.hh" +#include "base/debug.hh" #include "base/match.hh" -#include "base/traceflags.hh" #include "base/types.hh" #include "sim/core.hh" namespace Trace { +using Debug::SimpleFlag; +using Debug::CompoundFlag; + std::ostream &output(); void setOutput(const std::string &filename); extern bool enabled; -typedef std::vector<bool> FlagVec; -extern FlagVec flags; -inline bool IsOn(int t) { return flags[t]; } bool changeFlag(const char *str, bool value); void dumpStatus(); @@ -85,25 +84,28 @@ inline const std::string &name() { return Trace::DefaultName; } #if TRACING_ON -#define DTRACE(x) (Trace::IsOn(Trace::x) && Trace::enabled) +#define DTRACE(x) ((Debug::x) && Trace::enabled) #define DDUMP(x, data, count) do { \ + using namespace Debug; \ if (DTRACE(x)) \ Trace::dump(curTick(), name(), data, count); \ } while (0) #define DPRINTF(x, ...) do { \ + using namespace Debug; \ if (DTRACE(x)) \ Trace::dprintf(curTick(), name(), __VA_ARGS__); \ } while (0) -#define DPRINTFS(x,s, ...) do { \ +#define DPRINTFS(x, s, ...) do { \ + using namespace Debug; \ if (DTRACE(x)) \ - Trace::dprintf(curTick(), s->name(), __VA_ARGS__); \ + Trace::dprintf(curTick(), s->name(), __VA_ARGS__); \ } while (0) - #define DPRINTFR(x, ...) do { \ + using namespace Debug; \ if (DTRACE(x)) \ Trace::dprintf((Tick)-1, std::string(), __VA_ARGS__); \ } while (0) |