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());
}
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) ||
// 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
// 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 */
/**
* @{