Skip to content

Commit 38aaf6c

Browse files
authored
Merge pull request #786 from intel/push-2024-07-12
2 parents dbe28ec + 15f9147 commit 38aaf6c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/cpucounters.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,6 +3062,7 @@ PCM::PCM() :
30623062
#ifdef PCM_USE_PERF
30633063
canUsePerf = true;
30643064
perfEventHandle.resize(num_cores, std::vector<int>(PERF_MAX_COUNTERS, -1));
3065+
std::fill(perfTopDownPos.begin(), perfTopDownPos.end(), 0);
30653066
#endif
30663067

30673068
for (int32 i = 0; i < num_cores; ++i)

src/pcm-accel-common.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,16 @@ void readAccelCounters(SystemCounterState& sycs_)
351351
}
352352

353353
AcceleratorCounterState* AcceleratorCounterState::instance = NULL;
354+
355+
std::mutex instanceCreationMutexForAcceleratorCounterState{};
356+
354357
AcceleratorCounterState * AcceleratorCounterState::getInstance()
355358
{
356359
// lock-free read
357360
// cppcheck-suppress identicalConditionAfterEarlyExit
358361
if (instance) return instance;
359362

360-
std::unique_lock<std::mutex> instanceCreationMutex;
363+
std::unique_lock<std::mutex> _(instanceCreationMutexForAcceleratorCounterState);
361364
// cppcheck-suppress identicalConditionAfterEarlyExit
362365
if (instance) return instance;
363366

0 commit comments

Comments
 (0)