mirror of
https://github.com/wolfpld/tracy.git
synced 2026-08-29 22:48:22 +00:00
Rename InitRpmalloc to InitAllocator.
The function is about to dispatch between rpmalloc and a pluggable allocator hook, so the rpmalloc-specific name no longer fits. Pure rename plus a small consequence: the SymbolWorker call site no longer needs the TRACY_USE_RPMALLOC guard, since the no-op static-inline fallback in TracyAlloc.hpp makes InitAllocator() safe to call unconditionally.
This commit is contained in:
@@ -14,7 +14,7 @@ extern thread_local bool RpThreadInitDone;
|
||||
extern std::atomic<int> RpInitDone;
|
||||
extern std::atomic<int> RpInitLock;
|
||||
|
||||
tracy_no_inline static void InitRpmallocPlumbing()
|
||||
tracy_no_inline static void InitAllocatorPlumbing()
|
||||
{
|
||||
const auto done = RpInitDone.load( std::memory_order_acquire );
|
||||
if( !done )
|
||||
@@ -33,9 +33,9 @@ tracy_no_inline static void InitRpmallocPlumbing()
|
||||
RpThreadInitDone = true;
|
||||
}
|
||||
|
||||
TRACY_API void InitRpmalloc()
|
||||
TRACY_API void InitAllocator()
|
||||
{
|
||||
if( !RpThreadInitDone ) InitRpmallocPlumbing();
|
||||
if( !RpThreadInitDone ) InitAllocatorPlumbing();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ ModuleNameAndBaseAddress GetModuleNameAndPrepareSymbols( uint64_t addr )
|
||||
constexpr DWORD flag = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;
|
||||
HMODULE mod = NULL;
|
||||
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
if( GetModuleHandleExA( flag, (char*)addr, &mod ) != 0 )
|
||||
{
|
||||
MODULEINFO info;
|
||||
@@ -997,7 +997,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
|
||||
DBGHELP_LOCK;
|
||||
#endif
|
||||
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
|
||||
const ModuleNameAndBaseAddress moduleNameAndAddress = GetModuleNameAndPrepareSymbols( ptr );
|
||||
|
||||
@@ -1314,7 +1314,7 @@ void InitCallstackCritical()
|
||||
|
||||
void InitCallstack()
|
||||
{
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
|
||||
#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
|
||||
CreateImageCaches();
|
||||
@@ -1780,7 +1780,7 @@ CallstackEntryData DecodeCallstackPtrExternal( uint64_t ptr )
|
||||
|
||||
CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
|
||||
{
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
if( !IsKernelAddress( ptr ) )
|
||||
{
|
||||
#ifdef __linux__
|
||||
|
||||
@@ -2371,7 +2371,7 @@ static void FreeAssociatedMemory( const QueueItem& item )
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
case QueueType::CallstackFrameSize:
|
||||
{
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
auto size = MemRead<uint8_t>( &item.callstackFrameSizeFat.size );
|
||||
auto data = (const CallstackEntry*)MemRead<uint64_t>( &item.callstackFrameSizeFat.data );
|
||||
for( uint8_t i=0; i<size; i++ )
|
||||
@@ -2479,7 +2479,7 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
||||
[this, &connectionLost] ( QueueItem* item, size_t sz )
|
||||
{
|
||||
if( connectionLost ) return;
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
assert( sz > 0 );
|
||||
int64_t refThread = m_refTimeThread;
|
||||
int64_t refCtx = m_refTimeCtx;
|
||||
@@ -2944,7 +2944,7 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
|
||||
{
|
||||
dequeueStatus = DequeueStatus::DataDequeued;
|
||||
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
int64_t refSerial = m_refTimeSerial;
|
||||
int64_t refGpu = m_refTimeGpu;
|
||||
#ifdef TRACY_FIBERS
|
||||
@@ -3758,9 +3758,7 @@ void Profiler::SymbolWorker()
|
||||
|
||||
ThreadExitHandler threadExitHandler;
|
||||
SetThreadName( "Tracy Symbol Worker" );
|
||||
#ifdef TRACY_USE_RPMALLOC
|
||||
InitRpmalloc();
|
||||
#endif
|
||||
InitAllocator();
|
||||
InitCallstack();
|
||||
while( m_timeBegin.load( std::memory_order_relaxed ) == 0 ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
|
||||
|
||||
|
||||
@@ -1109,7 +1109,7 @@ void SysTraceWorker( void* ptr )
|
||||
{
|
||||
ThreadExitHandler threadExitHandler;
|
||||
SetThreadName( "Tracy Sampling" );
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
sched_param sp = { 99 };
|
||||
if( pthread_setschedparam( pthread_self(), SCHED_FIFO, &sp ) != 0 ) TracyDebug( "Failed to increase SysTraceWorker thread priority!" );
|
||||
auto ctxBufferIdx = s_ctxBufferIdx;
|
||||
|
||||
@@ -197,7 +197,7 @@ void SysTraceWorker( void* )
|
||||
{
|
||||
ThreadExitHandler threadExitHandler;
|
||||
SetThreadName( "Tracy Mach Watchdog" );
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
SysTraceWatch();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@ namespace tracy
|
||||
{
|
||||
|
||||
#ifdef TRACY_USE_RPMALLOC
|
||||
TRACY_API void InitRpmalloc();
|
||||
TRACY_API void InitAllocator();
|
||||
#else
|
||||
static inline void InitRpmalloc() {}
|
||||
static inline void InitAllocator() {}
|
||||
#endif
|
||||
|
||||
static inline void* tracy_malloc( size_t size )
|
||||
{
|
||||
#ifdef TRACY_USE_RPMALLOC
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
return rpmalloc( size );
|
||||
#else
|
||||
return malloc( size );
|
||||
@@ -41,7 +41,7 @@ static inline void* tracy_malloc_fast( size_t size )
|
||||
static inline void tracy_free( void* ptr )
|
||||
{
|
||||
#ifdef TRACY_USE_RPMALLOC
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
rpfree( ptr );
|
||||
#else
|
||||
free( ptr );
|
||||
@@ -60,7 +60,7 @@ static inline void tracy_free_fast( void* ptr )
|
||||
static inline void* tracy_realloc( void* ptr, size_t size )
|
||||
{
|
||||
#ifdef TRACY_USE_RPMALLOC
|
||||
InitRpmalloc();
|
||||
InitAllocator();
|
||||
return rprealloc( ptr, size );
|
||||
#else
|
||||
return realloc( ptr, size );
|
||||
|
||||
Reference in New Issue
Block a user