mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Allow sending custom zone names.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#define ZoneScopedC(x)
|
||||
|
||||
#define ZoneText(x,y)
|
||||
#define ZoneName(x)
|
||||
|
||||
#define FrameMark
|
||||
|
||||
@@ -19,6 +20,7 @@
|
||||
#define ZoneScopedC( color ) static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__, color }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
|
||||
|
||||
#define ZoneText( txt, size ) ___tracy_scoped_zone.Text( txt, size );
|
||||
#define ZoneName( name ) ___tracy_scoped_zone.Name( name );
|
||||
|
||||
#define FrameMark tracy::Profiler::FrameMark();
|
||||
|
||||
|
||||
@@ -112,6 +112,15 @@ void Profiler::ZoneText( uint64_t id, QueueZoneText&& data )
|
||||
s_queue.enqueue( s_token, std::move( item ) );
|
||||
}
|
||||
|
||||
void Profiler::ZoneName( uint64_t id, QueueZoneName&& data )
|
||||
{
|
||||
QueueItem item;
|
||||
item.hdr.type = QueueType::ZoneName;
|
||||
item.hdr.id = id;
|
||||
item.zoneName = std::move( data );
|
||||
s_queue.enqueue( s_token, std::move( item ) );
|
||||
}
|
||||
|
||||
void Profiler::FrameMark()
|
||||
{
|
||||
QueueItem item;
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
static uint64_t ZoneBegin( QueueZoneBegin&& data );
|
||||
static void ZoneEnd( uint64_t id, QueueZoneEnd&& data );
|
||||
static void ZoneText( uint64_t id, QueueZoneText&& data );
|
||||
static void ZoneName( uint64_t id, QueueZoneName&& data );
|
||||
static void FrameMark();
|
||||
|
||||
static bool ShouldExit();
|
||||
|
||||
@@ -30,6 +30,11 @@ public:
|
||||
Profiler::ZoneText( m_id, QueueZoneText { (uint64_t)ptr } );
|
||||
}
|
||||
|
||||
void Name( const char* name )
|
||||
{
|
||||
Profiler::ZoneName( m_id, QueueZoneName { (uint64_t)name } );
|
||||
}
|
||||
|
||||
private:
|
||||
uint64_t m_id;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user