From 8f0ed4606184bb8de2647063508a40c9276f19ef Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Mon, 27 May 2024 08:35:21 -0700 Subject: [PATCH] stdlib: Move `_m5.stats.processDumpQueue` to call-once This commit addresses Jason's comment (https://github.com/gem5/gem5/pull/996#discussion_r1613870880) which highlighted putting the `_m5.stats.processDumpQueue` call in the iteration through the `root` object in `get_simstat` caused this function be potentially called many times when it only needs to be called once. This chance moved this call to just before this iteration and will tehrefore only be called once (if required) per `get_simstat` execution. Change-Id: I16908b6dee063a0df7877a19e215883963bfb081 --- src/python/m5/stats/gem5stats.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/python/m5/stats/gem5stats.py b/src/python/m5/stats/gem5stats.py index 3e84ed0a6e..5b031d9a73 100644 --- a/src/python/m5/stats/gem5stats.py +++ b/src/python/m5/stats/gem5stats.py @@ -373,6 +373,10 @@ def get_simstat( :Returns: The SimStat Object of the current simulation. """ + + if prepare_stats: + _m5.stats.processDumpQueue() + stats_map = {} for r in root: creation_time = datetime.now() @@ -384,9 +388,6 @@ def get_simstat( simulated_begin_time = int(final_tick - sim_ticks) simulated_end_time = int(final_tick) - if prepare_stats: - _m5.stats.processDumpQueue() - if prepare_stats: if isinstance(r, list): for obj in r: