mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 12:53:51 +00:00
Merge ScopedZone initializers
This commit is contained in:
parent
1c63239a78
commit
cf912bbb19
@ -10,6 +10,7 @@
|
|||||||
#include "../common/TracyAlign.hpp"
|
#include "../common/TracyAlign.hpp"
|
||||||
#include "../common/TracyAlloc.hpp"
|
#include "../common/TracyAlloc.hpp"
|
||||||
#include "TracyProfiler.hpp"
|
#include "TracyProfiler.hpp"
|
||||||
|
#include "TracyCallstack.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
@ -22,24 +23,7 @@ public:
|
|||||||
ScopedZone& operator=( const ScopedZone& ) = delete;
|
ScopedZone& operator=( const ScopedZone& ) = delete;
|
||||||
ScopedZone& operator=( ScopedZone&& ) = delete;
|
ScopedZone& operator=( ScopedZone&& ) = delete;
|
||||||
|
|
||||||
tracy_force_inline ScopedZone( const SourceLocationData* srcloc, bool is_active = true )
|
tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth = -1, bool is_active = true )
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
|
||||||
#else
|
|
||||||
: m_active( is_active )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if( !m_active ) return;
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
|
||||||
#endif
|
|
||||||
TracyQueuePrepare( QueueType::ZoneBegin );
|
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
|
||||||
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
|
||||||
TracyQueueCommit( zoneBeginThread );
|
|
||||||
}
|
|
||||||
|
|
||||||
tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active = true )
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@ -50,35 +34,22 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
m_connectionId = GetProfiler().ConnectionId();
|
||||||
#endif
|
#endif
|
||||||
|
if (depth > 0 && has_stacktrace()) {
|
||||||
GetProfiler().SendCallstack( depth );
|
GetProfiler().SendCallstack( depth );
|
||||||
|
|
||||||
TracyQueuePrepare( QueueType::ZoneBeginCallstack );
|
TracyQueuePrepare( QueueType::ZoneBeginCallstack );
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
||||||
TracyQueueCommit( zoneBeginThread );
|
TracyQueueCommit( zoneBeginThread );
|
||||||
}
|
} else {
|
||||||
|
TracyQueuePrepare( QueueType::ZoneBegin );
|
||||||
tracy_force_inline ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, bool is_active = true )
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
|
||||||
#else
|
|
||||||
: m_active( is_active )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if( !m_active ) return;
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
|
||||||
#endif
|
|
||||||
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLoc );
|
|
||||||
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, (uint64_t)srcloc );
|
||||||
TracyQueueCommit( zoneBeginThread );
|
TracyQueueCommit( zoneBeginThread );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tracy_force_inline ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, bool is_active = true ) : ScopedZone( line, source, sourceSz, function, functionSz, name, nameSz, static_cast<uint32_t>(0), is_active ) {}
|
tracy_force_inline ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, int depth = -1, bool is_active = true )
|
||||||
|
|
||||||
tracy_force_inline ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, int depth, bool is_active = true )
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@ -89,6 +60,7 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
m_connectionId = GetProfiler().ConnectionId();
|
||||||
#endif
|
#endif
|
||||||
|
if (depth > 0 && has_stacktrace()) {
|
||||||
GetProfiler().SendCallstack( depth );
|
GetProfiler().SendCallstack( depth );
|
||||||
|
|
||||||
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLocCallstack );
|
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLocCallstack );
|
||||||
@ -96,6 +68,13 @@ public:
|
|||||||
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 );
|
||||||
|
} else {
|
||||||
|
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLoc );
|
||||||
|
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz, color );
|
||||||
|
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||||
|
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||||
|
TracyQueueCommit( zoneBeginThread );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int depth, bool is_active = true ) : ScopedZone( line, source, sourceSz, function, functionSz, name, nameSz, 0, depth, is_active ) {}
|
tracy_force_inline ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int depth, bool is_active = true ) : ScopedZone( line, source, sourceSz, function, functionSz, name, nameSz, 0, depth, is_active ) {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user