Go to the documentation of this file.
40 #include <unordered_map>
43 #include "debug/PowerDomain.hh"
51 pwrStateUpdateEvent(*this),
59 leader->setControlledDomain(
this);
82 for (
const auto &obj : objs) {
83 const auto & states = obj->getPossibleStates();
84 auto it = states.find(enums::PwrState::ON);
86 "%s in %s does not have the required power states to be "
87 "part of a PowerDomain i.e. the ON state!", obj->name(),
103 fatal_if(leader == follower,
"%s is both a leader and follower"
104 " in %s\n!", leader->name(),
name());
110 enums::PwrState pws = leader->get();
111 fatal_if(pws == enums::PwrState::UNDEFINED,
112 "%s is in the UNDEFINED power state, not acceptable as "
113 "leader!", leader->name());
126 for (
const auto &obj : objs) {
127 const auto &obj_states = obj->getPossibleStates();
128 if (obj_states.find(p_state) == obj_states.end()) {
144 enums::PwrStateStrings[p_state]);
154 enums::PwrState most_perf_state = enums::PwrState::Num_PwrState;
155 std::string most_perf_leader;
157 enums::PwrState pw = leader->get();
158 if (pw < most_perf_state) {
159 most_perf_state = pw;
160 most_perf_leader = leader->name();
163 assert(most_perf_state != enums::PwrState::Num_PwrState);
165 most_perf_leader, most_perf_state);
169 if (!f_states.empty()) {
170 for (enums::PwrState f_pw : f_states ) {
173 if ((f_pw != enums::PwrState::UNDEFINED) &&
174 (f_pw < most_perf_state)) {
175 most_perf_state = f_pw;
179 "is %u\n", most_perf_state);
181 return most_perf_state;
191 enums::PwrState actual_pws =
193 matched_states.push_back(actual_pws);
201 enums::PwrState new_power_state =
209 set(new_power_state);
240 "be updated in %u ticks\n", old_target_state,
248 : statistics::
Group(&pd),
249 ADD_STAT(numLeaderCalls, statistics::units::Count::get(),
250 "Number of calls by leaders to change power domain state"),
251 ADD_STAT(numLeaderCallsChangingState, statistics::units::Count::get(),
252 "Number of calls by leader to change power domain state actually "
253 "resulting in a power state change")
265 numLeaderCallsChangingState
Tick curTick()
The universal simulation clock.
The PowerDomain groups PowerState objects together to regulate their power states.
gem5::PowerDomain::PowerDomainStats stats
std::set< enums::PwrState > possibleStates
The possible power states this object can be in.
void setFollowerPowerStates()
Update the followers of the newly updated power state.
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.
enums::PwrState leaderTargetState
Power state requested by the leader.
void addFollower(PowerState *pwr_obj) override
Function called by a follower to register itself as a dependant of this power domain.
void schedule(Event &event, Tick when)
std::vector< PowerState * > leaders
List of all leaders in the PowerDomain.
PowerDomain(const PowerDomainParams &p)
void pwrStateChangeCallback(enums::PwrState new_pwr_state, PowerState *leader)
Register the change in power state in one of the leader.
std::vector< PowerState * > followers
List of all followers in the PowerDomain.
void calculatePossiblePwrStates()
Calculate the possible power states of the domain based upon the intersection of the power states of ...
virtual std::string name() const
statistics::Scalar numLeaderCallsChangingState
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
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.
Helper class for objects that have power states.
EventWrapper< PowerDomain, &PowerDomain::setFollowerPowerStates > pwrStateUpdateEvent
Event to update the power states of the followers.
PowerDomainStats(PowerDomain &pd)
virtual void regStats()
Callback to set stat parameters.
void startup() override
During startup, the list of possible power states the PowerDomain can be in is populated,...
const Tick updateLatency
Latency with which power state changes of the leaders will ripple through to the followers.
statistics::Scalar numLeaderCalls
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
std::set< enums::PwrState > getPossibleStates() const
Return the power states this object can be in.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
void set(enums::PwrState p)
Change the power state of this object to the power state p.
void regStats() override
Callback to set stat parameters.
enums::PwrState _currState
To keep track of the current power state.
Generated on Tue Feb 8 2022 11:47:13 for gem5 by doxygen 1.8.17