32#ifndef __BASE_TRACE_HH__
33#define __BASE_TRACE_HH__
50const std::string &
name();
73 if (ignore_match && activate_match)
74 panic(
"%s in both ignore and activate.\n",
name);
84 template <
typename ...Args>
92 template <
typename ...Args>
94 const std::string &flag,
95 const char *fmt,
const Args &...args)
99 std::ostringstream line;
106 const void *
d,
int len,
const std::string &flag);
110 const std::string &flag,
const std::string &message) = 0;
146 const std::string &flag,
const std::string &message)
override;
204#define DDUMP(x, data, count) do { \
205 if (GEM5_UNLIKELY(TRACING_ON && ::gem5::debug::x)) \
206 ::gem5::trace::getDebugLogger()->dump( \
207 ::gem5::curTick(), name(), data, count, #x); \
210#define DPRINTF(x, ...) do { \
211 if (GEM5_UNLIKELY(TRACING_ON && ::gem5::debug::x)) { \
212 ::gem5::trace::getDebugLogger()->dprintf_flag( \
213 ::gem5::curTick(), name(), #x, __VA_ARGS__); \
217#define DPRINTFS(x, s, ...) do { \
218 if (GEM5_UNLIKELY(TRACING_ON && ::gem5::debug::x)) { \
219 ::gem5::trace::getDebugLogger()->dprintf_flag( \
220 ::gem5::curTick(), (s)->name(), #x, __VA_ARGS__); \
224#define DPRINTFR(x, ...) do { \
225 if (GEM5_UNLIKELY(TRACING_ON && ::gem5::debug::x)) { \
226 ::gem5::trace::getDebugLogger()->dprintf_flag( \
227 (::gem5::Tick)-1, std::string(), #x, __VA_ARGS__); \
231#define DPRINTFV(x, ...) do { \
232 if (GEM5_UNLIKELY(TRACING_ON && (x))) { \
233 ::gem5::trace::getDebugLogger()->dprintf_flag( \
234 ::gem5::curTick(), name(), x.name(), __VA_ARGS__); \
238#define DPRINTFN(...) do { \
240 ::gem5::trace::getDebugLogger()->dprintf( \
241 ::gem5::curTick(), name(), __VA_ARGS__); \
245#define DPRINTFNR(...) do { \
247 ::gem5::trace::getDebugLogger()->dprintf( \
248 (::gem5::Tick)-1, "", __VA_ARGS__); \
252#define DPRINTF_UNCONDITIONAL(x, ...) \
253 GEM5_DEPRECATED_MACRO_STMT(DPRINTF_UNCONDITIONAL, \
256 ::gem5::trace::getDebugLogger()->dprintf_flag( \
257 ::gem5::curTick(), name(), #x, __VA_ARGS__); \
260 "Use DPRINTFN or DPRINTF with a debug flag instead.")
const std::string & name()
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
ObjectMatch contains a vector of expressions.
void add(const ObjectMatch &other)
bool match(const std::string &name) const
Debug logging base class.
void setIgnore(ObjectMatch &ignore_)
Set objects to ignore.
ObjectMatch ignore
Name match for objects to ignore.
void addActivate(const ObjectMatch &activate_)
Add objects to activate.
void dprintf_flag(Tick when, const std::string &name, const std::string &flag, const char *fmt, const Args &...args)
Log a single message with a flag prefix.
bool isEnabled(const std::string &name) const
void addIgnore(const ObjectMatch &ignore_)
Add objects to ignore.
virtual std::ostream & getOstream()=0
Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messa...
void setActivate(ObjectMatch &activate_)
Set objects to activate.
ObjectMatch activate
Name match for objects to activate log.
virtual void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message)=0
Log formatted message.
void dprintf(Tick when, const std::string &name, const char *fmt, const Args &...args)
Log a single message.
Logging wrapper for ostreams with the format: <when>: <name>: <message-body>
void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message) override
Log formatted message.
OstreamLogger(std::ostream &stream_)
std::ostream & getOstream() override
Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messa...
#define panic(...)
This implements a cprintf based panic() function.
void dump()
Dump all statistics data to the registered outputs.
void enable()
Enable/disable debug logging.
void setDebugLogger(Logger *logger)
Delete the current global logger and assign a new one.
Logger * getDebugLogger()
Get the current global debug logger.
std::ostream & output()
Get the ostream from the current global logger.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Tick
Tick count type.
void ccprintf(cp::Print &print)
StringWrap(const std::string &s)
const std::string & operator()() const
const std::string & name()