Skip to content

Commit 16e270f

Browse files
committed
fixes
Change-Id: I7dc199499e54c3d873644b3bbf240bae8c142c35
1 parent 64adee9 commit 16e270f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/cpucounters.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,11 +822,12 @@ class PCM_API PCM
822822

823823
public:
824824

825-
size_t getMaxNumOfUncorePMUs(const int pmu_id) const
825+
size_t getMaxNumOfUncorePMUs(const int pmu_id, const size_t socket = 0) const
826826
{
827827
size_t count = 0ULL;
828-
for (auto& s : uncorePMUs)
828+
if (socket < uncorePMUs.size())
829829
{
830+
const auto & s = uncorePMUs[socket];
830831
for (auto& d : s)
831832
{
832833
const auto iter = d.find(pmu_id);

src/pcm-power.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ uint64 getPPDCycles(uint32 channel, const ServerUncoreCounterState & before, con
7676

7777
double getNormalizedPCUCounter(uint32 unit, uint32 counter, const ServerUncoreCounterState & before, const ServerUncoreCounterState & after)
7878
{
79-
return double(getUncoreCounter(PCM::PCU_PMU_ID, unit, counter, before, after)) / double(getPCUClocks(unit, before, after));
79+
const auto clk = getPCUClocks(unit, before, after);
80+
if (clk)
81+
{
82+
return double(getUncoreCounter(PCM::PCU_PMU_ID, unit, counter, before, after)) / double(clk);
83+
}
84+
return -1.0;
8085
}
8186

8287
double getNormalizedPCUCounter(uint32 unit, uint32 counter, const ServerUncoreCounterState & before, const ServerUncoreCounterState & after, PCM * m)

0 commit comments

Comments
 (0)