summaryrefslogtreecommitdiff
path: root/src/sim/power/power_model.cc
diff options
context:
space:
mode:
authorAnouk Van Laer <anouk.vanlaer@arm.com>2017-03-01 17:05:18 +0000
committerAnouk Van Laer <anouk.vanlaer@arm.com>2018-02-28 21:55:35 +0000
commited0f02e1f68e8771f4de514716f34c3de32b3045 (patch)
treeb9dafb62a24ee3e7c876c255b245123a736c2ab2 /src/sim/power/power_model.cc
parentfbe63074e3a8128bdbe1a5e8f6509c565a3abbd4 (diff)
downloadgem5-ed0f02e1f68e8771f4de514716f34c3de32b3045.tar.xz
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 <sascha.bischoff@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/8601 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/sim/power/power_model.cc')
-rw-r--r--src/sim/power/power_model.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/sim/power/power_model.cc b/src/sim/power/power_model.cc
index 5f810fe60..e8c522cad 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 @@ PowerModelState::PowerModelState(const Params *p)
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 @@ PowerModel::getDynamicPower() const
{
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 @@ PowerModel::getStaticPower() const
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());