Andreas Sandberg has submitted this change and it was merged. ( https://gem5-review.googlesource.com/2720 )

Change subject: power: Allow global stats in power equations
......................................................................

power: Allow global stats in power equations

Allow global stats such as sim_seconds in power equations to make it
possible to convert from event stats to rate stats.

Change-Id: I429abe0ffadc0dbd162eb39e0897143be472ef65
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/2720
Reviewed-by: Jason Lowe-Power <[email protected]>
---
M src/sim/power/mathexpr_powermodel.cc
1 file changed, 10 insertions(+), 2 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved



diff --git a/src/sim/power/mathexpr_powermodel.cc b/src/sim/power/mathexpr_powermodel.cc
index a77e14a..ab48720 100644
--- a/src/sim/power/mathexpr_powermodel.cc
+++ b/src/sim/power/mathexpr_powermodel.cc
@@ -39,6 +39,8 @@

 #include "sim/power/mathexpr_powermodel.hh"

+#include <string>
+
 #include "base/statistics.hh"
 #include "params/MathExprPowerModel.hh"
 #include "sim/mathexpr.hh"
@@ -62,9 +64,15 @@
 {
     // Create a map with stats and pointers for quick access
     // Has to be done here, since we need access to the statsList
-    for (auto & i: Stats::statsList())
-        if (i->name.find(basename) == 0)
+    for (auto & i: Stats::statsList()) {
+        if (i->name.find(basename) == 0) {
+            // Add stats for this sim object and its child objects
             stats_map[i->name.substr(basename.size())] = i;
+        } else if (i->name.find(".") == std::string::npos) {
+            // Add global stats (sim_seconds, for example)
+            stats_map[i->name] = i;
+        }
+    }

     tryEval(st_expr);
     const bool st_failed = failed;

--
To view, visit https://gem5-review.googlesource.com/2720
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I429abe0ffadc0dbd162eb39e0897143be472ef65
Gerrit-Change-Number: 2720
Gerrit-PatchSet: 2
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to