Go to the documentation of this file.
42 #include "debug/PowerDomain.hh"
47 possibleStates(
p->possible_states.begin(),
48 p->possible_states.end()),
51 for (
auto &pm:
p->leaders) {
54 pm->addFollower(
this);
71 unsigned int currState = (
unsigned int)
_currState;
80 unsigned int currState;
94 "Cannot go to %s in %s \n", Enums::PwrStateStrings[
p],
name());
98 warn_once(
"PowerState: Already in the requested power state, "
111 warn(
"PowerState: More than one power state change request "
112 "encountered within the same simulation tick");
141 Enums::PwrStateStrings[
p]);
155 if (*(rev_it) <=
p) {
159 Enums::PwrStateStrings[
p],
160 Enums::PwrStateStrings[*(rev_it)]);
171 "Transition to power state %s was not possible, SimObject already"
172 " in the most performance state %s",
173 Enums::PwrStateStrings[
p], Enums::PwrStateStrings[
_currState]);
190 if (
_currState == Enums::PwrState::CLK_GATED) {
209 ret.resize(Enums::PwrState::Num_PwrState);
210 for (
unsigned i = 0;
i < Enums::PwrState::Num_PwrState;
i++)
211 ret[
i] = residencies[
i] / \
221 "Number of power state transitions"),
222 ADD_STAT(numPwrMatchStateTransitions,
223 "Number of power state transitions due match request"),
225 "Distribution of time spent in the clock gated state"),
227 "Cumulative time (in ticks) in various power states")
236 using namespace Stats;
238 const PowerStateParams *
p = powerState.params();
240 numTransitions.flags(
nozero);
241 numPwrMatchStateTransitions.flags(
nozero);
244 unsigned num_bins = std::max(
p->clk_gate_bins, 10U);
246 .init(
p->clk_gate_min,
p->clk_gate_max,
247 (
p->clk_gate_max / num_bins))
251 pwrStateResidencyTicks
252 .init(Enums::PwrState::Num_PwrState)
255 for (
int i = 0;
i < Enums::PwrState::Num_PwrState;
i++) {
256 pwrStateResidencyTicks.subname(
i, Enums::PwrStateStrings[
i]);
275 powerState.computeStats();
279 PowerStateParams::create()
virtual void regStats()
Callback to set stat parameters.
std::set< Enums::PwrState > possibleStates
The possible power states this object can be in.
void preDumpStats() override
Callback before stats are dumped.
Enums::PwrState matchPwrState(Enums::PwrState p)
Change the power state of this object to a power state equal to OR more performant than p.
Tick prvEvalTick
Last tick the power stats were calculated.
#define UNSERIALIZE_SCALAR(scalar)
void set(Enums::PwrState p)
Change the power state of this object to the power state p.
PowerDomain * controlledDomain
The power domain that this power state leads, nullptr if it doesn't lead any.
The PowerDomain groups PowerState objects together to regulate their power states.
uint64_t Tick
Tick count type.
virtual void preDumpStats()
Callback before stats are dumped.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Stats::Vector pwrStateResidencyTicks
Tracks the time spent in each of the power states.
Stats::Scalar numPwrMatchStateTransitions
std::vector< double > getWeights() const
Returns the percentage residency for each power state.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
PowerState::PowerStateStats stats
Helper class for objects that have power states.
void pwrStateChangeCallback(Enums::PwrState new_pwr_state, PowerState *leader)
Register the change in power state in one of the leader.
Enums::PwrState _currState
To keep track of the current power state.
void regStats() override
Callback to set stat parameters.
PowerStateStats(PowerState &ps)
#define SERIALIZE_SCALAR(scalar)
PowerState(const PowerStateParams *p)
const FlagsType nozero
Don't print if this is zero.
virtual const std::string name() const
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
const FlagsType pdf
Print the percent of the total that this entry represents.
Stats::Scalar numTransitions
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
void computeStats()
Record stats values like state residency by computing the time difference from previous update.
std::ostream CheckpointOut
Stats::Distribution ticksClkGated
void value(VCounter &vec) const
void setControlledDomain(PowerDomain *pwr_dom)
Result total() const
Return a total of all entries in this vector.
const FlagsType nonan
Don't print if this is NAN.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Tick curTick()
The current simulated tick.
Abstract superclass for simulation objects.
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17