sim: print --debug-flag Event execution and instance ID
This makes it much easier to determine what event is causing something to happen, especially when there are multiple events happening at the same time. Change-Id: I17378e16bd3de1d98e936a6252aab2cd8c303b23 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25383 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -81,11 +81,7 @@ Event::~Event()
|
||||
const std::string
|
||||
Event::name() const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
return csprintf("Event_%d", instance);
|
||||
#else
|
||||
return csprintf("Event_%x", (uintptr_t)this);
|
||||
#endif
|
||||
return csprintf("Event_%s", instanceString());
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +216,8 @@ EventQueue::serviceOne()
|
||||
if (!event->squashed()) {
|
||||
// forward current cycle to the time when this event occurs.
|
||||
setCurTick(event->when());
|
||||
|
||||
if (DTRACE(Event))
|
||||
event->trace("executed");
|
||||
event->process();
|
||||
if (event->isExitEvent()) {
|
||||
assert(!event->flags.isSet(Event::Managed) ||
|
||||
@@ -388,8 +385,18 @@ Event::trace(const char *action)
|
||||
// more informative message in the trace, override this method on
|
||||
// the particular subclass where you have the information that
|
||||
// needs to be printed.
|
||||
DPRINTF_UNCONDITIONAL(Event, "%s event %s @ %d\n",
|
||||
description(), action, when());
|
||||
DPRINTF_UNCONDITIONAL(Event, "%s %s %s @ %d\n",
|
||||
description(), instanceString(), action, when());
|
||||
}
|
||||
|
||||
const std::string
|
||||
Event::instanceString() const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
return csprintf("%d", instance);
|
||||
#else
|
||||
return csprintf("%#x", (uintptr_t)this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -284,6 +284,9 @@ class Event : public EventBase, public Serializable
|
||||
// This function isn't really useful if TRACING_ON is not defined
|
||||
virtual void trace(const char *action); //!< trace event activity
|
||||
|
||||
/// Return the instance number as a string.
|
||||
const std::string instanceString() const;
|
||||
|
||||
protected: /* Memory management */
|
||||
/**
|
||||
* @{
|
||||
|
||||
Reference in New Issue
Block a user