Skip to content

Commit

Permalink
Fix for profiler initialization on Linux (#8824)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCash committed Apr 22, 2024
1 parent 1c78e39 commit bf9b9ff
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions engine/dlib/src/dlib/profile/profile_remotery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,36 @@ namespace dmProfile

void SetSampleTreeCallback(void* ctx, FSampleTreeCallback callback)
{
DM_SPINLOCK_SCOPED_LOCK(g_ProfilerLock);
// This function is called both before the profiler is initialized, and during
if (IsInitialized())
{
dmSpinlock::Lock(&g_ProfilerLock);
}

g_SampleTreeCallback = callback;
g_SampleTreeCallbackCtx = ctx;

if (IsInitialized())
{
dmSpinlock::Unlock(&g_ProfilerLock);
}
}

void SetPropertyTreeCallback(void* ctx, FPropertyTreeCallback callback)
{
DM_SPINLOCK_SCOPED_LOCK(g_ProfilerLock);
// This function is called both before the profiler is initialized, and during
if (IsInitialized())
{
dmSpinlock::Lock(&g_ProfilerLock);
}

g_PropertyTreeCallback = callback;
g_PropertyTreeCallbackCtx = ctx;

if (IsInitialized())
{
dmSpinlock::Unlock(&g_ProfilerLock);
}
}

void ProfileScope::StartScope(const char* name, uint64_t* name_hash)
Expand Down

0 comments on commit bf9b9ff

Please sign in to comment.