Skip to content

Commit

Permalink
Merge tag '2024-07-12' into push-2024-07-12
Browse files Browse the repository at this point in the history
Change-Id: Id410f0f5e2fd814a0a9e321417d66fa7da88aae1
  • Loading branch information
rdementi committed Jul 14, 2024
2 parents dbe28ec + fdc9cfe commit 15f9147
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 15f9147

Please sign in to comment.