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:
Ciro Santilli
2019-11-22 16:14:50 +00:00
parent 4c8efdbef4
commit 0aafbd422a
2 changed files with 18 additions and 8 deletions

View File

@@ -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

View File

@@ -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 */
/**
* @{