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 extern std::ostream *dprintf_stream; |
51 52 inline bool 53 IsOn(int t) 54 { 55 return flags[t]; |
56 } 57 |
58 extern bool enabled; 59 |
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 |
156inline std::ostream & 157DebugOut() 158{ 159 return *Trace::dprintf_stream; 160} |
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 |
185#define DTRACE(x) (Trace::IsOn(Trace::x) && Trace::enabled) |
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 --- |