1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Fix code formatting

This commit is contained in:
Igor S. Gerasimov 2025-01-02 11:49:51 +01:00
parent 31eeb843c7
commit b9c7cd1738
3 changed files with 39 additions and 17 deletions

View File

@ -4292,7 +4292,8 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___trac
} }
#endif #endif
auto zoneQueue = tracy::QueueType::ZoneBegin; auto zoneQueue = tracy::QueueType::ZoneBegin;
if( depth > 0 && tracy::has_callstack() ) { if( depth > 0 && tracy::has_callstack() )
{
tracy::GetProfiler().SendCallstack( depth ); tracy::GetProfiler().SendCallstack( depth );
zoneQueue = tracy::QueueType::ZoneBeginCallstack; zoneQueue = tracy::QueueType::ZoneBeginCallstack;
} }
@ -4360,7 +4361,8 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srclo
} }
#endif #endif
auto zoneQueue = tracy::QueueType::ZoneBeginAllocSrcLoc; auto zoneQueue = tracy::QueueType::ZoneBeginAllocSrcLoc;
if( depth > 0 && tracy::has_callstack() ) { if( depth > 0 && tracy::has_callstack() )
{
tracy::GetProfiler().SendCallstack( depth ); tracy::GetProfiler().SendCallstack( depth );
zoneQueue = tracy::QueueType::ZoneBeginAllocSrcLocCallstack; zoneQueue = tracy::QueueType::ZoneBeginAllocSrcLocCallstack;
} }

View File

