mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Disallow direct access to s_token.
This commit is contained in:
parent
44753dd4ac
commit
d865d1cc87
@ -28,7 +28,6 @@ namespace tracy
|
|||||||
# define DLL_IMPORT
|
# define DLL_IMPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DLL_IMPORT moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* get_token();
|
|
||||||
DLL_IMPORT void*(*get_rpmalloc())(size_t size);
|
DLL_IMPORT void*(*get_rpmalloc())(size_t size);
|
||||||
DLL_IMPORT void(*get_rpfree())(void* ptr);
|
DLL_IMPORT void(*get_rpfree())(void* ptr);
|
||||||
DLL_IMPORT Profiler& get_profiler();
|
DLL_IMPORT Profiler& get_profiler();
|
||||||
@ -66,8 +65,6 @@ namespace tracy
|
|||||||
}
|
}
|
||||||
|
|
||||||
Profiler& s_profiler = get_profiler();
|
Profiler& s_profiler = get_profiler();
|
||||||
|
|
||||||
thread_local ProducerWrapper s_token { get_token() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
12
TracyLua.hpp
12
TracyLua.hpp
@ -162,7 +162,7 @@ static inline int LuaZoneBegin( lua_State* L )
|
|||||||
memcpy( ptr + 12 + fsz + 1, dbg.source, ssz + 1 );
|
memcpy( ptr + 12 + fsz + 1, dbg.source, ssz + 1 );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLoc );
|
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLoc );
|
||||||
@ -220,7 +220,7 @@ static inline int LuaZoneBeginN( lua_State* L )
|
|||||||
memcpy( ptr + 12 + fsz + 1 + ssz + 1, name, nsz );
|
memcpy( ptr + 12 + fsz + 1 + ssz + 1, name, nsz );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLoc );
|
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLoc );
|
||||||
@ -251,7 +251,7 @@ static inline int LuaZoneEnd( lua_State* L )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::ZoneEnd );
|
MemWrite( &item->hdr.type, QueueType::ZoneEnd );
|
||||||
@ -282,7 +282,7 @@ static inline int LuaZoneText( lua_State* L )
|
|||||||
const auto size = strlen( txt );
|
const auto size = strlen( txt );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
@ -310,7 +310,7 @@ static inline int LuaZoneName( lua_State* L )
|
|||||||
const auto size = strlen( txt );
|
const auto size = strlen( txt );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
@ -333,7 +333,7 @@ static inline int LuaMessage( lua_State* L )
|
|||||||
const auto size = strlen( txt );
|
const auto size = strlen( txt );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
const float period = 1.f;
|
const float period = 1.f;
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuNewContext );
|
MemWrite( &item->hdr.type, QueueType::GpuNewContext );
|
||||||
@ -150,7 +150,7 @@ public:
|
|||||||
start %= QueryCount;
|
start %= QueryCount;
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
|
|
||||||
while( m_tail != start )
|
while( m_tail != start )
|
||||||
@ -211,7 +211,7 @@ public:
|
|||||||
glQueryCounter( s_gpuCtx.ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
glQueryCounter( s_gpuCtx.ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuZoneBegin );
|
MemWrite( &item->hdr.type, QueueType::GpuZoneBegin );
|
||||||
@ -237,7 +237,7 @@ public:
|
|||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuZoneBeginCallstack );
|
MemWrite( &item->hdr.type, QueueType::GpuZoneBeginCallstack );
|
||||||
@ -260,7 +260,7 @@ public:
|
|||||||
glQueryCounter( s_gpuCtx.ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
glQueryCounter( s_gpuCtx.ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuZoneEnd );
|
MemWrite( &item->hdr.type, QueueType::GpuZoneEnd );
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
vkQueueWaitIdle( queue );
|
vkQueueWaitIdle( queue );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuNewContext );
|
MemWrite( &item->hdr.type, QueueType::GpuNewContext );
|
||||||
@ -153,7 +153,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
|
|
||||||
for( unsigned int idx=0; idx<cnt; idx++ )
|
for( unsigned int idx=0; idx<cnt; idx++ )
|
||||||
@ -213,7 +213,7 @@ public:
|
|||||||
vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, ctx->m_query, queryId );
|
vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, ctx->m_query, queryId );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuZoneBegin );
|
MemWrite( &item->hdr.type, QueueType::GpuZoneBegin );
|
||||||
@ -241,7 +241,7 @@ public:
|
|||||||
vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, ctx->m_query, queryId );
|
vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, ctx->m_query, queryId );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuZoneBeginCallstack );
|
MemWrite( &item->hdr.type, QueueType::GpuZoneBeginCallstack );
|
||||||
@ -264,7 +264,7 @@ public:
|
|||||||
vkCmdWriteTimestamp( m_cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, m_ctx->m_query, queryId );
|
vkCmdWriteTimestamp( m_cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, m_ctx->m_query, queryId );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::GpuZoneEnd );
|
MemWrite( &item->hdr.type, QueueType::GpuZoneEnd );
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
~Lockable()
|
~Lockable()
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockTerminate );
|
MemWrite( &item->hdr.type, QueueType::LockTerminate );
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockWait );
|
MemWrite( &item->hdr.type, QueueType::LockWait );
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
|
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
||||||
@ -126,7 +126,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockRelease );
|
MemWrite( &item->hdr.type, QueueType::LockRelease );
|
||||||
@ -158,7 +158,7 @@ public:
|
|||||||
if( ret )
|
if( ret )
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
||||||
@ -185,7 +185,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockMark );
|
MemWrite( &item->hdr.type, QueueType::LockMark );
|
||||||
@ -220,7 +220,7 @@ public:
|
|||||||
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
||||||
@ -242,7 +242,7 @@ public:
|
|||||||
~SharedLockable()
|
~SharedLockable()
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockTerminate );
|
MemWrite( &item->hdr.type, QueueType::LockTerminate );
|
||||||
@ -278,7 +278,7 @@ public:
|
|||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockWait );
|
MemWrite( &item->hdr.type, QueueType::LockWait );
|
||||||
@ -293,7 +293,7 @@ public:
|
|||||||
|
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
||||||
@ -319,7 +319,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockRelease );
|
MemWrite( &item->hdr.type, QueueType::LockRelease );
|
||||||
@ -351,7 +351,7 @@ public:
|
|||||||
if( ret )
|
if( ret )
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
MemWrite( &item->hdr.type, QueueType::LockObtain );
|
||||||
@ -385,7 +385,7 @@ public:
|
|||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockSharedWait );
|
MemWrite( &item->hdr.type, QueueType::LockSharedWait );
|
||||||
@ -400,7 +400,7 @@ public:
|
|||||||
|
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockSharedObtain );
|
MemWrite( &item->hdr.type, QueueType::LockSharedObtain );
|
||||||
@ -426,7 +426,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockSharedRelease );
|
MemWrite( &item->hdr.type, QueueType::LockSharedRelease );
|
||||||
@ -458,7 +458,7 @@ public:
|
|||||||
if( ret )
|
if( ret )
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockSharedObtain );
|
MemWrite( &item->hdr.type, QueueType::LockSharedObtain );
|
||||||
@ -485,7 +485,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::LockMark );
|
MemWrite( &item->hdr.type, QueueType::LockMark );
|
||||||
|
@ -429,7 +429,7 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp )
|
|||||||
{
|
{
|
||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::CrashReport );
|
MemWrite( &item->hdr.type, QueueType::CrashReport );
|
||||||
@ -471,7 +471,7 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp )
|
|||||||
|
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::Crash );
|
MemWrite( &item->hdr.type, QueueType::Crash );
|
||||||
@ -667,7 +667,7 @@ static void CrashHandler( int signal, siginfo_t* info, void* ucontext )
|
|||||||
{
|
{
|
||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::CrashReport );
|
MemWrite( &item->hdr.type, QueueType::CrashReport );
|
||||||
@ -698,7 +698,7 @@ static void CrashHandler( int signal, siginfo_t* info, void* ucontext )
|
|||||||
|
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::Crash );
|
MemWrite( &item->hdr.type, QueueType::Crash );
|
||||||
@ -713,6 +713,11 @@ static void CrashHandler( int signal, siginfo_t* info, void* ucontext )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct ProducerWrapper
|
||||||
|
{
|
||||||
|
tracy::moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum { QueuePrealloc = 256 * 1024 };
|
enum { QueuePrealloc = 256 * 1024 };
|
||||||
|
|
||||||
@ -763,13 +768,14 @@ Profiler& s_profiler = s_profilerInstance;
|
|||||||
# define DLL_EXPORT __attribute__((visibility("default")))
|
# define DLL_EXPORT __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// DLL exports to enable TracyClientDLL.cpp to retrieve the instances of Tracy objects and functions
|
|
||||||
|
|
||||||
DLL_EXPORT moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* get_token()
|
tracy::moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken()
|
||||||
{
|
{
|
||||||
return s_token.ptr;
|
return s_token.ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DLL exports to enable TracyClientDLL.cpp to retrieve the instances of Tracy objects and functions
|
||||||
|
|
||||||
DLL_EXPORT void*(*get_rpmalloc())(size_t size)
|
DLL_EXPORT void*(*get_rpmalloc())(size_t size)
|
||||||
{
|
{
|
||||||
return rpmalloc;
|
return rpmalloc;
|
||||||
@ -1741,7 +1747,7 @@ void Profiler::SendCallstack( int depth, uint64_t thread, const char* skipBefore
|
|||||||
}
|
}
|
||||||
|
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::Callstack );
|
MemWrite( &item->hdr.type, QueueType::Callstack );
|
||||||
@ -1771,7 +1777,7 @@ TracyCZoneCtx ___tracy_emit_zone_begin( const struct ___tracy_source_location_da
|
|||||||
ctx.id = id;
|
ctx.id = id;
|
||||||
|
|
||||||
tracy::Magic magic;
|
tracy::Magic magic;
|
||||||
auto& token = tracy::s_token.ptr;
|
auto token = tracy::GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
#ifndef TRACY_NO_VERIFY
|
#ifndef TRACY_NO_VERIFY
|
||||||
{
|
{
|
||||||
@ -1813,7 +1819,7 @@ TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___tracy_source_l
|
|||||||
ctx.id = id;
|
ctx.id = id;
|
||||||
|
|
||||||
tracy::Magic magic;
|
tracy::Magic magic;
|
||||||
auto& token = tracy::s_token.ptr;
|
auto token = tracy::GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
#ifndef TRACY_NO_VERIFY
|
#ifndef TRACY_NO_VERIFY
|
||||||
{
|
{
|
||||||
@ -1848,7 +1854,7 @@ void ___tracy_emit_zone_end( TracyCZoneCtx ctx )
|
|||||||
if( !ctx.active ) return;
|
if( !ctx.active ) return;
|
||||||
const auto thread = tracy::GetThreadHandle();
|
const auto thread = tracy::GetThreadHandle();
|
||||||
tracy::Magic magic;
|
tracy::Magic magic;
|
||||||
auto& token = tracy::s_token.ptr;
|
auto token = tracy::GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
#ifndef TRACY_NO_VERIFY
|
#ifndef TRACY_NO_VERIFY
|
||||||
{
|
{
|
||||||
@ -1879,7 +1885,7 @@ void ___tracy_emit_zone_text( TracyCZoneCtx ctx, const char* txt, size_t size )
|
|||||||
if( !ctx.active ) return;
|
if( !ctx.active ) return;
|
||||||
const auto thread = tracy::GetThreadHandle();
|
const auto thread = tracy::GetThreadHandle();
|
||||||
tracy::Magic magic;
|
tracy::Magic magic;
|
||||||
auto& token = tracy::s_token.ptr;
|
auto token = tracy::GetToken();
|
||||||
auto ptr = (char*)tracy::tracy_malloc( size+1 );
|
auto ptr = (char*)tracy::tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
@ -1907,7 +1913,7 @@ void ___tracy_emit_zone_name( TracyCZoneCtx ctx, const char* txt, size_t size )
|
|||||||
if( !ctx.active ) return;
|
if( !ctx.active ) return;
|
||||||
const auto thread = tracy::GetThreadHandle();
|
const auto thread = tracy::GetThreadHandle();
|
||||||
tracy::Magic magic;
|
tracy::Magic magic;
|
||||||
auto& token = tracy::s_token.ptr;
|
auto token = tracy::GetToken();
|
||||||
auto ptr = (char*)tracy::tracy_malloc( size+1 );
|
auto ptr = (char*)tracy::tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
|
@ -51,12 +51,7 @@ struct SourceLocationData
|
|||||||
uint32_t color;
|
uint32_t color;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProducerWrapper
|
tracy::moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* GetToken();
|
||||||
{
|
|
||||||
tracy::moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* ptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern thread_local ProducerWrapper s_token;
|
|
||||||
|
|
||||||
class GpuCtx;
|
class GpuCtx;
|
||||||
struct GpuCtxWrapper
|
struct GpuCtxWrapper
|
||||||
@ -138,7 +133,7 @@ public:
|
|||||||
if( !s_profiler.IsConnected() ) return;
|
if( !s_profiler.IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::FrameMarkMsg );
|
MemWrite( &item->hdr.type, QueueType::FrameMarkMsg );
|
||||||
@ -154,7 +149,7 @@ public:
|
|||||||
if( !s_profiler.IsConnected() ) return;
|
if( !s_profiler.IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, type );
|
MemWrite( &item->hdr.type, type );
|
||||||
@ -169,7 +164,7 @@ public:
|
|||||||
if( !s_profiler.IsConnected() ) return;
|
if( !s_profiler.IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::PlotData );
|
MemWrite( &item->hdr.type, QueueType::PlotData );
|
||||||
@ -186,7 +181,7 @@ public:
|
|||||||
if( !s_profiler.IsConnected() ) return;
|
if( !s_profiler.IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::PlotData );
|
MemWrite( &item->hdr.type, QueueType::PlotData );
|
||||||
@ -203,7 +198,7 @@ public:
|
|||||||
if( !s_profiler.IsConnected() ) return;
|
if( !s_profiler.IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::PlotData );
|
MemWrite( &item->hdr.type, QueueType::PlotData );
|
||||||
@ -220,7 +215,7 @@ public:
|
|||||||
if( !s_profiler.IsConnected() ) return;
|
if( !s_profiler.IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
@ -239,7 +234,7 @@ public:
|
|||||||
if( !s_profiler.IsConnected() ) return;
|
if( !s_profiler.IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::MessageLiteral );
|
MemWrite( &item->hdr.type, QueueType::MessageLiteral );
|
||||||
@ -318,7 +313,7 @@ public:
|
|||||||
#ifdef TRACY_HAS_CALLSTACK
|
#ifdef TRACY_HAS_CALLSTACK
|
||||||
auto ptr = Callstack( depth );
|
auto ptr = Callstack( depth );
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::Callstack );
|
MemWrite( &item->hdr.type, QueueType::Callstack );
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
m_thread = thread;
|
m_thread = thread;
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::ZoneBegin );
|
MemWrite( &item->hdr.type, QueueType::ZoneBegin );
|
||||||
@ -53,7 +53,7 @@ public:
|
|||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
m_thread = thread;
|
m_thread = thread;
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::ZoneBeginCallstack );
|
MemWrite( &item->hdr.type, QueueType::ZoneBeginCallstack );
|
||||||
@ -75,7 +75,7 @@ public:
|
|||||||
{
|
{
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto& tail = token->get_tail_index();
|
auto& tail = token->get_tail_index();
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
MemWrite( &item->hdr.type, QueueType::ZoneEnd );
|
MemWrite( &item->hdr.type, QueueType::ZoneEnd );
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
{
|
{
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
{
|
{
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token.ptr;
|
auto token = GetToken();
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size+1 );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
ptr[size] = '\0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user