Go to the documentation of this file.
44 #include "debug/PowerDomain.hh"
50 possibleStates(
p.possible_states.begin(),
51 p.possible_states.end()),
54 for (
auto &pm:
p.leaders) {
57 pm->addFollower(
this);
74 unsigned int currState = (
unsigned int)
_currState;
83 unsigned int currState;
97 "Cannot go to %s in %s \n", Enums::PwrStateStrings[
p],
name());
101 warn_once(
"PowerState: Already in the requested power state, "
114 warn(
"PowerState: More than one power state change request "
115 "encountered within the same simulation tick");
144 Enums::PwrStateStrings[
p]);
158 if (*(rev_it) <=
p) {
162 Enums::PwrStateStrings[
p],
163 Enums::PwrStateStrings[*(rev_it)]);
174 "Transition to power state %s was not possible, SimObject already"
175 " in the most performance state %s",
176 Enums::PwrStateStrings[
p], Enums::PwrStateStrings[
_currState]);
193 if (
_currState == Enums::PwrState::CLK_GATED) {
212 ret.resize(Enums::PwrState::Num_PwrState);
213 for (
unsigned i = 0;
i < Enums::PwrState::Num_PwrState;
i++)
214 ret[
i] = residencies[
i] / \
225 "Number of power state transitions due match request"),
227 "Distribution of time spent in the clock gated state"),
229 "Cumulative time (in ticks) in various power states")
238 using namespace Stats;
240 const PowerStateParams &
p = powerState.params();
242 numTransitions.flags(
nozero);
243 numPwrMatchStateTransitions.flags(
nozero);
246 unsigned num_bins = std::max(
p.clk_gate_bins, 10U);
248 .init(
p.clk_gate_min,
p.clk_gate_max,
249 (
p.clk_gate_max -
p.clk_gate_min + 1.0) / num_bins)
253 pwrStateResidencyTicks
254 .init(Enums::PwrState::Num_PwrState)
257 for (
int i = 0;
i < Enums::PwrState::Num_PwrState;
i++) {
258 pwrStateResidencyTicks.subname(
i, Enums::PwrStateStrings[
i]);
277 powerState.computeStats();
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.
PowerState(const PowerStateParams &p)
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)
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
Tick curTick()
The universal simulation clock.
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.
Abstract superclass for simulation objects.
Generated on Tue Jun 22 2021 15:28:30 for gem5 by doxygen 1.8.17