Go to the documentation of this file.
40 #include <unordered_map>
43 #include "debug/PowerDomain.hh"
48 pwrStateUpdateEvent(*this),
56 leader->setControlledDomain(
this);
79 for (
const auto &obj : objs) {
80 const auto & states = obj->getPossibleStates();
81 auto it = states.find(Enums::PwrState::ON);
83 "%s in %s does not have the required power states to be "
84 "part of a PowerDomain i.e. the ON state!", obj->name(),
100 fatal_if(leader == follower,
"%s is both a leader and follower"
101 " in %s\n!", leader->name(),
name());
107 Enums::PwrState pws = leader->get();
108 fatal_if(pws == Enums::PwrState::UNDEFINED,
109 "%s is in the UNDEFINED power state, not acceptable as "
110 "leader!", leader->name());
123 for (
const auto &obj : objs) {
124 const auto &obj_states = obj->getPossibleStates();
125 if (obj_states.find(p_state) == obj_states.end()) {
141 Enums::PwrStateStrings[p_state]);
151 Enums::PwrState most_perf_state = Enums::PwrState::Num_PwrState;
152 std::string most_perf_leader;
154 Enums::PwrState pw = leader->get();
155 if (pw < most_perf_state) {
156 most_perf_state = pw;
157 most_perf_leader = leader->name();
160 assert(most_perf_state != Enums::PwrState::Num_PwrState);
162 most_perf_leader, most_perf_state);
166 if (!f_states.empty()) {
167 for (Enums::PwrState f_pw : f_states ) {
170 if ((f_pw != Enums::PwrState::UNDEFINED) &&
171 (f_pw < most_perf_state)) {
172 most_perf_state = f_pw;
176 "is %u\n", most_perf_state);
178 return most_perf_state;
188 Enums::PwrState actual_pws =
190 matched_states.push_back(actual_pws);
198 Enums::PwrState new_power_state =
206 set(new_power_state);
237 "be updated in %u ticks\n", old_target_state,
247 "Number of calls by leaders to change power domain state"),
249 "Number of calls by leader to change power domain state actually "
250 "resulting in a power state change")
262 numLeaderCallsChangingState
virtual void regStats()
Callback to set stat parameters.
std::set< Enums::PwrState > possibleStates
The possible power states this object can be in.
PowerDomainStats(PowerDomain &pd)
void setFollowerPowerStates()
Update the followers of the newly updated power state.
void set(Enums::PwrState p)
Change the power state of this object to the power state p.
Stats::Scalar numLeaderCalls
The PowerDomain groups PowerState objects together to regulate their power states.
void regStats() override
Callback to set stat parameters.
PowerDomain(const PowerDomainParams &p)
std::vector< PowerState * > followers
List of all followers in the PowerDomain.
std::vector< PowerState * > leaders
List of all leaders in the PowerDomain.
PowerDomain::PowerDomainStats stats
void schedule(Event &event, Tick when)
const Tick updateLatency
Latency with which power state changes of the leaders will ripple through to the followers.
std::set< Enums::PwrState > getPossibleStates() const
Return the power states this object can be in.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
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 addFollower(PowerState *pwr_obj) override
Function called by a follower to register itself as a dependant of this power domain.
void calculatePossiblePwrStates()
Calculate the possible power states of the domain based upon the intersection of the power states of ...
Stats::Scalar numLeaderCallsChangingState
bool isPossiblePwrState(Enums::PwrState p_state)
Check if a given p_state is available across all leaders and followers in this domain.
const FlagsType nozero
Don't print if this is zero.
virtual const std::string name() const
Enums::PwrState leaderTargetState
Power state requested by the leader.
void startup() override
During startup, the list of possible power states the PowerDomain can be in is populated,...
Tick curTick()
The universal simulation clock.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Enums::PwrState calculatePowerDomainState(const std::vector< Enums::PwrState > &f_states={})
Calculate the power state of the power domain, based upon the power states of the leaders.
EventWrapper< PowerDomain, &PowerDomain::setFollowerPowerStates > pwrStateUpdateEvent
Event to update the power states of the followers.
Generated on Tue Jun 22 2021 15:28:30 for gem5 by doxygen 1.8.17