Skip to content

Commit

Permalink
populate sys energy field in additional SystemCounterState getters
Browse files Browse the repository at this point in the history
Change-Id: I90c43c50a1a6fe8bb2b7eb5b1b102d7339a121d1
  • Loading branch information
rdementi committed Dec 17, 2024
1 parent 95d6016 commit 0c83112
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6370,6 +6370,7 @@ SystemCounterState PCM::getSystemCounterState()

readAndAggregateCXLCMCounters(result);
readQPICounters(result);
readSystemEnergyStatus(result);

result.ThermalHeadroom = static_cast<int32>(PCM_INVALID_THERMAL_HEADROOM); // not available for system
}
Expand Down Expand Up @@ -6977,6 +6978,11 @@ void PCM::getAllCounterStates(SystemCounterState & systemState, std::vector<Sock
systemState += socketStates[s];
}

readSystemEnergyStatus(systemState);
}

void PCM::readSystemEnergyStatus(SystemCounterState & systemState)
{
if (systemEnergyMetricAvailable() && system_energy_status.get() != nullptr)
{
systemState.systemEnergyStatus = system_energy_status->read();
Expand Down Expand Up @@ -7004,6 +7010,7 @@ void PCM::getUncoreCounterStates(SystemCounterState & systemState, std::vector<S
}

readQPICounters(systemState);
readSystemEnergyStatus(systemState);

for (int32 s = 0; s < num_sockets; ++s)
{
Expand Down
1 change: 1 addition & 0 deletions src/cpucounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@ class PCM_API PCM
template <class CounterStateType>
void readMSRs(std::shared_ptr<SafeMsrHandle> msr, const RawPMUConfig & msrConfig, CounterStateType & result);
void readQPICounters(SystemCounterState & counterState);
void readSystemEnergyStatus(SystemCounterState & systemState);
void readPCICFGRegisters(SystemCounterState& result);
void readMMIORegisters(SystemCounterState& result);
void readPMTRegisters(SystemCounterState& result);
Expand Down

0 comments on commit 0c83112

Please sign in to comment.