From 07074f40e5a7e6000262a5d37f0be836f6ac92a9 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 29 Apr 2021 20:09:32 -0700 Subject: [PATCH] sim: Stop using DPRINTF_UNCONDITIONAL in the event class. Just because the current methods of the base class only call Event::trace from within DTRACE(Event), that's no guarantee that future methods will, that the call sites won't be changed so that they don't, or any number of subclasses that may not even exist today will. Instead, we should incur the very slight overhead of checking the Debug::Event variable again to ensure expected behavior, and to avoid unnecessary complexity for a very small optimization when we're already enabled a high overhead behavior like tracing for all events in a virtual function. Change-Id: I1c360b2ba73ad73c0658e85e9122f1fef07f93ce Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44986 Reviewed-by: Daniel Carvalho Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/sim/eventq.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/sim/eventq.cc b/src/sim/eventq.cc index 3e99683e1b..92863b1bde 100644 --- a/src/sim/eventq.cc +++ b/src/sim/eventq.cc @@ -376,16 +376,12 @@ Event::description() const void Event::trace(const char *action) { - // This DPRINTF is unconditional because calls to this function - // are protected by an 'if (DTRACE(Event))' in the inlined Event - // methods. - // // This is just a default implementation for derived classes where // it's not worth doing anything special. If you want to put a // 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 %s %s @ %d\n", + DPRINTF(Event, "%s %s %s @ %d\n", description(), instanceString(), action, when()); }