Move Set/GetThreadName() to Tracy API.

This commit is contained in:
Bartosz Taudul 2020-01-25 16:17:03 +01:00
parent 2377911313
commit a90004b983
4 changed files with 11 additions and 11 deletions

View File

@ -870,7 +870,7 @@ TRACY_API moodycamel::ConcurrentQueue<QueueItem>& GetQueue();
struct RPMallocInit { RPMallocInit() { rpmalloc_initialize(); } }; struct RPMallocInit { RPMallocInit() { rpmalloc_initialize(); } };
TRACY_API void InitRPMallocThread() void InitRPMallocThread()
{ {
rpmalloc_initialize(); rpmalloc_initialize();
rpmalloc_thread_initialize(); rpmalloc_thread_initialize();
@ -941,14 +941,14 @@ TRACY_API std::atomic<uint32_t>& GetLockCounter() { return GetProfilerData().loc
TRACY_API std::atomic<uint8_t>& GetGpuCtxCounter() { return GetProfilerData().gpuCtxCounter; } TRACY_API std::atomic<uint8_t>& GetGpuCtxCounter() { return GetProfilerData().gpuCtxCounter; }
TRACY_API GpuCtxWrapper& GetGpuCtx() { return GetProfilerThreadData().gpuCtx; } TRACY_API GpuCtxWrapper& GetGpuCtx() { return GetProfilerThreadData().gpuCtx; }
TRACY_API uint64_t GetThreadHandle() { return detail::GetThreadHandleImpl(); } TRACY_API uint64_t GetThreadHandle() { return detail::GetThreadHandleImpl(); }
TRACY_API std::atomic<ThreadNameData*>& GetThreadNameData() { return GetProfilerData().threadNameData; } std::atomic<ThreadNameData*>& GetThreadNameData() { return GetProfilerData().threadNameData; }
# ifdef TRACY_ON_DEMAND # ifdef TRACY_ON_DEMAND
TRACY_API LuaZoneState& GetLuaZoneState() { return GetProfilerThreadData().luaZoneState; } TRACY_API LuaZoneState& GetLuaZoneState() { return GetProfilerThreadData().luaZoneState; }
# endif # endif
#else #else
TRACY_API void InitRPMallocThread() void InitRPMallocThread()
{ {
rpmalloc_thread_initialize(); rpmalloc_thread_initialize();
} }
@ -1003,7 +1003,7 @@ TRACY_API uint64_t GetThreadHandle() { return detail::GetThreadHandleImpl(); }
TRACY_API uint64_t GetThreadHandle() { return s_threadHandle.val; } TRACY_API uint64_t GetThreadHandle() { return s_threadHandle.val; }
# endif # endif
TRACY_API std::atomic<ThreadNameData*>& GetThreadNameData() { return s_threadNameData; } std::atomic<ThreadNameData*>& GetThreadNameData() { return s_threadNameData; }
# ifdef TRACY_ON_DEMAND # ifdef TRACY_ON_DEMAND
TRACY_API LuaZoneState& GetLuaZoneState() { return s_luaZoneState; } TRACY_API LuaZoneState& GetLuaZoneState() { return s_luaZoneState; }

View File

@ -58,7 +58,7 @@ TRACY_API std::atomic<uint8_t>& GetGpuCtxCounter();
TRACY_API GpuCtxWrapper& GetGpuCtx(); TRACY_API GpuCtxWrapper& GetGpuCtx();
TRACY_API uint64_t GetThreadHandle(); TRACY_API uint64_t GetThreadHandle();
TRACY_API void InitRPMallocThread(); void InitRPMallocThread();
struct SourceLocationData struct SourceLocationData
{ {

View File

@ -48,11 +48,11 @@ struct ThreadNameData
const char* name; const char* name;
ThreadNameData* next; ThreadNameData* next;
}; };
TRACY_API std::atomic<ThreadNameData*>& GetThreadNameData(); std::atomic<ThreadNameData*>& GetThreadNameData();
TRACY_API void InitRPMallocThread(); void InitRPMallocThread();
#endif #endif
void SetThreadName( const char* name ) TRACY_API void SetThreadName( const char* name )
{ {
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
# if defined NTDDI_WIN10_RS2 && NTDDI_VERSION >= NTDDI_WIN10_RS2 # if defined NTDDI_WIN10_RS2 && NTDDI_VERSION >= NTDDI_WIN10_RS2
@ -118,7 +118,7 @@ void SetThreadName( const char* name )
#endif #endif
} }
const char* GetThreadName( uint64_t id ) TRACY_API const char* GetThreadName( uint64_t id )
{ {
static char buf[256]; static char buf[256];
#ifdef TRACY_ENABLE #ifdef TRACY_ENABLE

View File

@ -72,8 +72,8 @@ static inline uint64_t GetThreadHandle()
} }
#endif #endif
void SetThreadName( const char* name ); TRACY_API void SetThreadName( const char* name );
const char* GetThreadName( uint64_t id ); TRACY_API const char* GetThreadName( uint64_t id );
} }