mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Hide rest of statics.
This commit is contained in:
parent
9fabafbeca
commit
3f914834b7
@ -32,6 +32,25 @@ namespace tracy
|
||||
DLL_IMPORT void(*get_rpfree())(void* ptr);
|
||||
DLL_IMPORT moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer*(*get_token())();
|
||||
DLL_IMPORT Profiler&(*get_profiler())();
|
||||
DLL_IMPORT std::atomic<uint32_t>&(*get_getlockcounter())();
|
||||
DLL_IMPORT std::atomic<uint8_t>&(*get_getgpuctxcounter())();
|
||||
DLL_IMPORT GpuCtxWrapper&(*get_getgpuctx())();
|
||||
|
||||
static void*(*rpmalloc_fpt)(size_t size) = get_rpmalloc();
|
||||
static void(*rpfree_fpt)(void* ptr) = get_rpfree();
|
||||
static moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer*(*GetToken_fpt)() = get_token();
|
||||
static Profiler&(*GetProfiler_fpt)() = get_profiler();
|
||||
static std::atomic<uint32_t>&(*GetLockCounter_fpt)() = get_getlockcounter();
|
||||
static std::atomic<uint8_t>&(*GetGpuCtxCounter_fpt)() = get_getgpuctxcounter();
|
||||
static GpuCtxWrapper&(*GetGpuCtx_fpt)() = get_getgpuctx();
|
||||
|
||||
RPMALLOC_RESTRICT void* rpmalloc(size_t size) { return rpmalloc_fpt(size); }
|
||||
void rpfree(void* ptr) { rpfree_fpt(ptr); }
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken() { return GetToken_fpt(); }
|
||||
Profiler& GetProfiler() { return GetProfiler_fpt(); }
|
||||
std::atomic<uint32_t>& GetLockCounter() { return GetLockCounter_fpt(); }
|
||||
std::atomic<uint8_t>& GetGpuCtxCounter() { return GetGpuCtxCounter_fpt(); }
|
||||
GpuCtxWrapper& GetGpuCtx() { return GetGpuCtx_fpt(); }
|
||||
|
||||
#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6
|
||||
DLL_IMPORT int64_t(*get_GetTimeImpl())();
|
||||
@ -40,43 +59,23 @@ namespace tracy
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_COLLECT_THREAD_NAMES
|
||||
DLL_IMPORT std::atomic<ThreadNameData*>& get_threadNameData();
|
||||
DLL_IMPORT std::atomic<ThreadNameData*>& get_threadnamedata();
|
||||
DLL_IMPORT void(*get_rpmalloc_thread_initialize())();
|
||||
|
||||
std::atomic<ThreadNameData*>& s_threadNameData = get_threadNameData();
|
||||
void(*rpmalloc_thread_initialize_fpt)() = get_rpmalloc_thread_initialize();
|
||||
static std::atomic<ThreadNameData*>&(*GetThreadNameData_fpt)() = get_getthreadnamedata();
|
||||
static void(*rpmalloc_thread_initialize_fpt)() = get_rpmalloc_thread_initialize();
|
||||
|
||||
void rpmalloc_thread_initialize(void)
|
||||
{
|
||||
rpmalloc_thread_initialize_fpt();
|
||||
}
|
||||
std::atomic<ThreadNameData*>& GetThreadNameData() { return GetThreadNameData_fpt(); }
|
||||
void rpmalloc_thread_initialize(void) { rpmalloc_thread_initialize_fpt(); }
|
||||
#endif
|
||||
|
||||
static void*(*rpmalloc_fpt)(size_t size) = get_rpmalloc();
|
||||
static void(*rpfree_fpt)(void* ptr) = get_rpfree();
|
||||
static moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer*(*GetToken_fpt)() = get_token;
|
||||
static Profiler&(*GetProfiler_fpt)() = get_profiler();
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
DLL_IMPORT LuaZoneState&(*get_getluazonestate())();
|
||||
|
||||
RPMALLOC_RESTRICT void* rpmalloc(size_t size)
|
||||
{
|
||||
return rpmalloc_fpt(size);
|
||||
}
|
||||
|
||||
void rpfree(void* ptr)
|
||||
{
|
||||
rpfree_fpt(ptr);
|
||||
}
|
||||
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken()
|
||||
{
|
||||
return GetToken_fpt();
|
||||
}
|
||||
|
||||
Profiler& GetProfiler()
|
||||
{
|
||||
return GetProfiler_fpt();
|
||||
}
|
||||
static LuaZoneState&(*GetLuaZoneState_fpt)() = get_getluazonestate();
|
||||
|
||||
LuaZoneState& GetLuaZoneState() { return GetLuaZoneState_fpt(); }
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
34
TracyLua.hpp
34
TracyLua.hpp
@ -119,7 +119,7 @@ namespace tracy
|
||||
{
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
extern thread_local LuaZoneState s_luaZoneState;
|
||||
LuaZoneState& GetLuaZoneState();
|
||||
#endif
|
||||
|
||||
namespace detail
|
||||
@ -128,10 +128,10 @@ namespace detail
|
||||
static inline int LuaZoneBegin( lua_State* L )
|
||||
{
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
const auto zoneCnt = s_luaZoneState.counter++;
|
||||
if( zoneCnt != 0 && !s_luaZoneState.active ) return 0;
|
||||
s_luaZoneState.active = GetProfiler().IsConnected();
|
||||
if( !s_luaZoneState.active ) return 0;
|
||||
const auto zoneCnt = GetLuaZoneState().counter++;
|
||||
if( zoneCnt != 0 && !GetLuaZoneState().active ) return 0;
|
||||
GetLuaZoneState().active = GetProfiler().IsConnected();
|
||||
if( !GetLuaZoneState().active ) return 0;
|
||||
#endif
|
||||
|
||||
const uint32_t color = Color::DeepSkyBlue3;
|
||||
@ -182,10 +182,10 @@ static inline int LuaZoneBegin( lua_State* L )
|
||||
static inline int LuaZoneBeginN( lua_State* L )
|
||||
{
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
const auto zoneCnt = s_luaZoneState.counter++;
|
||||
if( zoneCnt != 0 && !s_luaZoneState.active ) return 0;
|
||||
s_luaZoneState.active = GetProfiler().IsConnected();
|
||||
if( !s_luaZoneState.active ) return 0;
|
||||
const auto zoneCnt = GetLuaZoneState().counter++;
|
||||
if( zoneCnt != 0 && !GetLuaZoneState().active ) return 0;
|
||||
GetLuaZoneState().active = GetProfiler().IsConnected();
|
||||
if( !GetLuaZoneState().active ) return 0;
|
||||
#endif
|
||||
|
||||
const uint32_t color = Color::DeepSkyBlue3;
|
||||
@ -240,12 +240,12 @@ static inline int LuaZoneBeginN( lua_State* L )
|
||||
static inline int LuaZoneEnd( lua_State* L )
|
||||
{
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
assert( s_luaZoneState.counter != 0 );
|
||||
s_luaZoneState.counter--;
|
||||
if( !s_luaZoneState.active ) return 0;
|
||||
assert( GetLuaZoneState().counter != 0 );
|
||||
GetLuaZoneState().counter--;
|
||||
if( !GetLuaZoneState().active ) return 0;
|
||||
if( !GetProfiler().IsConnected() )
|
||||
{
|
||||
s_luaZoneState.active = false;
|
||||
GetLuaZoneState().active = false;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -270,10 +270,10 @@ static inline int LuaZoneEnd( lua_State* L )
|
||||
static inline int LuaZoneText( lua_State* L )
|
||||
{
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( !s_luaZoneState.active ) return 0;
|
||||
if( !GetLuaZoneState().active ) return 0;
|
||||
if( !GetProfiler().IsConnected() )
|
||||
{
|
||||
s_luaZoneState.active = false;
|
||||
GetLuaZoneState().active = false;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -298,10 +298,10 @@ static inline int LuaZoneText( lua_State* L )
|
||||
static inline int LuaZoneName( lua_State* L )
|
||||
{
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( !s_luaZoneState.active ) return 0;
|
||||
if( !GetLuaZoneState().active ) return 0;
|
||||
if( !GetProfiler().IsConnected() )
|
||||
{
|
||||
s_luaZoneState.active = false;
|
||||
GetLuaZoneState().active = false;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
#include "common/TracyAlign.hpp"
|
||||
#include "common/TracyAlloc.hpp"
|
||||
|
||||
#define TracyGpuContext tracy::s_gpuCtx.ptr = (tracy::GpuCtx*)tracy::tracy_malloc( sizeof( tracy::GpuCtx ) ); new(tracy::s_gpuCtx.ptr) tracy::GpuCtx;
|
||||
#define TracyGpuContext tracy::GetGpuCtx().ptr = (tracy::GpuCtx*)tracy::tracy_malloc( sizeof( tracy::GpuCtx ) ); new(tracy::GetGpuCtx().ptr) tracy::GpuCtx;
|
||||
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
|
||||
# define TracyGpuNamedZone( varname, name ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), TRACY_CALLSTACK );
|
||||
# define TracyGpuNamedZoneC( varname, name, color ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), TRACY_CALLSTACK );
|
||||
@ -52,7 +52,7 @@ public:
|
||||
# define TracyGpuZone( name ) TracyGpuNamedZone( ___tracy_gpu_zone, name )
|
||||
# define TracyGpuZoneC( name, color ) TracyGpuNamedZoneC( ___tracy_gpu_zone, name, color )
|
||||
#endif
|
||||
#define TracyGpuCollect tracy::s_gpuCtx.ptr->Collect();
|
||||
#define TracyGpuCollect tracy::GetGpuCtx().ptr->Collect();
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
# define TracyGpuNamedZoneS( varname, name, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), depth );
|
||||
@ -69,8 +69,6 @@ public:
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
extern std::atomic<uint8_t> s_gpuCtxCounter;
|
||||
|
||||
class GpuCtx
|
||||
{
|
||||
friend class GpuCtxScope;
|
||||
@ -79,7 +77,7 @@ class GpuCtx
|
||||
|
||||
public:
|
||||
GpuCtx()
|
||||
: m_context( s_gpuCtxCounter.fetch_add( 1, std::memory_order_relaxed ) )
|
||||
: m_context( GetGpuCtxCounter().fetch_add( 1, std::memory_order_relaxed ) )
|
||||
, m_head( 0 )
|
||||
, m_tail( 0 )
|
||||
{
|
||||
@ -194,8 +192,6 @@ private:
|
||||
unsigned int m_tail;
|
||||
};
|
||||
|
||||
extern thread_local GpuCtxWrapper s_gpuCtx;
|
||||
|
||||
class GpuCtxScope
|
||||
{
|
||||
public:
|
||||
@ -207,8 +203,8 @@ public:
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( !m_active ) return;
|
||||
#endif
|
||||
const auto queryId = s_gpuCtx.ptr->NextQueryId();
|
||||
glQueryCounter( s_gpuCtx.ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||
const auto queryId = GetGpuCtx().ptr->NextQueryId();
|
||||
glQueryCounter( GetGpuCtx().ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||
|
||||
Magic magic;
|
||||
auto token = GetToken();
|
||||
@ -219,7 +215,7 @@ public:
|
||||
MemWrite( &item->gpuZoneBegin.srcloc, (uint64_t)srcloc );
|
||||
memset( &item->gpuZoneBegin.thread, 0, sizeof( item->gpuZoneBegin.thread ) );
|
||||
MemWrite( &item->gpuZoneBegin.queryId, uint16_t( queryId ) );
|
||||
MemWrite( &item->gpuZoneBegin.context, s_gpuCtx.ptr->GetId() );
|
||||
MemWrite( &item->gpuZoneBegin.context, GetGpuCtx().ptr->GetId() );
|
||||
tail.store( magic + 1, std::memory_order_release );
|
||||
}
|
||||
|
||||
@ -231,8 +227,8 @@ public:
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( !m_active ) return;
|
||||
#endif
|
||||
const auto queryId = s_gpuCtx.ptr->NextQueryId();
|
||||
glQueryCounter( s_gpuCtx.ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||
const auto queryId = GetGpuCtx().ptr->NextQueryId();
|
||||
glQueryCounter( GetGpuCtx().ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||
|
||||
const auto thread = GetThreadHandle();
|
||||
|
||||
@ -245,7 +241,7 @@ public:
|
||||
MemWrite( &item->gpuZoneBegin.srcloc, (uint64_t)srcloc );
|
||||
MemWrite( &item->gpuZoneBegin.thread, thread );
|
||||
MemWrite( &item->gpuZoneBegin.queryId, uint16_t( queryId ) );
|
||||
MemWrite( &item->gpuZoneBegin.context, s_gpuCtx.ptr->GetId() );
|
||||
MemWrite( &item->gpuZoneBegin.context, GetGpuCtx().ptr->GetId() );
|
||||
tail.store( magic + 1, std::memory_order_release );
|
||||
|
||||
GetProfiler().SendCallstack( depth, thread );
|
||||
@ -256,8 +252,8 @@ public:
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( !m_active ) return;
|
||||
#endif
|
||||
const auto queryId = s_gpuCtx.ptr->NextQueryId();
|
||||
glQueryCounter( s_gpuCtx.ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||
const auto queryId = GetGpuCtx().ptr->NextQueryId();
|
||||
glQueryCounter( GetGpuCtx().ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||
|
||||
Magic magic;
|
||||
auto token = GetToken();
|
||||
@ -266,7 +262,7 @@ public:
|
||||
MemWrite( &item->hdr.type, QueueType::GpuZoneEnd );
|
||||
MemWrite( &item->gpuZoneEnd.cpuTime, Profiler::GetTime() );
|
||||
MemWrite( &item->gpuZoneEnd.queryId, uint16_t( queryId ) );
|
||||
MemWrite( &item->gpuZoneEnd.context, s_gpuCtx.ptr->GetId() );
|
||||
MemWrite( &item->gpuZoneEnd.context, GetGpuCtx().ptr->GetId() );
|
||||
tail.store( magic + 1, std::memory_order_release );
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ using TracyVkCtx = void*;
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
extern std::atomic<uint8_t> s_gpuCtxCounter;
|
||||
|
||||
class VkCtx
|
||||
{
|
||||
friend class VkCtxScope;
|
||||
@ -47,7 +45,7 @@ public:
|
||||
VkCtx( VkPhysicalDevice physdev, VkDevice device, VkQueue queue, VkCommandBuffer cmdbuf )
|
||||
: m_device( device )
|
||||
, m_queue( queue )
|
||||
, m_context( s_gpuCtxCounter.fetch_add( 1, std::memory_order_relaxed ) )
|
||||
, m_context( GetGpuCtxCounter().fetch_add( 1, std::memory_order_relaxed ) )
|
||||
, m_head( 0 )
|
||||
, m_tail( 0 )
|
||||
, m_oldCnt( 0 )
|
||||
|
@ -11,14 +11,12 @@
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
extern std::atomic<uint32_t> s_lockCounter;
|
||||
|
||||
template<class T>
|
||||
class Lockable
|
||||
{
|
||||
public:
|
||||
tracy_force_inline Lockable( const SourceLocationData* srcloc )
|
||||
: m_id( s_lockCounter.fetch_add( 1, std::memory_order_relaxed ) )
|
||||
: m_id( GetLockCounter().fetch_add( 1, std::memory_order_relaxed ) )
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
, m_lockCount( 0 )
|
||||
, m_active( false )
|
||||
@ -211,7 +209,7 @@ class SharedLockable
|
||||
{
|
||||
public:
|
||||
tracy_force_inline SharedLockable( const SourceLocationData* srcloc )
|
||||
: m_id( s_lockCounter.fetch_add( 1, std::memory_order_relaxed ) )
|
||||
: m_id( GetLockCounter().fetch_add( 1, std::memory_order_relaxed ) )
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
, m_lockCount( 0 )
|
||||
, m_active( false )
|
||||
|
@ -768,57 +768,43 @@ static Profiler init_order(105) s_profiler;
|
||||
#endif
|
||||
|
||||
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken()
|
||||
{
|
||||
return s_token.ptr;
|
||||
}
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken() { return s_token.ptr; }
|
||||
Profiler& GetProfiler() { return s_profiler; }
|
||||
moodycamel::ConcurrentQueue<QueueItem>& GetQueue() { return s_queue; }
|
||||
InitTimeWrapper& GetInitTime() { return s_initTime; }
|
||||
std::atomic<uint32_t>& GetLockCounter() { return s_lockCounter; }
|
||||
std::atomic<uint8_t>& GetGpuCtxCounter() { return s_gpuCtxCounter; }
|
||||
GpuCtxWrapper& GetGpuCtx() { return s_gpuCtx; }
|
||||
|
||||
Profiler& GetProfiler()
|
||||
{
|
||||
return s_profiler;
|
||||
}
|
||||
#ifdef TRACY_COLLECT_THREAD_NAMES
|
||||
std::atomic<ThreadNameData*>& GetThreadNameData() { return s_threadNameData; }
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
LuaZoneState& GetLuaZoneState() { return s_luaZoneState; }
|
||||
#endif
|
||||
|
||||
// DLL exports to enable TracyClientDLL.cpp to retrieve the instances of Tracy objects and functions
|
||||
|
||||
DLL_EXPORT void*(*get_rpmalloc())(size_t size)
|
||||
{
|
||||
return rpmalloc;
|
||||
}
|
||||
|
||||
DLL_EXPORT void(*get_rpfree())(void* ptr)
|
||||
{
|
||||
return rpfree;
|
||||
}
|
||||
|
||||
DLL_EXPORT moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer*(*get_token())()
|
||||
{
|
||||
return GetToken;
|
||||
}
|
||||
|
||||
DLL_EXPORT Profiler&(*get_profiler())()
|
||||
{
|
||||
return GetProfiler;
|
||||
}
|
||||
DLL_EXPORT void*(*get_rpmalloc())(size_t size) { return rpmalloc; }
|
||||
DLL_EXPORT void(*get_rpfree())(void* ptr) { return rpfree; }
|
||||
DLL_EXPORT moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer*(*get_token())() { return GetToken; }
|
||||
DLL_EXPORT Profiler&(*get_profiler())() { return GetProfiler; }
|
||||
DLL_EXPORT std::atomic<uint32_t>&(*get_getlockcounter())() { return GetLockCounter; }
|
||||
DLL_EXPORT std::atomic<uint8_t>&(*get_getgpuctxcounter())() { return GetGpuCtxCounter; }
|
||||
DLL_EXPORT GpuCtxWrapper&(*get_getgpuctx())() { return GetGpuCtx; }
|
||||
|
||||
#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6
|
||||
DLL_EXPORT int64_t(*get_GetTimeImpl())()
|
||||
{
|
||||
return GetTimeImpl;
|
||||
}
|
||||
DLL_EXPORT int64_t(*get_GetTimeImpl())() { return GetTimeImpl; }
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_COLLECT_THREAD_NAMES
|
||||
DLL_EXPORT std::atomic<ThreadNameData*>& get_threadNameData()
|
||||
{
|
||||
return s_threadNameData;
|
||||
}
|
||||
|
||||
DLL_EXPORT void(*get_rpmalloc_thread_initialize())()
|
||||
{
|
||||
return rpmalloc_thread_initialize;
|
||||
}
|
||||
DLL_EXPORT std::atomic<ThreadNameData*>&(*get_threadnamedata())() { return GetThreadNameData; }
|
||||
DLL_EXPORT void(*get_rpmalloc_thread_initialize())() { return rpmalloc_thread_initialize; }
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
DLL_EXPORT LuaZoneState&(*get_getluazonestate())() { return GetLuaZoneState; }
|
||||
#endif
|
||||
|
||||
enum { BulkSize = TargetFrameSize / QueueItemSize };
|
||||
|
||||
@ -953,7 +939,7 @@ void Profiler::Worker()
|
||||
|
||||
WelcomeMessage welcome;
|
||||
MemWrite( &welcome.timerMul, m_timerMul );
|
||||
MemWrite( &welcome.initBegin, s_initTime.val );
|
||||
MemWrite( &welcome.initBegin, GetInitTime().val );
|
||||
MemWrite( &welcome.initEnd, m_timeBegin.load( std::memory_order_relaxed ) );
|
||||
MemWrite( &welcome.delay, m_delay );
|
||||
MemWrite( &welcome.resolution, m_resolution );
|
||||
@ -964,7 +950,7 @@ void Profiler::Worker()
|
||||
memcpy( welcome.hostInfo, hostinfo, hisz );
|
||||
memset( welcome.hostInfo + hisz, 0, WelcomeMessageHostInfoSize - hisz );
|
||||
|
||||
moodycamel::ConsumerToken token( s_queue );
|
||||
moodycamel::ConsumerToken token( GetQueue() );
|
||||
|
||||
ListenSocket listen;
|
||||
if( !listen.Listen( "8086", 8 ) )
|
||||
@ -1240,7 +1226,7 @@ void Profiler::ClearQueues( moodycamel::ConsumerToken& token )
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
const auto sz = s_queue.try_dequeue_bulk( token, m_itemBuf, BulkSize );
|
||||
const auto sz = GetQueue().try_dequeue_bulk( token, m_itemBuf, BulkSize );
|
||||
if( sz == 0 ) break;
|
||||
for( size_t i=0; i<sz; i++ ) FreeAssociatedMemory( m_itemBuf[i] );
|
||||
}
|
||||
@ -1269,7 +1255,7 @@ void Profiler::ClearQueues( moodycamel::ConsumerToken& token )
|
||||
|
||||
Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
||||
{
|
||||
const auto sz = s_queue.try_dequeue_bulk( token, m_itemBuf, BulkSize );
|
||||
const auto sz = GetQueue().try_dequeue_bulk( token, m_itemBuf, BulkSize );
|
||||
if( sz > 0 )
|
||||
{
|
||||
auto end = m_itemBuf + sz;
|
||||
@ -1619,8 +1605,8 @@ void Profiler::CalibrateDelay()
|
||||
enum { Events = Iterations * 2 }; // start + end
|
||||
static_assert( Events * 2 < QueuePrealloc, "Delay calibration loop will allocate memory in queue" );
|
||||
|
||||
moodycamel::ProducerToken ptoken_detail( s_queue );
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* ptoken = s_queue.get_explicit_producer( ptoken_detail );
|
||||
moodycamel::ProducerToken ptoken_detail( GetQueue() );
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* ptoken = GetQueue().get_explicit_producer( ptoken_detail );
|
||||
for( int i=0; i<Iterations; i++ )
|
||||
{
|
||||
static const tracy::SourceLocationData __tracy_source_location { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 };
|
||||
@ -1715,12 +1701,12 @@ void Profiler::CalibrateDelay()
|
||||
m_resolution = mindiff;
|
||||
|
||||
enum { Bulk = 1000 };
|
||||
moodycamel::ConsumerToken token( s_queue );
|
||||
moodycamel::ConsumerToken token( GetQueue() );
|
||||
int left = Events * 2;
|
||||
QueueItem item[Bulk];
|
||||
while( left != 0 )
|
||||
{
|
||||
const auto sz = s_queue.try_dequeue_bulk( token, item, std::min( left, (int)Bulk ) );
|
||||
const auto sz = GetQueue().try_dequeue_bulk( token, item, std::min( left, (int)Bulk ) );
|
||||
assert( sz > 0 );
|
||||
left -= (int)sz;
|
||||
}
|
||||
|
@ -40,9 +40,21 @@
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
class GpuCtx;
|
||||
class Profiler;
|
||||
class Socket;
|
||||
|
||||
struct GpuCtxWrapper
|
||||
{
|
||||
GpuCtx* ptr;
|
||||
};
|
||||
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken();
|
||||
Profiler& GetProfiler();
|
||||
std::atomic<uint32_t>& GetLockCounter();
|
||||
std::atomic<uint8_t>& GetGpuCtxCounter();
|
||||
GpuCtxWrapper& GetGpuCtx();
|
||||
|
||||
struct SourceLocationData
|
||||
{
|
||||
const char* name;
|
||||
@ -52,15 +64,6 @@ struct SourceLocationData
|
||||
uint32_t color;
|
||||
};
|
||||
|
||||
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken();
|
||||
Profiler& GetProfiler();
|
||||
|
||||
class GpuCtx;
|
||||
struct GpuCtxWrapper
|
||||
{
|
||||
GpuCtx* ptr;
|
||||
};
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
struct LuaZoneState
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ struct ThreadNameData
|
||||
const char* name;
|
||||
ThreadNameData* next;
|
||||
};
|
||||
extern std::atomic<ThreadNameData*>& s_threadNameData;
|
||||
std::atomic<ThreadNameData*>& GetThreadNameData();
|
||||
#endif
|
||||
|
||||
void SetThreadName( std::thread& thread, const char* name )
|
||||
@ -124,8 +124,8 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
||||
data->id = (uint64_t)handle;
|
||||
# endif
|
||||
data->name = buf;
|
||||
data->next = s_threadNameData.load( std::memory_order_relaxed );
|
||||
while( !s_threadNameData.compare_exchange_weak( data->next, data, std::memory_order_release, std::memory_order_relaxed ) ) {}
|
||||
data->next = GetThreadNameData().load( std::memory_order_relaxed );
|
||||
while( !GetThreadNameData().compare_exchange_weak( data->next, data, std::memory_order_release, std::memory_order_relaxed ) ) {}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -134,7 +134,7 @@ const char* GetThreadName( uint64_t id )
|
||||
{
|
||||
static char buf[256];
|
||||
#ifdef TRACY_COLLECT_THREAD_NAMES
|
||||
auto ptr = s_threadNameData.load( std::memory_order_relaxed );
|
||||
auto ptr = GetThreadNameData().load( std::memory_order_relaxed );
|
||||
while( ptr )
|
||||
{
|
||||
if( ptr->id == id )
|
||||
|
Loading…
Reference in New Issue
Block a user