mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-14 04:01:48 +00:00
Add serial queue interface.
This commit is contained in:
parent
760357d6ea
commit
0431c03556
@ -152,6 +152,20 @@ 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 QueueItem* QueueSerial()
|
||||||
|
{
|
||||||
|
auto& p = GetProfiler();
|
||||||
|
p.m_serialLock.lock();
|
||||||
|
return p.m_serialQueue.prepare_next();
|
||||||
|
}
|
||||||
|
|
||||||
|
static tracy_force_inline void QueueSerialFinish()
|
||||||
|
{
|
||||||
|
auto& p = GetProfiler();
|
||||||
|
p.m_serialQueue.commit_next();
|
||||||
|
p.m_serialLock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
static tracy_force_inline void SendFrameMark( const char* name )
|
static tracy_force_inline void SendFrameMark( const char* name )
|
||||||
{
|
{
|
||||||
if( !name ) GetProfiler().m_frameCount.fetch_add( 1, std::memory_order_relaxed );
|
if( !name ) GetProfiler().m_frameCount.fetch_add( 1, std::memory_order_relaxed );
|
||||||
@ -174,13 +188,11 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
GetProfiler().m_serialLock.lock();
|
auto item = QueueSerial();
|
||||||
auto item = GetProfiler().m_serialQueue.prepare_next();
|
|
||||||
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 ) );
|
||||||
GetProfiler().m_serialQueue.commit_next();
|
QueueSerialFinish();
|
||||||
GetProfiler().m_serialLock.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static tracy_force_inline void SendFrameImage( const void* image, uint16_t w, uint16_t h, uint8_t offset, bool flip )
|
static tracy_force_inline void SendFrameImage( const void* image, uint16_t w, uint16_t h, uint8_t offset, bool flip )
|
||||||
|
Loading…
Reference in New Issue
Block a user