trace.hh (7823:dac01f14f20f) | trace.hh (8232:b28d06a175be) |
---|---|
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; --- 19 unchanged lines hidden (view full) --- 28 * Authors: Nathan Binkert 29 * Steve Reinhardt 30 */ 31 32#ifndef __BASE_TRACE_HH__ 33#define __BASE_TRACE_HH__ 34 35#include <string> | 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; --- 19 unchanged lines hidden (view full) --- 28 * Authors: Nathan Binkert 29 * Steve Reinhardt 30 */ 31 32#ifndef __BASE_TRACE_HH__ 33#define __BASE_TRACE_HH__ 34 35#include <string> |
36#include <vector> | |
37 38#include "base/cprintf.hh" | 36 37#include "base/cprintf.hh" |
38#include "base/debug.hh" |
|
39#include "base/match.hh" | 39#include "base/match.hh" |
40#include "base/traceflags.hh" | |
41#include "base/types.hh" 42#include "sim/core.hh" 43 44namespace Trace { 45 | 40#include "base/types.hh" 41#include "sim/core.hh" 42 43namespace Trace { 44 |
45using Debug::SimpleFlag; 46using Debug::CompoundFlag; 47 |
|
46std::ostream &output(); 47void setOutput(const std::string &filename); 48 49extern bool enabled; | 48std::ostream &output(); 49void setOutput(const std::string &filename); 50 51extern bool enabled; |
50typedef std::vector<bool> FlagVec; 51extern FlagVec flags; 52inline bool IsOn(int t) { return flags[t]; } | |
53bool changeFlag(const char *str, bool value); 54void dumpStatus(); 55 56extern ObjectMatch ignore; 57extern const std::string DefaultName; 58 59void dprintf(Tick when, const std::string &name, const char *format, 60 CPRINTF_DECLARATION); --- 19 unchanged lines hidden (view full) --- 80// std::string & in the current scope. 81// 82// If you desire that the automatic printing not occur, use DPRINTFR 83// (R for raw) 84// 85 86#if TRACING_ON 87 | 52bool changeFlag(const char *str, bool value); 53void dumpStatus(); 54 55extern ObjectMatch ignore; 56extern const std::string DefaultName; 57 58void dprintf(Tick when, const std::string &name, const char *format, 59 CPRINTF_DECLARATION); --- 19 unchanged lines hidden (view full) --- 79// std::string & in the current scope. 80// 81// If you desire that the automatic printing not occur, use DPRINTFR 82// (R for raw) 83// 84 85#if TRACING_ON 86 |
88#define DTRACE(x) (Trace::IsOn(Trace::x) && Trace::enabled) | 87#define DTRACE(x) ((Debug::x) && Trace::enabled) |
89 90#define DDUMP(x, data, count) do { \ | 88 89#define DDUMP(x, data, count) do { \ |
90 using namespace Debug; \ |
|
91 if (DTRACE(x)) \ 92 Trace::dump(curTick(), name(), data, count); \ 93} while (0) 94 95#define DPRINTF(x, ...) do { \ | 91 if (DTRACE(x)) \ 92 Trace::dump(curTick(), name(), data, count); \ 93} while (0) 94 95#define DPRINTF(x, ...) do { \ |
96 using namespace Debug; \ |
|
96 if (DTRACE(x)) \ 97 Trace::dprintf(curTick(), name(), __VA_ARGS__); \ 98} while (0) 99 | 97 if (DTRACE(x)) \ 98 Trace::dprintf(curTick(), name(), __VA_ARGS__); \ 99} while (0) 100 |
100#define DPRINTFS(x,s, ...) do { \ | 101#define DPRINTFS(x, s, ...) do { \ 102 using namespace Debug; \ |
101 if (DTRACE(x)) \ | 103 if (DTRACE(x)) \ |
102 Trace::dprintf(curTick(), s->name(), __VA_ARGS__); \ | 104 Trace::dprintf(curTick(), s->name(), __VA_ARGS__); \ |
103} while (0) 104 | 105} while (0) 106 |
105 | |
106#define DPRINTFR(x, ...) do { \ | 107#define DPRINTFR(x, ...) do { \ |
108 using namespace Debug; \ |
|
107 if (DTRACE(x)) \ 108 Trace::dprintf((Tick)-1, std::string(), __VA_ARGS__); \ 109} while (0) 110 111#define DDUMPN(data, count) do { \ 112 Trace::dump(curTick(), name(), data, count); \ 113} while (0) 114 --- 22 unchanged lines hidden --- | 109 if (DTRACE(x)) \ 110 Trace::dprintf((Tick)-1, std::string(), __VA_ARGS__); \ 111} while (0) 112 113#define DDUMPN(data, count) do { \ 114 Trace::dump(curTick(), name(), data, count); \ 115} while (0) 116 --- 22 unchanged lines hidden --- |