mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Serialize discontinuous frame messages.
This commit is contained in:
parent
f15bfb88a3
commit
d863245b49
@ -79,8 +79,8 @@
|
|||||||
#define ZoneText( txt, size ) ___tracy_scoped_zone.Text( txt, size );
|
#define ZoneText( txt, size ) ___tracy_scoped_zone.Text( txt, size );
|
||||||
#define ZoneName( txt, size ) ___tracy_scoped_zone.Name( txt, size );
|
#define ZoneName( txt, size ) ___tracy_scoped_zone.Name( txt, size );
|
||||||
|
|
||||||
#define FrameMark tracy::Profiler::SendFrameMark();
|
#define FrameMark tracy::Profiler::SendFrameMark( nullptr );
|
||||||
#define FrameMarkNamed( name ) tracy::Profiler::SendFrameMark( name, tracy::QueueType::FrameMarkMsg );
|
#define FrameMarkNamed( name ) tracy::Profiler::SendFrameMark( name );
|
||||||
#define FrameMarkStart( name ) tracy::Profiler::SendFrameMark( name, tracy::QueueType::FrameMarkMsgStart );
|
#define FrameMarkStart( name ) tracy::Profiler::SendFrameMark( name, tracy::QueueType::FrameMarkMsgStart );
|
||||||
#define FrameMarkEnd( name ) tracy::Profiler::SendFrameMark( name, tracy::QueueType::FrameMarkMsgEnd );
|
#define FrameMarkEnd( name ) tracy::Profiler::SendFrameMark( name, tracy::QueueType::FrameMarkMsgEnd );
|
||||||
|
|
||||||
|
@ -141,10 +141,9 @@ public:
|
|||||||
return m_zoneId.fetch_add( 1, std::memory_order_relaxed );
|
return m_zoneId.fetch_add( 1, std::memory_order_relaxed );
|
||||||
}
|
}
|
||||||
|
|
||||||
static tracy_force_inline void SendFrameMark()
|
static tracy_force_inline void SendFrameMark( const char* name )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().m_frameCount.fetch_add( 1, std::memory_order_relaxed );
|
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
Magic magic;
|
||||||
@ -153,24 +152,23 @@ public:
|
|||||||
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 );
|
||||||
MemWrite( &item->frameMark.time, GetTime() );
|
MemWrite( &item->frameMark.time, GetTime() );
|
||||||
MemWrite( &item->frameMark.name, uint64_t( 0 ) );
|
MemWrite( &item->frameMark.name, uint64_t( name ) );
|
||||||
tail.store( magic + 1, std::memory_order_release );
|
tail.store( magic + 1, std::memory_order_release );
|
||||||
}
|
}
|
||||||
|
|
||||||
static tracy_force_inline void SendFrameMark( const char* name, QueueType type )
|
static tracy_force_inline void SendFrameMark( const char* name, QueueType type )
|
||||||
{
|
{
|
||||||
assert( type == QueueType::FrameMarkMsg || type == QueueType::FrameMarkMsgStart || type == QueueType::FrameMarkMsgEnd );
|
assert( type == QueueType::FrameMarkMsgStart || type == QueueType::FrameMarkMsgEnd );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
Magic magic;
|
GetProfiler().m_serialLock.lock();
|
||||||
auto token = GetToken();
|
auto item = GetProfiler().m_serialQueue.prepare_next();
|
||||||
auto& tail = token->get_tail_index();
|
|
||||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
|
||||||
MemWrite( &item->hdr.type, type );
|
MemWrite( &item->hdr.type, type );
|
||||||
MemWrite( &item->frameMark.time, GetTime() );
|
MemWrite( &item->frameMark.time, GetTime() );
|
||||||
MemWrite( &item->frameMark.name, uint64_t( name ) );
|
MemWrite( &item->frameMark.name, uint64_t( name ) );
|
||||||
tail.store( magic + 1, std::memory_order_release );
|
GetProfiler().m_serialQueue.commit_next();
|
||||||
|
GetProfiler().m_serialLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static tracy_force_inline void PlotData( const char* name, int64_t val )
|
static tracy_force_inline void PlotData( const char* name, int64_t val )
|
||||||
|
Loading…
Reference in New Issue
Block a user