gem5  v22.1.0.0
power_model.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, 2018, 2021 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __SIM_POWER_POWER_MODEL_HH__
39 #define __SIM_POWER_POWER_MODEL_HH__
40 
41 #include "base/statistics.hh"
42 #include "base/temperature.hh"
43 #include "enums/PMType.hh"
44 #include "params/PowerModel.hh"
45 #include "params/PowerModelState.hh"
46 #include "sim/probe/probe.hh"
47 
48 namespace gem5
49 {
50 
51 class SimObject;
52 class ClockedObject;
53 
58 class PowerModelState : public SimObject
59 {
60  public:
61 
62  typedef PowerModelStateParams Params;
63  PowerModelState(const Params &p);
64 
70  virtual double getDynamicPower() const = 0;
71 
77  virtual double getStaticPower() const = 0;
78 
84  virtual void setTemperature(Temperature temp) { _temp = temp; }
85 
87  clocked_object = clkobj;
88  }
89 
90  protected:
91 
94 
97 
99 };
100 
107 class PowerModel : public SimObject
108 {
109  public:
110 
111  typedef PowerModelParams Params;
112  PowerModel(const Params &p);
113 
119  double getDynamicPower() const;
120 
126  double getStaticPower() const;
127 
128  void setClockedObject(ClockedObject *clkobj);
129 
130  virtual void regProbePoints();
131 
132  void thermalUpdateCallback(const Temperature &temp);
133 
134  protected:
136  class ThermalProbeListener : public ProbeListenerArgBase<Temperature>
137  {
138  public:
140  const std::string &name)
141  : ProbeListenerArgBase(pm, name), pm(_pm) {}
142 
143  void notify(const Temperature &temp)
144  {
146  }
147 
148  protected:
150  };
151 
154 
156  std::unique_ptr<ThermalProbeListener> thermalListener;
157 
160 
163 
165  enums::PMType power_model_type;
166 
168 };
169 
170 } // namespace gem5
171 
172 #endif
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
A PowerModelState is an abstract class used as interface to get power figures out of SimObjects.
Definition: power_model.hh:59
PowerModelStateParams Params
Definition: power_model.hh:62
statistics::Value dynamicPower
Definition: power_model.hh:98
PowerModelState(const Params &p)
Definition: power_model.cc:49
virtual double getDynamicPower() const =0
Get the dynamic power consumption.
void setClockedObject(ClockedObject *clkobj)
Definition: power_model.hh:86
Temperature _temp
Current temperature.
Definition: power_model.hh:93
ClockedObject * clocked_object
The clocked object we belong to.
Definition: power_model.hh:96
virtual void setTemperature(Temperature temp)
Temperature update.
Definition: power_model.hh:84
virtual double getStaticPower() const =0
Get the static power consumption.
statistics::Value staticPower
Definition: power_model.hh:98
Listener class to catch thermal events.
Definition: power_model.hh:137
void notify(const Temperature &temp)
Definition: power_model.hh:143
ThermalProbeListener(PowerModel &_pm, ProbeManager *pm, const std::string &name)
Definition: power_model.hh:139
virtual void regProbePoints()
Register probe points for this object.
Definition: power_model.cc:103
enums::PMType power_model_type
The type of power model - collects all power, static or dynamic only.
Definition: power_model.hh:165
statistics::Value staticPower
Definition: power_model.hh:167
double getStaticPower() const
Get the static power consumption.
Definition: power_model.cc:137
void setClockedObject(ClockedObject *clkobj)
Definition: power_model.cc:87
ClockedObject * clocked_object
The clocked object we belong to.
Definition: power_model.hh:162
PowerModel(const Params &p)
Definition: power_model.cc:62
PowerModelParams Params
Definition: power_model.hh:111
SubSystem * subsystem
The subsystem this power model belongs to.
Definition: power_model.hh:159
void thermalUpdateCallback(const Temperature &temp)
Definition: power_model.cc:96
std::vector< PowerModelState * > states_pm
Actual power models (one per power state)
Definition: power_model.hh:153
double getDynamicPower() const
Get the dynamic power consumption.
Definition: power_model.cc:111
statistics::Value dynamicPower
Definition: power_model.hh:167
std::unique_ptr< ThermalProbeListener > thermalListener
Listener to catch temperature changes in the SubSystem.
Definition: power_model.hh:156
ProbeListenerArgBase is used to define the base interface to a ProbeListenerArg (i....
Definition: probe.hh:212
const std::string name
Definition: probe.hh:138
ProbeManager is a conduit class that lives on each SimObject, and is used to match up probe listeners...
Definition: probe.hh:164
Abstract superclass for simulation objects.
Definition: sim_object.hh:148
The SubSystem simobject does nothing, it is just a container for other simobjects used by the configu...
Definition: sub_system.hh:61
The class stores temperatures in Kelvin and provides helper methods to convert to/from Celsius.
Definition: temperature.hh:51
STL vector class.
Definition: stl.hh:37
Bitfield< 54 > p
Definition: pagetable.hh:70
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Declaration of Statistics objects.

Generated on Wed Dec 21 2022 10:22:39 for gem5 by doxygen 1.9.1