trace.hh (4041:f42c73e7e639) | trace.hh (4042:dbd98b2264ed) |
---|---|
1/* 2 * Copyright (c) 2001-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 33 unchanged lines hidden (view full) --- 42#include "base/traceflags.hh" 43 44namespace Trace { 45 46 typedef std::vector<bool> FlagVec; 47 48 extern FlagVec flags; 49 | 1/* 2 * Copyright (c) 2001-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 33 unchanged lines hidden (view full) --- 42#include "base/traceflags.hh" 43 44namespace Trace { 45 46 typedef std::vector<bool> FlagVec; 47 48 extern FlagVec flags; 49 |
50#if TRACING_ON 51 const bool On = true; 52#else 53 const bool On = false; 54#endif | 50 extern std::ostream *dprintf_stream; |
55 56 inline bool 57 IsOn(int t) 58 { 59 return flags[t]; | 51 52 inline bool 53 IsOn(int t) 54 { 55 return flags[t]; |
60 | |
61 } 62 | 56 } 57 |
58 extern bool enabled; 59 |
|
63 void dump(const uint8_t *data, int count); 64 65 class Record 66 { 67 protected: 68 Tick cycle; 69 70 Record(Tick _cycle) --- 80 unchanged lines hidden (view full) --- 151 { 152 theLog.append(new Trace::DataRecord(when, name, data, len)); 153 } 154 155 extern const std::string DefaultName; 156 157}; 158 | 60 void dump(const uint8_t *data, int count); 61 62 class Record 63 { 64 protected: 65 Tick cycle; 66 67 Record(Tick _cycle) --- 80 unchanged lines hidden (view full) --- 148 { 149 theLog.append(new Trace::DataRecord(when, name, data, len)); 150 } 151 152 extern const std::string DefaultName; 153 154}; 155 |
159std::ostream &DebugOut(); | 156inline std::ostream & 157DebugOut() 158{ 159 return *Trace::dprintf_stream; 160} |
160 161// This silly little class allows us to wrap a string in a functor 162// object so that we can give a name() that DPRINTF will like 163struct StringWrap 164{ 165 std::string str; 166 StringWrap(const std::string &s) : str(s) {} 167 const std::string &operator()() const { return str; } --- 8 unchanged lines hidden (view full) --- 176// std::string & in the current scope. 177// 178// If you desire that the automatic printing not occur, use DPRINTFR 179// (R for raw) 180// 181 182#if TRACING_ON 183 | 161 162// This silly little class allows us to wrap a string in a functor 163// object so that we can give a name() that DPRINTF will like 164struct StringWrap 165{ 166 std::string str; 167 StringWrap(const std::string &s) : str(s) {} 168 const std::string &operator()() const { return str; } --- 8 unchanged lines hidden (view full) --- 177// std::string & in the current scope. 178// 179// If you desire that the automatic printing not occur, use DPRINTFR 180// (R for raw) 181// 182 183#if TRACING_ON 184 |
184#define DTRACE(x) (Trace::IsOn(Trace::x)) | 185#define DTRACE(x) (Trace::IsOn(Trace::x) && Trace::enabled) |
185 186#define DDUMP(x, data, count) do { \ 187 if (DTRACE(x)) \ 188 Trace::dataDump(curTick, name(), data, count); \ 189} while (0) 190 191#define DPRINTF(x, ...) do { \ 192 if (DTRACE(x)) \ --- 28 unchanged lines hidden --- | 186 187#define DDUMP(x, data, count) do { \ 188 if (DTRACE(x)) \ 189 Trace::dataDump(curTick, name(), data, count); \ 190} while (0) 191 192#define DPRINTF(x, ...) do { \ 193 if (DTRACE(x)) \ --- 28 unchanged lines hidden --- |