mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Use the possibly-synchronous macros in C++ zones.
This commit is contained in:
parent
6411b35d68
commit
13acec38f7
@ -32,10 +32,10 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
m_connectionId = GetProfiler().ConnectionId();
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::ZoneBegin );
|
TracyQueuePrepare( QueueType::ZoneBegin );
|
||||||
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 );
|
||||||
TracyLfqCommit;
|
TracyQueueCommit( zoneBeginThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active = true )
|
tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active = true )
|
||||||
@ -51,10 +51,10 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
GetProfiler().SendCallstack( depth );
|
GetProfiler().SendCallstack( depth );
|
||||||
|
|
||||||
TracyLfqPrepare( 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 );
|
||||||
TracyLfqCommit;
|
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 )
|
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 )
|
||||||
@ -68,11 +68,11 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
m_connectionId = GetProfiler().ConnectionId();
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLoc );
|
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLoc );
|
||||||
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||||
TracyLfqCommit;
|
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 )
|
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 )
|
||||||
@ -88,11 +88,11 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
GetProfiler().SendCallstack( depth );
|
GetProfiler().SendCallstack( depth );
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLocCallstack );
|
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLocCallstack );
|
||||||
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||||
TracyLfqCommit;
|
TracyQueueCommit( zoneBeginThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline ~ScopedZone()
|
tracy_force_inline ~ScopedZone()
|
||||||
@ -101,9 +101,9 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::ZoneEnd );
|
TracyQueuePrepare( QueueType::ZoneEnd );
|
||||||
MemWrite( &item->zoneEnd.time, Profiler::GetTime() );
|
MemWrite( &item->zoneEnd.time, Profiler::GetTime() );
|
||||||
TracyLfqCommit;
|
TracyQueueCommit( zoneEndThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline void Text( const char* txt, size_t size )
|
tracy_force_inline void Text( const char* txt, size_t size )
|
||||||
@ -115,10 +115,10 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
auto ptr = (char*)tracy_malloc( size );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
TracyLfqPrepare( QueueType::ZoneText );
|
TracyQueuePrepare( QueueType::ZoneText );
|
||||||
MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
|
MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
|
||||||
MemWrite( &item->zoneTextFat.size, (uint16_t)size );
|
MemWrite( &item->zoneTextFat.size, (uint16_t)size );
|
||||||
TracyLfqCommit;
|
TracyQueueCommit( zoneTextFatThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline void Name( const char* txt, size_t size )
|
tracy_force_inline void Name( const char* txt, size_t size )
|
||||||
@ -130,10 +130,10 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
auto ptr = (char*)tracy_malloc( size );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
TracyLfqPrepare( QueueType::ZoneName );
|
TracyQueuePrepare( QueueType::ZoneName );
|
||||||
MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
|
MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
|
||||||
MemWrite( &item->zoneTextFat.size, (uint16_t)size );
|
MemWrite( &item->zoneTextFat.size, (uint16_t)size );
|
||||||
TracyLfqCommit;
|
TracyQueueCommit( zoneTextFatThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline void Color( uint32_t color )
|
tracy_force_inline void Color( uint32_t color )
|
||||||
@ -142,11 +142,11 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::ZoneColor );
|
TracyQueuePrepare( QueueType::ZoneColor );
|
||||||
MemWrite( &item->zoneColor.r, uint8_t( ( color ) & 0xFF ) );
|
MemWrite( &item->zoneColor.r, uint8_t( ( color ) & 0xFF ) );
|
||||||
MemWrite( &item->zoneColor.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
MemWrite( &item->zoneColor.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
||||||
MemWrite( &item->zoneColor.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
MemWrite( &item->zoneColor.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||||
TracyLfqCommit;
|
TracyQueueCommit( zoneColorThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline void Value( uint64_t value )
|
tracy_force_inline void Value( uint64_t value )
|
||||||
@ -155,9 +155,9 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::ZoneValue );
|
TracyQueuePrepare( QueueType::ZoneValue );
|
||||||
MemWrite( &item->zoneValue.value, value );
|
MemWrite( &item->zoneValue.value, value );
|
||||||
TracyLfqCommit;
|
TracyQueueCommit( zoneValueThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline bool IsActive() const { return m_active; }
|
tracy_force_inline bool IsActive() const { return m_active; }
|
||||||
|
@ -128,11 +128,21 @@ struct QueueZoneBegin : public QueueZoneBeginLean
|
|||||||
uint64_t srcloc; // ptr
|
uint64_t srcloc; // ptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueZoneBeginThread : public QueueZoneBegin
|
||||||
|
{
|
||||||
|
uint32_t thread;
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueZoneEnd
|
struct QueueZoneEnd
|
||||||
{
|
{
|
||||||
int64_t time;
|
int64_t time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueZoneEndThread : public QueueZoneEnd
|
||||||
|
{
|
||||||
|
uint32_t thread;
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueZoneValidation
|
struct QueueZoneValidation
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
@ -145,11 +155,21 @@ struct QueueZoneColor
|
|||||||
uint8_t b;
|
uint8_t b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueZoneColorThread : public QueueZoneColor
|
||||||
|
{
|
||||||
|
uint32_t thread;
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueZoneValue
|
struct QueueZoneValue
|
||||||
{
|
{
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueZoneValueThread : public QueueZoneValue
|
||||||
|
{
|
||||||
|
uint32_t thread;
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueStringTransfer
|
struct QueueStringTransfer
|
||||||
{
|
{
|
||||||
uint64_t ptr;
|
uint64_t ptr;
|
||||||
@ -191,6 +211,11 @@ struct QueueZoneTextFat
|
|||||||
uint16_t size;
|
uint16_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueZoneTextFatThread : public QueueZoneTextFat
|
||||||
|
{
|
||||||
|
uint32_t thread;
|
||||||
|
};
|
||||||
|
|
||||||
enum class LockType : uint8_t
|
enum class LockType : uint8_t
|
||||||
{
|
{
|
||||||
Lockable,
|
Lockable,
|
||||||
@ -531,16 +556,21 @@ struct QueueItem
|
|||||||
QueueThreadContext threadCtx;
|
QueueThreadContext threadCtx;
|
||||||
QueueZoneBegin zoneBegin;
|
QueueZoneBegin zoneBegin;
|
||||||
QueueZoneBeginLean zoneBeginLean;
|
QueueZoneBeginLean zoneBeginLean;
|
||||||
|
QueueZoneBeginThread zoneBeginThread;
|
||||||
QueueZoneEnd zoneEnd;
|
QueueZoneEnd zoneEnd;
|
||||||
|
QueueZoneEndThread zoneEndThread;
|
||||||
QueueZoneValidation zoneValidation;
|
QueueZoneValidation zoneValidation;
|
||||||
QueueZoneColor zoneColor;
|
QueueZoneColor zoneColor;
|
||||||
|
QueueZoneColorThread zoneColorThread;
|
||||||
QueueZoneValue zoneValue;
|
QueueZoneValue zoneValue;
|
||||||
|
QueueZoneValueThread zoneValueThread;
|
||||||
QueueStringTransfer stringTransfer;
|
QueueStringTransfer stringTransfer;
|
||||||
QueueFrameMark frameMark;
|
QueueFrameMark frameMark;
|
||||||
QueueFrameImage frameImage;
|
QueueFrameImage frameImage;
|
||||||
QueueFrameImageFat frameImageFat;
|
QueueFrameImageFat frameImageFat;
|
||||||
QueueSourceLocation srcloc;
|
QueueSourceLocation srcloc;
|
||||||
QueueZoneTextFat zoneTextFat;
|
QueueZoneTextFat zoneTextFat;
|
||||||
|
QueueZoneTextFatThread zoneTextFatThread;
|
||||||
QueueLockAnnounce lockAnnounce;
|
QueueLockAnnounce lockAnnounce;
|
||||||
QueueLockTerminate lockTerminate;
|
QueueLockTerminate lockTerminate;
|
||||||
QueueLockWait lockWait;
|
QueueLockWait lockWait;
|
||||||
|
Loading…
Reference in New Issue
Block a user