Ciro Santilli has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/25383 )

Change subject: sim: print --debug-flag Event execution and instance ID
......................................................................

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 <ja...@lowepower.com>
Maintainer: Jason Lowe-Power <ja...@lowepower.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/sim/eventq.cc
M src/sim/eventq.hh
2 files changed, 18 insertions(+), 8 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/sim/eventq.cc b/src/sim/eventq.cc
index 6141380..25131b3 100644
--- a/src/sim/eventq.cc
+++ b/src/sim/eventq.cc
@@ -81,11 +81,7 @@
 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 @@
     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 @@
     // 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
diff --git a/src/sim/eventq.hh b/src/sim/eventq.hh
index a703363..2976e11 100644
--- a/src/sim/eventq.hh
+++ b/src/sim/eventq.hh
@@ -284,6 +284,9 @@
     // 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 */
     /**
      * @{

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/25383
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I17378e16bd3de1d98e936a6252aab2cd8c303b23
Gerrit-Change-Number: 25383
Gerrit-PatchSet: 2
Gerrit-Owner: Ciro Santilli <ciro.santi...@arm.com>
Gerrit-Reviewer: Ciro Santilli <ciro.santi...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to