From f902c0218ae3a8df558f1427302fbf0931b8f7d7 Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Tue, 5 Apr 2016 10:52:28 -0500 Subject: power: Add support for power models This patch adds some basic support for power models in gem5. The power interface is defined so it can interact with thermal models as well. It implements a simple power evaluator that can be used for simple power models that express power in the form of a math expression. These expressions can use stats within the same SimObject (or down its hierarchy) and some magic variables such as "temp" for temperature. In future patches we will extend this functionality to allow slightly more complex expressions. The model allows it to be extended to use other kinds of models. Finally, the thermal model is updated to use the power usage as input. --- src/sim/sub_system.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/sim/sub_system.cc') diff --git a/src/sim/sub_system.cc b/src/sim/sub_system.cc index 771590cf7..f5c0cc3f8 100644 --- a/src/sim/sub_system.cc +++ b/src/sim/sub_system.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 ARM Limited + * Copyright (c) 2014-2015 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -37,8 +37,11 @@ * Authors: Geoffrey Blake */ +#include "sim/sub_system.hh" + #include "params/SubSystem.hh" #include "sim/sub_system.hh" +#include "sim/power/power_model.hh" #include "sim/power/thermal_domain.hh" SubSystem::SubSystem(const Params *p) @@ -49,6 +52,24 @@ SubSystem::SubSystem(const Params *p) p->thermal_domain->setSubSystem(this); } +double +SubSystem::getDynamicPower() const +{ + double ret = 0.0f; + for (auto &obj: powerProducers) + ret += obj->getDynamicPower(); + return ret; +} + +double +SubSystem::getStaticPower() const +{ + double ret = 0.0f; + for (auto &obj: powerProducers) + ret += obj->getStaticPower(); + return ret; +} + SubSystem * SubSystemParams::create() { -- cgit v1.2.3