diff options
author | David Guillen Fandos <david.guillen@arm.com> | 2016-06-06 17:16:44 +0100 |
---|---|---|
committer | David Guillen Fandos <david.guillen@arm.com> | 2016-06-06 17:16:44 +0100 |
commit | 7cfb59d6e580bac0d663bc22da315aed7746fdeb (patch) | |
tree | d600a1e07357e2a56c0a73f0f41b2d6eff59c2d3 /src/sim/sub_system.hh | |
parent | fb5fc11da49938660ea22c336964677cdba890e1 (diff) | |
download | gem5-7cfb59d6e580bac0d663bc22da315aed7746fdeb.tar.xz |
sim: Adding 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.
Change-Id: I76752f9638b6815e229fd74cdcb7721a305cbc4b
Diffstat (limited to 'src/sim/sub_system.hh')
-rw-r--r-- | src/sim/sub_system.hh | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/sim/sub_system.hh b/src/sim/sub_system.hh index 6e35be676..20a352fc3 100644 --- a/src/sim/sub_system.hh +++ b/src/sim/sub_system.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 ARM Limited + * Copyright (c) 2014-2016 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -45,10 +45,14 @@ #ifndef __SIM_SUB_SYSTEM_HH__ #define __SIM_SUB_SYSTEM_HH__ +#include <vector> + #include "params/SubSystem.hh" #include "sim/power/thermal_domain.hh" #include "sim/sim_object.hh" +class PowerModel; + /** * The SubSystem simobject does nothing, it is just a container for * other simobjects used by the configuration system @@ -58,6 +62,17 @@ class SubSystem : public SimObject public: typedef SubSystemParams Params; SubSystem(const Params *p); + + double getDynamicPower() const; + + double getStaticPower() const; + + void registerPowerProducer(PowerModel *pm) { + powerProducers.push_back(pm); + } + + protected: + std::vector<PowerModel*> powerProducers; }; #endif |