Anouk Van Laer has submitted this change and it was merged. ( https://gem5-review.googlesource.com/8601 )

Change subject: sim: Added model type to power model
......................................................................

sim: Added model type to power model

Static, dynamic or all to differentiate between types of power models
so for example static models will not be asked for a dynamic power

Change-Id: I3a0385821f7c671aedddaebeb038c677367faa81
Reviewed-by: Sascha Bischoff <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/8601
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
---
M src/sim/power/PowerModel.py
M src/sim/power/power_model.cc
M src/sim/power/power_model.hh
3 files changed, 23 insertions(+), 4 deletions(-)

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



diff --git a/src/sim/power/PowerModel.py b/src/sim/power/PowerModel.py
index ecb45b4..3425690 100644
--- a/src/sim/power/PowerModel.py
+++ b/src/sim/power/PowerModel.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2016 ARM Limited
+# Copyright (c) 2016-2018 ARM Limited
 # All rights reserved.
 #
 # The license below extends only to copyright in the software and shall
@@ -39,6 +39,9 @@
 from m5.params import *
 from m5.proxy import Parent

+# Enum for a type of  power model
+class PMType(Enum) : vals = ['All', 'Static', 'Dynamic']
+
 # Represents a power model for a simobj
 # The model itself is also a SimObject so we can make use some
 # nice features available such as Parent.any
@@ -57,3 +60,6 @@
     # Need a reference to the system so we can query the thermal domain
     # about temperature (temperature is needed for leakage calculation)
     subsystem = Param.SubSystem(Parent.any, "subsystem")
+
+    # Type of power model
+    pm_type = Param.PMType("All", "Type of power model")
diff --git a/src/sim/power/power_model.cc b/src/sim/power/power_model.cc
index 5f810fe..e8c522c 100644
--- a/src/sim/power/power_model.cc
+++ b/src/sim/power/power_model.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 ARM Limited
+ * Copyright (c) 2016-2018 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -52,7 +52,7 @@

 PowerModel::PowerModel(const Params *p)
     : SimObject(p), states_pm(p->pm), subsystem(p->subsystem),
-      clocked_object(NULL)
+      clocked_object(NULL), power_model_type(p->pm_type)
 {
     panic_if(subsystem == NULL,
"Subsystem is NULL! This is not acceptable for a PowerModel!\n");
@@ -94,6 +94,10 @@
 {
     assert(clocked_object);

+    if (power_model_type == Enums::PMType::Static) {
+        // This power model only collects static data
+        return 0;
+    }
     std::vector<double> w = clocked_object->pwrStateWeights();

     // Same number of states (excluding UNDEFINED)
@@ -118,6 +122,11 @@

     std::vector<double> w = clocked_object->pwrStateWeights();

+    if (power_model_type == Enums::PMType::Dynamic) {
+        // This power model only collects dynamic data
+        return 0;
+    }
+
     // Same number of states (excluding UNDEFINED)
     assert(w.size() - 1 == states_pm.size());

diff --git a/src/sim/power/power_model.hh b/src/sim/power/power_model.hh
index 976c054..e482b80 100644
--- a/src/sim/power/power_model.hh
+++ b/src/sim/power/power_model.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 ARM Limited
+ * Copyright (c) 2016, 2018 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -41,6 +41,7 @@
 #define __SIM_POWER_POWER_MODEL_HH__

 #include "base/statistics.hh"
+#include "enums/PMType.hh"
 #include "params/PowerModel.hh"
 #include "params/PowerModelState.hh"
 #include "sim/probe/probe.hh"
@@ -184,6 +185,9 @@

     /** The clocked object we belong to */
     ClockedObject * clocked_object;
+
+ /** The type of power model - collects all power, static or dynamic only */
+    Enums::PMType power_model_type;
 };

 #endif

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

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

Reply via email to