@ -513,7 +513,8 @@ public:
static tracy_force_inline void MemAllocCallstack( const void* ptr, size_t size, int depth, bool secure ) static tracy_force_inline void MemAllocCallstack( const void* ptr, size_t size, int depth, bool secure )
{ {
if( secure && !ProfilerAvailable() ) return; if( secure && !ProfilerAvailable() ) return;
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
auto& profiler = GetProfiler(); auto& profiler = GetProfiler();
# ifdef TRACY_ON_DEMAND # ifdef TRACY_ON_DEMAND
if( !profiler.IsConnected() ) return; if( !profiler.IsConnected() ) return;
@ -526,7 +527,9 @@ public:
SendCallstackSerial( callstack ); SendCallstackSerial( callstack );
SendMemAlloc( QueueType::MemAllocCallstack, thread, ptr, size ); SendMemAlloc( QueueType::MemAllocCallstack, thread, ptr, size );
profiler.m_serialLock.unlock(); profiler.m_serialLock.unlock();
} else { }
else
{
MemAlloc( ptr, size, secure ); MemAlloc( ptr, size, secure );
} }
} }
@ -539,7 +542,8 @@ public:
MemFree( ptr, secure ); MemFree( ptr, secure );
return; return;
} }
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
auto& profiler = GetProfiler(); auto& profiler = GetProfiler();
# ifdef TRACY_ON_DEMAND # ifdef TRACY_ON_DEMAND
if( !profiler.IsConnected() ) return; if( !profiler.IsConnected() ) return;
@ -552,7 +556,9 @@ public:
SendCallstackSerial( callstack ); SendCallstackSerial( callstack );
SendMemFree( QueueType::MemFreeCallstack, thread, ptr ); SendMemFree( QueueType::MemFreeCallstack, thread, ptr );
profiler.m_serialLock.unlock(); profiler.m_serialLock.unlock();
} else { }
else
{
MemFree( ptr, secure ); MemFree( ptr, secure );
} }
} }
@ -588,7 +594,8 @@ public:
static tracy_force_inline void MemAllocCallstackNamed( const void* ptr, size_t size, int depth, bool secure, const char* name ) static tracy_force_inline void MemAllocCallstackNamed( const void* ptr, size_t size, int depth, bool secure, const char* name )
{ {
if( secure && !ProfilerAvailable() ) return; if( secure && !ProfilerAvailable() ) return;
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
auto& profiler = GetProfiler(); auto& profiler = GetProfiler();
# ifdef TRACY_ON_DEMAND # ifdef TRACY_ON_DEMAND
if( !profiler.IsConnected() ) return; if( !profiler.IsConnected() ) return;
@ -602,7 +609,9 @@ public:
SendMemName( name ); SendMemName( name );
SendMemAlloc( QueueType::MemAllocCallstackNamed, thread, ptr, size ); SendMemAlloc( QueueType::MemAllocCallstackNamed, thread, ptr, size );
profiler.m_serialLock.unlock(); profiler.m_serialLock.unlock();
} else { }
else
{
MemAllocNamed( ptr, size, secure, name ); MemAllocNamed( ptr, size, secure, name );
} }
} }
@ -610,7 +619,8 @@ public:
static tracy_force_inline void MemFreeCallstackNamed( const void* ptr, int depth, bool secure, const char* name ) static tracy_force_inline void MemFreeCallstackNamed( const void* ptr, int depth, bool secure, const char* name )
{ {
if( secure && !ProfilerAvailable() ) return; if( secure && !ProfilerAvailable() ) return;
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
auto& profiler = GetProfiler(); auto& profiler = GetProfiler();
# ifdef TRACY_ON_DEMAND # ifdef TRACY_ON_DEMAND
if( !profiler.IsConnected() ) return; if( !profiler.IsConnected() ) return;
@ -624,7 +634,9 @@ public:
SendMemName( name ); SendMemName( name );
SendMemFree( QueueType::MemFreeCallstackNamed, thread, ptr ); SendMemFree( QueueType::MemFreeCallstackNamed, thread, ptr );
profiler.m_serialLock.unlock(); profiler.m_serialLock.unlock();
} else { }
else
{
MemFreeNamed( ptr, secure, name ); MemFreeNamed( ptr, secure, name );
} }
} }
@ -645,7 +657,8 @@ public:
static tracy_force_inline void MemDiscardCallstack( const char* name, bool secure, int depth ) static tracy_force_inline void MemDiscardCallstack( const char* name, bool secure, int depth )
{ {
if( secure && !ProfilerAvailable() ) return; if( secure && !ProfilerAvailable() ) return;
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
# ifdef TRACY_ON_DEMAND # ifdef TRACY_ON_DEMAND
if( !GetProfiler().IsConnected() ) return; if( !GetProfiler().IsConnected() ) return;
# endif # endif
@ -657,14 +670,17 @@ public:
SendCallstackSerial( callstack ); SendCallstackSerial( callstack );
SendMemDiscard( QueueType::MemDiscard, thread, name ); SendMemDiscard( QueueType::MemDiscard, thread, name );
GetProfiler().m_serialLock.unlock(); GetProfiler().m_serialLock.unlock();
} else { }
else
{
MemDiscard( name, secure ); MemDiscard( name, secure );
} }
} }
static tracy_force_inline void SendCallstack( int depth ) static tracy_force_inline void SendCallstack( int depth )
{ {
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
auto ptr = Callstack( depth ); auto ptr = Callstack( depth );
TracyQueuePrepare( QueueType::Callstack ); TracyQueuePrepare( QueueType::Callstack );
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr ); MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );
@ -904,7 +920,8 @@ private:
static tracy_force_inline void SendCallstackSerial( void* ptr ) static tracy_force_inline void SendCallstackSerial( void* ptr )
{ {
if ( has_callstack() ) { if( has_callstack() )
{
auto item = GetProfiler().m_serialQueue.prepare_next(); auto item = GetProfiler().m_serialQueue.prepare_next();
MemWrite( &item->hdr.type, QueueType::CallstackSerial ); MemWrite( &item->hdr.type, QueueType::CallstackSerial );
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr ); MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );

View File

@ -35,7 +35,8 @@ public:
m_connectionId = GetProfiler().ConnectionId(); m_connectionId = GetProfiler().ConnectionId();
#endif #endif
auto zoneQueue = QueueType::ZoneBegin; auto zoneQueue = QueueType::ZoneBegin;
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
GetProfiler().SendCallstack( depth ); GetProfiler().SendCallstack( depth );
zoneQueue = QueueType::ZoneBeginCallstack; zoneQueue = QueueType::ZoneBeginCallstack;
} }
@ -57,12 +58,14 @@ public:
m_connectionId = GetProfiler().ConnectionId(); m_connectionId = GetProfiler().ConnectionId();
#endif #endif
auto zoneQueue = QueueType::ZoneBeginAllocSrcLoc; auto zoneQueue = QueueType::ZoneBeginAllocSrcLoc;
if( depth > 0 && has_callstack() ) { if( depth > 0 && has_callstack() )
{
GetProfiler().SendCallstack( depth ); GetProfiler().SendCallstack( depth );
zoneQueue = QueueType::ZoneBeginAllocSrcLocCallstack; zoneQueue = QueueType::ZoneBeginAllocSrcLocCallstack;
} }
TracyQueuePrepare( zoneQueue ); TracyQueuePrepare( zoneQueue );
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz, color ); const auto srcloc =
Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz, color );
MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
MemWrite( &item->zoneBegin.srcloc, srcloc ); MemWrite( &item->zoneBegin.srcloc, srcloc );
TracyQueueCommit( zoneBeginThread ); TracyQueueCommit( zoneBeginThread );