misc: Rename Enums namespace as enums
As part of recent decisions regarding namespace naming conventions, all namespaces will be changed to snake case. ::Enums became ::enums. Change-Id: I39b5fb48817ad16abbac92f6254284b37fc90c40 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45420 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
06fb0753fe
commit
4dd099ba3d
@@ -109,7 +109,7 @@ PowerModel::getDynamicPower() const
|
||||
{
|
||||
assert(clocked_object);
|
||||
|
||||
if (power_model_type == Enums::PMType::Static) {
|
||||
if (power_model_type == enums::PMType::Static) {
|
||||
// This power model only collects static data
|
||||
return 0;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ PowerModel::getDynamicPower() const
|
||||
assert(w.size() - 1 == states_pm.size());
|
||||
|
||||
// Make sure we have no UNDEFINED state
|
||||
warn_if(w[Enums::PwrState::UNDEFINED] > 0,
|
||||
warn_if(w[enums::PwrState::UNDEFINED] > 0,
|
||||
"SimObject in UNDEFINED power state! Power figures might be wrong!\n");
|
||||
|
||||
double power = 0;
|
||||
@@ -137,7 +137,7 @@ PowerModel::getStaticPower() const
|
||||
|
||||
std::vector<double> w = clocked_object->powerState->getWeights();
|
||||
|
||||
if (power_model_type == Enums::PMType::Dynamic) {
|
||||
if (power_model_type == enums::PMType::Dynamic) {
|
||||
// This power model only collects dynamic data
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class PowerModel : public SimObject
|
||||
ClockedObject * clocked_object;
|
||||
|
||||
/** The type of power model - collects all power, static or dynamic only */
|
||||
Enums::PMType power_model_type;
|
||||
enums::PMType power_model_type;
|
||||
|
||||
Stats::Value dynamicPower, staticPower;
|
||||
};
|
||||
|
||||
@@ -58,8 +58,8 @@ PowerDomain::PowerDomain(const PowerDomainParams &p) :
|
||||
|
||||
// We will assume a power domain to start in the most performant p-state
|
||||
// This will be corrected during startup()
|
||||
leaderTargetState = Enums::PwrState::ON;
|
||||
_currState = Enums::PwrState::ON;
|
||||
leaderTargetState = enums::PwrState::ON;
|
||||
_currState = enums::PwrState::ON;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -78,7 +78,7 @@ PowerDomain::startup()
|
||||
for (const auto &objs : { leaders, followers }) {
|
||||
for (const auto &obj : objs) {
|
||||
const auto & states = obj->getPossibleStates();
|
||||
auto it = states.find(Enums::PwrState::ON);
|
||||
auto it = states.find(enums::PwrState::ON);
|
||||
fatal_if(it == states.end(),
|
||||
"%s in %s does not have the required power states to be "
|
||||
"part of a PowerDomain i.e. the ON state!", obj->name(),
|
||||
@@ -104,8 +104,8 @@ PowerDomain::startup()
|
||||
// Record the power states of the leaders and followers
|
||||
DPRINTF(PowerDomain, "Recording the current power states in domain\n");
|
||||
for (auto leader : leaders) {
|
||||
Enums::PwrState pws = leader->get();
|
||||
fatal_if(pws == Enums::PwrState::UNDEFINED,
|
||||
enums::PwrState pws = leader->get();
|
||||
fatal_if(pws == enums::PwrState::UNDEFINED,
|
||||
"%s is in the UNDEFINED power state, not acceptable as "
|
||||
"leader!", leader->name());
|
||||
}
|
||||
@@ -117,7 +117,7 @@ PowerDomain::startup()
|
||||
}
|
||||
|
||||
bool
|
||||
PowerDomain::isPossiblePwrState(Enums::PwrState p_state)
|
||||
PowerDomain::isPossiblePwrState(enums::PwrState p_state)
|
||||
{
|
||||
for (const auto &objs : { leaders, followers }) {
|
||||
for (const auto &obj : objs) {
|
||||
@@ -138,36 +138,36 @@ PowerDomain::calculatePossiblePwrStates()
|
||||
if (isPossiblePwrState(p_state)) {
|
||||
possibleStates.emplace(p_state);
|
||||
DPRINTF(PowerDomain, "%u/%s is a p-state\n", p_state,
|
||||
Enums::PwrStateStrings[p_state]);
|
||||
enums::PwrStateStrings[p_state]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Enums::PwrState
|
||||
enums::PwrState
|
||||
PowerDomain::calculatePowerDomainState(
|
||||
const std::vector<Enums::PwrState> &f_states)
|
||||
const std::vector<enums::PwrState> &f_states)
|
||||
{
|
||||
DPRINTF(PowerDomain, "Calculating the power state\n");
|
||||
Enums::PwrState most_perf_state = Enums::PwrState::Num_PwrState;
|
||||
enums::PwrState most_perf_state = enums::PwrState::Num_PwrState;
|
||||
std::string most_perf_leader;
|
||||
for (auto leader : leaders) {
|
||||
Enums::PwrState pw = leader->get();
|
||||
enums::PwrState pw = leader->get();
|
||||
if (pw < most_perf_state) {
|
||||
most_perf_state = pw;
|
||||
most_perf_leader = leader->name();
|
||||
}
|
||||
}
|
||||
assert(most_perf_state != Enums::PwrState::Num_PwrState);
|
||||
assert(most_perf_state != enums::PwrState::Num_PwrState);
|
||||
DPRINTF(PowerDomain, "Most performant leader is %s, at %u\n",
|
||||
most_perf_leader, most_perf_state);
|
||||
|
||||
// If asked to check the power states of the followers (f_states contains
|
||||
// the power states of the followers)
|
||||
if (!f_states.empty()) {
|
||||
for (Enums::PwrState f_pw : f_states ) {
|
||||
for (enums::PwrState f_pw : f_states ) {
|
||||
// Ignore UNDEFINED state of follower, at startup the followers
|
||||
// might be in the UNDEFINED state, PowerDomain will pull them up
|
||||
if ((f_pw != Enums::PwrState::UNDEFINED) &&
|
||||
if ((f_pw != enums::PwrState::UNDEFINED) &&
|
||||
(f_pw < most_perf_state)) {
|
||||
most_perf_state = f_pw;
|
||||
}
|
||||
@@ -183,9 +183,9 @@ PowerDomain::setFollowerPowerStates()
|
||||
{
|
||||
// Loop over all followers and tell them to change their power state so
|
||||
// they match that of the power domain (or a more performant power state)
|
||||
std::vector<Enums::PwrState> matched_states;
|
||||
std::vector<enums::PwrState> matched_states;
|
||||
for (auto follower : followers) {
|
||||
Enums::PwrState actual_pws =
|
||||
enums::PwrState actual_pws =
|
||||
follower->matchPwrState(leaderTargetState);
|
||||
matched_states.push_back(actual_pws);
|
||||
assert(actual_pws <= leaderTargetState);
|
||||
@@ -195,7 +195,7 @@ PowerDomain::setFollowerPowerStates()
|
||||
}
|
||||
// Now the power states of the follower have been changed recalculate the
|
||||
// power state of the domain as a whole, including followers
|
||||
Enums::PwrState new_power_state =
|
||||
enums::PwrState new_power_state =
|
||||
calculatePowerDomainState(matched_states);
|
||||
if (new_power_state != _currState) {
|
||||
// Change in power state of the domain, so update. Updates in power
|
||||
@@ -208,13 +208,13 @@ PowerDomain::setFollowerPowerStates()
|
||||
}
|
||||
|
||||
void
|
||||
PowerDomain::pwrStateChangeCallback(Enums::PwrState new_pwr_state,
|
||||
PowerDomain::pwrStateChangeCallback(enums::PwrState new_pwr_state,
|
||||
PowerState* leader)
|
||||
{
|
||||
DPRINTF(PowerDomain, "PwrState update to %u by %s\n", new_pwr_state,
|
||||
leader->name());
|
||||
|
||||
Enums::PwrState old_target_state = leaderTargetState;
|
||||
enums::PwrState old_target_state = leaderTargetState;
|
||||
// Calculate the power state of the domain, based on the leaders
|
||||
if (new_pwr_state < _currState) {
|
||||
// The power state of the power domain always needs to match that of
|
||||
|
||||
@@ -73,7 +73,7 @@ class PowerDomain : public PowerState
|
||||
* domain will change its own power state if required and if there is a
|
||||
* power state, it will schedule an event to update its followers
|
||||
*/
|
||||
void pwrStateChangeCallback(Enums::PwrState new_pwr_state,
|
||||
void pwrStateChangeCallback(enums::PwrState new_pwr_state,
|
||||
PowerState* leader);
|
||||
|
||||
/**
|
||||
@@ -92,14 +92,14 @@ class PowerDomain : public PowerState
|
||||
* which the followers returned when asked to match a certain power
|
||||
* state (called from setFollowerPowerStates)
|
||||
*/
|
||||
Enums::PwrState calculatePowerDomainState(
|
||||
const std::vector<Enums::PwrState> &f_states={});
|
||||
enums::PwrState calculatePowerDomainState(
|
||||
const std::vector<enums::PwrState> &f_states={});
|
||||
|
||||
/**
|
||||
* Check if a given p_state is available across all leaders and
|
||||
* followers in this domain.
|
||||
*/
|
||||
bool isPossiblePwrState(Enums::PwrState p_state);
|
||||
bool isPossiblePwrState(enums::PwrState p_state);
|
||||
|
||||
/**
|
||||
* Calculate the possible power states of the domain based upon the
|
||||
@@ -130,7 +130,7 @@ class PowerDomain : public PowerState
|
||||
* power state of the domain as whole (as that one depends on the
|
||||
* matched power states of the followers
|
||||
*/
|
||||
Enums::PwrState leaderTargetState;
|
||||
enums::PwrState leaderTargetState;
|
||||
|
||||
/**
|
||||
* List of all followers in the PowerDomain. The power state of the
|
||||
|
||||
@@ -85,16 +85,16 @@ PowerState::unserialize(CheckpointIn &cp)
|
||||
UNSERIALIZE_SCALAR(currState);
|
||||
UNSERIALIZE_SCALAR(prvEvalTick);
|
||||
|
||||
_currState = Enums::PwrState(currState);
|
||||
_currState = enums::PwrState(currState);
|
||||
}
|
||||
|
||||
void
|
||||
PowerState::set(Enums::PwrState p)
|
||||
PowerState::set(enums::PwrState p)
|
||||
{
|
||||
// Check if this power state is actually allowed by checking whether it is
|
||||
// present in pwrStateToIndex-dictionary
|
||||
panic_if(possibleStates.find(p) == possibleStates.end(),
|
||||
"Cannot go to %s in %s \n", Enums::PwrStateStrings[p], name());
|
||||
"Cannot go to %s in %s \n", enums::PwrStateStrings[p], name());
|
||||
|
||||
// Function should ideally be called only when there is a state change
|
||||
if (_currState == p) {
|
||||
@@ -131,8 +131,8 @@ PowerState::set(Enums::PwrState p)
|
||||
|
||||
}
|
||||
|
||||
Enums::PwrState
|
||||
PowerState::matchPwrState(Enums::PwrState p)
|
||||
enums::PwrState
|
||||
PowerState::matchPwrState(enums::PwrState p)
|
||||
{
|
||||
// If the object is asked to match a power state, it has to be a follower
|
||||
// and hence should not have a pointer to a powerDomain
|
||||
@@ -141,11 +141,11 @@ PowerState::matchPwrState(Enums::PwrState p)
|
||||
// If we are already in this power state, ignore request
|
||||
if (_currState == p) {
|
||||
DPRINTF(PowerDomain, "Already in p-state %s requested to match \n",
|
||||
Enums::PwrStateStrings[p]);
|
||||
enums::PwrStateStrings[p]);
|
||||
return _currState;
|
||||
}
|
||||
|
||||
Enums::PwrState old_state = _currState;
|
||||
enums::PwrState old_state = _currState;
|
||||
if (possibleStates.find(p) != possibleStates.end()) {
|
||||
// If this power state is allowed in this object, just go there
|
||||
set(p);
|
||||
@@ -159,8 +159,8 @@ PowerState::matchPwrState(Enums::PwrState p)
|
||||
// This power state is the least performant power state that is
|
||||
// still more performant than the requested one
|
||||
DPRINTF(PowerDomain, "Best match for %s is %s \n",
|
||||
Enums::PwrStateStrings[p],
|
||||
Enums::PwrStateStrings[*(rev_it)]);
|
||||
enums::PwrStateStrings[p],
|
||||
enums::PwrStateStrings[*(rev_it)]);
|
||||
set(*(rev_it));
|
||||
break;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ PowerState::matchPwrState(Enums::PwrState p)
|
||||
possibleStates.find(_currState) != possibleStates.begin(),
|
||||
"Transition to power state %s was not possible, SimObject already"
|
||||
" in the most performance state %s",
|
||||
Enums::PwrStateStrings[p], Enums::PwrStateStrings[_currState]);
|
||||
enums::PwrStateStrings[p], enums::PwrStateStrings[_currState]);
|
||||
|
||||
stats.numPwrMatchStateTransitions++;
|
||||
return _currState;
|
||||
@@ -190,7 +190,7 @@ PowerState::computeStats()
|
||||
// Time spent in CLK_GATED state, this might change depending on
|
||||
// transition to other low power states in respective simulation
|
||||
// objects.
|
||||
if (_currState == Enums::PwrState::CLK_GATED) {
|
||||
if (_currState == enums::PwrState::CLK_GATED) {
|
||||
stats.ticksClkGated.sample(elapsed_time);
|
||||
}
|
||||
|
||||
@@ -209,8 +209,8 @@ PowerState::getWeights() const
|
||||
Tick elapsed_time = curTick() - prvEvalTick;
|
||||
residencies[_currState] += elapsed_time;
|
||||
|
||||
ret.resize(Enums::PwrState::Num_PwrState);
|
||||
for (unsigned i = 0; i < Enums::PwrState::Num_PwrState; i++)
|
||||
ret.resize(enums::PwrState::Num_PwrState);
|
||||
for (unsigned i = 0; i < enums::PwrState::Num_PwrState; i++)
|
||||
ret[i] = residencies[i] / \
|
||||
(stats.pwrStateResidencyTicks.total() + elapsed_time);
|
||||
|
||||
@@ -252,11 +252,11 @@ PowerState::PowerStateStats::regStats()
|
||||
;
|
||||
|
||||
pwrStateResidencyTicks
|
||||
.init(Enums::PwrState::Num_PwrState)
|
||||
.init(enums::PwrState::Num_PwrState)
|
||||
.flags(nozero)
|
||||
;
|
||||
for (int i = 0; i < Enums::PwrState::Num_PwrState; i++) {
|
||||
pwrStateResidencyTicks.subname(i, Enums::PwrStateStrings[i]);
|
||||
for (int i = 0; i < enums::PwrState::Num_PwrState; i++) {
|
||||
pwrStateResidencyTicks.subname(i, enums::PwrStateStrings[i]);
|
||||
}
|
||||
|
||||
numTransitions = 0;
|
||||
|
||||
@@ -76,17 +76,17 @@ class PowerState : public SimObject
|
||||
/**
|
||||
* Change the power state of this object to the power state p
|
||||
*/
|
||||
void set(Enums::PwrState p);
|
||||
void set(enums::PwrState p);
|
||||
|
||||
|
||||
inline Enums::PwrState get() const
|
||||
inline enums::PwrState get() const
|
||||
{
|
||||
return _currState;
|
||||
}
|
||||
|
||||
inline std::string getName() const
|
||||
{
|
||||
return Enums::PwrStateStrings[_currState];
|
||||
return enums::PwrStateStrings[_currState];
|
||||
}
|
||||
|
||||
/** Returns the percentage residency for each power state */
|
||||
@@ -104,12 +104,12 @@ class PowerState : public SimObject
|
||||
* Change the power state of this object to a power state equal to OR more
|
||||
* performant than p. Returns the power state the object actually went to.
|
||||
*/
|
||||
Enums::PwrState matchPwrState(Enums::PwrState p);
|
||||
enums::PwrState matchPwrState(enums::PwrState p);
|
||||
|
||||
/**
|
||||
* Return the power states this object can be in
|
||||
*/
|
||||
std::set<Enums::PwrState> getPossibleStates() const
|
||||
std::set<enums::PwrState> getPossibleStates() const
|
||||
{
|
||||
return possibleStates;
|
||||
}
|
||||
@@ -117,10 +117,10 @@ class PowerState : public SimObject
|
||||
protected:
|
||||
|
||||
/** To keep track of the current power state */
|
||||
Enums::PwrState _currState;
|
||||
enums::PwrState _currState;
|
||||
|
||||
/** The possible power states this object can be in */
|
||||
std::set<Enums::PwrState> possibleStates;
|
||||
std::set<enums::PwrState> possibleStates;
|
||||
|
||||
/** Last tick the power stats were calculated */
|
||||
Tick prvEvalTick = 0;
|
||||
|
||||
@@ -275,7 +275,7 @@ System::getPort(const std::string &if_name, PortID idx)
|
||||
}
|
||||
|
||||
void
|
||||
System::setMemoryMode(Enums::MemoryMode mode)
|
||||
System::setMemoryMode(enums::MemoryMode mode)
|
||||
{
|
||||
assert(drainState() == DrainState::Drained);
|
||||
memoryMode = mode;
|
||||
|
||||
@@ -259,8 +259,8 @@ class System : public SimObject, public PCEventScope
|
||||
bool
|
||||
isAtomicMode() const
|
||||
{
|
||||
return memoryMode == Enums::atomic ||
|
||||
memoryMode == Enums::atomic_noncaching;
|
||||
return memoryMode == enums::atomic ||
|
||||
memoryMode == enums::atomic_noncaching;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,7 +269,7 @@ class System : public SimObject, public PCEventScope
|
||||
* SimObjects are expected to use Port::sendTiming() and
|
||||
* Port::recvTiming() when accessing memory in this mode.
|
||||
*/
|
||||
bool isTimingMode() const { return memoryMode == Enums::timing; }
|
||||
bool isTimingMode() const { return memoryMode == enums::timing; }
|
||||
|
||||
/**
|
||||
* Should caches be bypassed?
|
||||
@@ -280,7 +280,7 @@ class System : public SimObject, public PCEventScope
|
||||
bool
|
||||
bypassCaches() const
|
||||
{
|
||||
return memoryMode == Enums::atomic_noncaching;
|
||||
return memoryMode == enums::atomic_noncaching;
|
||||
}
|
||||
/** @} */
|
||||
|
||||
@@ -292,7 +292,7 @@ class System : public SimObject, public PCEventScope
|
||||
* world should use one of the query functions above
|
||||
* (isAtomicMode(), isTimingMode(), bypassCaches()).
|
||||
*/
|
||||
Enums::MemoryMode getMemoryMode() const { return memoryMode; }
|
||||
enums::MemoryMode getMemoryMode() const { return memoryMode; }
|
||||
|
||||
/**
|
||||
* Change the memory mode of the system.
|
||||
@@ -301,7 +301,7 @@ class System : public SimObject, public PCEventScope
|
||||
*
|
||||
* @param mode Mode to change to (atomic/timing/...)
|
||||
*/
|
||||
void setMemoryMode(Enums::MemoryMode mode);
|
||||
void setMemoryMode(enums::MemoryMode mode);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@@ -413,7 +413,7 @@ class System : public SimObject, public PCEventScope
|
||||
|
||||
PhysicalMemory physmem;
|
||||
|
||||
Enums::MemoryMode memoryMode;
|
||||
enums::MemoryMode memoryMode;
|
||||
|
||||
const unsigned int _cacheLineSize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user