mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Use rpmalloc for initialization-related allocations.
This commit is contained in:
parent
2bb5d126fd
commit
40efbe8529
@ -972,7 +972,6 @@ void InitRPMallocThread()
|
|||||||
struct ProfilerData
|
struct ProfilerData
|
||||||
{
|
{
|
||||||
int64_t initTime = SetupHwTimer();
|
int64_t initTime = SetupHwTimer();
|
||||||
RPMallocInit rpmalloc_init;
|
|
||||||
moodycamel::ConcurrentQueue<QueueItem> queue;
|
moodycamel::ConcurrentQueue<QueueItem> queue;
|
||||||
Profiler profiler;
|
Profiler profiler;
|
||||||
std::atomic<uint32_t> lockCounter { 0 };
|
std::atomic<uint32_t> lockCounter { 0 };
|
||||||
@ -1002,7 +1001,9 @@ struct ProfilerThreadData
|
|||||||
ProfilerData* s_profilerData = nullptr;
|
ProfilerData* s_profilerData = nullptr;
|
||||||
TRACY_API void StartupProfiler()
|
TRACY_API void StartupProfiler()
|
||||||
{
|
{
|
||||||
s_profilerData = new ProfilerData;
|
RPMallocInit init;
|
||||||
|
s_profilerData = (ProfilerData*)tracy_malloc( sizeof( ProfilerData ) );
|
||||||
|
new (s_profilerData) ProfilerData();
|
||||||
s_profilerData->profiler.SpawnWorkerThreads();
|
s_profilerData->profiler.SpawnWorkerThreads();
|
||||||
}
|
}
|
||||||
static ProfilerData& GetProfilerData()
|
static ProfilerData& GetProfilerData()
|
||||||
@ -1012,7 +1013,8 @@ static ProfilerData& GetProfilerData()
|
|||||||
}
|
}
|
||||||
TRACY_API void ShutdownProfiler()
|
TRACY_API void ShutdownProfiler()
|
||||||
{
|
{
|
||||||
delete s_profilerData;
|
s_profilerData->~ProfilerData();
|
||||||
|
tracy_free( s_profilerData );
|
||||||
s_profilerData = nullptr;
|
s_profilerData = nullptr;
|
||||||
rpmalloc_finalize();
|
rpmalloc_finalize();
|
||||||
}
|
}
|
||||||
@ -1030,7 +1032,8 @@ static ProfilerData& GetProfilerData()
|
|||||||
ptr = profilerData.load( std::memory_order_acquire );
|
ptr = profilerData.load( std::memory_order_acquire );
|
||||||
if( !ptr )
|
if( !ptr )
|
||||||
{
|
{
|
||||||
ptr = (ProfilerData*)malloc( sizeof( ProfilerData ) );
|
RPMallocInit init;
|
||||||
|
ptr = (ProfilerData*)tracy_malloc( sizeof( ProfilerData ) );
|
||||||
new (ptr) ProfilerData();
|
new (ptr) ProfilerData();
|
||||||
profilerData.store( ptr, std::memory_order_release );
|
profilerData.store( ptr, std::memory_order_release );
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user