Skip to content

Commit

Permalink
Merge pull request #786 from intel/push-2024-07-12
Browse files Browse the repository at this point in the history
  • Loading branch information
rdementi authored Jul 14, 2024
2 parents dbe28ec + 15f9147 commit 38aaf6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3062,6 +3062,7 @@ PCM::PCM() :
#ifdef PCM_USE_PERF
canUsePerf = true;
perfEventHandle.resize(num_cores, std::vector<int>(PERF_MAX_COUNTERS, -1));
std::fill(perfTopDownPos.begin(), perfTopDownPos.end(), 0);
#endif

for (int32 i = 0; i < num_cores; ++i)
Expand Down
5 changes: 4 additions & 1 deletion src/pcm-accel-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,16 @@ void readAccelCounters(SystemCounterState& sycs_)
}

AcceleratorCounterState* AcceleratorCounterState::instance = NULL;

std::mutex instanceCreationMutexForAcceleratorCounterState{};

AcceleratorCounterState * AcceleratorCounterState::getInstance()
{
// lock-free read
// cppcheck-suppress identicalConditionAfterEarlyExit
if (instance) return instance;

std::unique_lock<std::mutex> instanceCreationMutex;
std::unique_lock<std::mutex> _(instanceCreationMutexForAcceleratorCounterState);
// cppcheck-suppress identicalConditionAfterEarlyExit
if (instance) return instance;

Expand Down

0 comments on commit 38aaf6c

Please sign in to comment.