Skip to content

Commit 304389d

Browse files
committed
refactor readUncoreCounterValues
1 parent 77b0436 commit 304389d

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/cpucounters.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6564,9 +6564,7 @@ ServerUncoreCounterState PCM::getServerUncoreCounterState(uint32 socket)
65646564
uint32 refCore = socketRefCore[socket];
65656565
TemporalThreadAffinity tempThreadAffinity(refCore);
65666566

6567-
readUncoreCounterValues(result, socket, CBO_PMU_ID);
6568-
6569-
readUncoreCounterValues(result, socket, MDF_PMU_ID);
6567+
readUncoreCounterValues(result, socket);
65706568

65716569
for (uint32 stack = 0; socket < iioPMUs.size() && stack < iioPMUs[socket].size() && stack < ServerUncoreCounterState::maxIIOStacks; ++stack)
65726570
{
@@ -6586,11 +6584,8 @@ ServerUncoreCounterState PCM::getServerUncoreCounterState(uint32 socket)
65866584
}
65876585
}
65886586

6589-
readUncoreCounterValues(result, socket, UBOX_PMU_ID);
65906587
result.UncClocks = getUncoreClocks(socket);
65916588

6592-
readUncoreCounterValues(result, socket, PCU_PMU_ID);
6593-
65946589
for (size_t p = 0; p < getNumCXLPorts(socket); ++p)
65956590
{
65966591
for (int i = 0; i < ServerUncoreCounterState::maxCounters && socket < cxlPMUs.size() && size_t(i) < cxlPMUs[socket][p].first.size(); ++i)

src/cpucounters.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ class PCM_API PCM
714714
}
715715

716716
template <class T>
717-
void readUncoreCounterValues(T& result, const size_t socket, const int pmu_id) const
717+
void readUncoreCounterValues(T& result, const size_t socket) const
718718
{
719719
if (socket < uncorePMUs.size())
720720
{
@@ -723,9 +723,9 @@ class PCM_API PCM
723723
{
724724
TemporalThreadAffinity tempThreadAffinity(socketRefCore[socket]); // speedup trick for Linux
725725

726-
const auto& pmuIter = uncorePMUs[socket][die].find(pmu_id);
727-
if (pmuIter != uncorePMUs[socket][die].end())
726+
for (auto pmuIter = uncorePMUs[socket][die].begin(); pmuIter != uncorePMUs[socket][die].end(); ++pmuIter)
728727
{
728+
const auto & pmu_id = pmuIter->first;
729729
result.Counters[die][pmu_id].resize(pmuIter->second.size());
730730
for (size_t unit = 0; unit < pmuIter->second.size(); ++unit)
731731
{

0 commit comments

Comments
 (0)