mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-13 03:41:48 +00:00
Completely serialize lock events.
This commit is contained in:
parent
b7af9a0860
commit
3e3aa80fa7
@ -23,7 +23,8 @@ public:
|
|||||||
{
|
{
|
||||||
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::LockAnnounce );
|
auto item = Profiler::QueueSerial();
|
||||||
|
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
||||||
MemWrite( &item->lockAnnounce.id, m_id );
|
MemWrite( &item->lockAnnounce.id, m_id );
|
||||||
MemWrite( &item->lockAnnounce.time, Profiler::GetTime() );
|
MemWrite( &item->lockAnnounce.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->lockAnnounce.lckloc, (uint64_t)srcloc );
|
MemWrite( &item->lockAnnounce.lckloc, (uint64_t)srcloc );
|
||||||
@ -31,7 +32,7 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
TracyLfqCommit;
|
Profiler::QueueSerialFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
LockableCtx( const LockableCtx& ) = delete;
|
LockableCtx( const LockableCtx& ) = delete;
|
||||||
@ -39,14 +40,15 @@ public:
|
|||||||
|
|
||||||
tracy_force_inline ~LockableCtx()
|
tracy_force_inline ~LockableCtx()
|
||||||
{
|
{
|
||||||
TracyLfqPrepare( QueueType::LockTerminate );
|
auto item = Profiler::QueueSerial();
|
||||||
|
MemWrite( &item->hdr.type, QueueType::LockTerminate );
|
||||||
MemWrite( &item->lockTerminate.id, m_id );
|
MemWrite( &item->lockTerminate.id, m_id );
|
||||||
MemWrite( &item->lockTerminate.time, Profiler::GetTime() );
|
MemWrite( &item->lockTerminate.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->lockTerminate.type, LockType::Lockable );
|
MemWrite( &item->lockTerminate.type, LockType::Lockable );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
TracyLfqCommit;
|
Profiler::QueueSerialFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline bool BeforeLock()
|
tracy_force_inline bool BeforeLock()
|
||||||
@ -158,14 +160,15 @@ public:
|
|||||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
auto ptr = (char*)tracy_malloc( size );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, name, size );
|
memcpy( ptr, name, size );
|
||||||
TracyLfqPrepare( QueueType::LockName );
|
auto item = Profiler::QueueSerial();
|
||||||
|
MemWrite( &item->hdr.type, QueueType::LockName );
|
||||||
MemWrite( &item->lockNameFat.id, m_id );
|
MemWrite( &item->lockNameFat.id, m_id );
|
||||||
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
|
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
|
||||||
MemWrite( &item->lockNameFat.size, (uint16_t)size );
|
MemWrite( &item->lockNameFat.size, (uint16_t)size );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
TracyLfqCommit;
|
Profiler::QueueSerialFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -237,17 +240,16 @@ public:
|
|||||||
{
|
{
|
||||||
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::LockAnnounce );
|
auto item = Profiler::QueueSerial();
|
||||||
|
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
||||||
MemWrite( &item->lockAnnounce.id, m_id );
|
MemWrite( &item->lockAnnounce.id, m_id );
|
||||||
MemWrite( &item->lockAnnounce.time, Profiler::GetTime() );
|
MemWrite( &item->lockAnnounce.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->lockAnnounce.lckloc, (uint64_t)srcloc );
|
MemWrite( &item->lockAnnounce.lckloc, (uint64_t)srcloc );
|
||||||
MemWrite( &item->lockAnnounce.type, LockType::SharedLockable );
|
MemWrite( &item->lockAnnounce.type, LockType::SharedLockable );
|
||||||
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
|
Profiler::QueueSerialFinish();
|
||||||
TracyLfqCommit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedLockableCtx( const SharedLockableCtx& ) = delete;
|
SharedLockableCtx( const SharedLockableCtx& ) = delete;
|
||||||
@ -255,16 +257,15 @@ public:
|
|||||||
|
|
||||||
tracy_force_inline ~SharedLockableCtx()
|
tracy_force_inline ~SharedLockableCtx()
|
||||||
{
|
{
|
||||||
TracyLfqPrepare( QueueType::LockTerminate );
|
auto item = Profiler::QueueSerial();
|
||||||
|
MemWrite( &item->hdr.type, QueueType::LockTerminate );
|
||||||
MemWrite( &item->lockTerminate.id, m_id );
|
MemWrite( &item->lockTerminate.id, m_id );
|
||||||
MemWrite( &item->lockTerminate.time, Profiler::GetTime() );
|
MemWrite( &item->lockTerminate.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->lockTerminate.type, LockType::SharedLockable );
|
MemWrite( &item->lockTerminate.type, LockType::SharedLockable );
|
||||||
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
|
Profiler::QueueSerialFinish();
|
||||||
TracyLfqCommit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tracy_force_inline bool BeforeLock()
|
tracy_force_inline bool BeforeLock()
|
||||||
@ -459,14 +460,15 @@ public:
|
|||||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
auto ptr = (char*)tracy_malloc( size );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, name, size );
|
memcpy( ptr, name, size );
|
||||||
TracyLfqPrepare( QueueType::LockName );
|
auto item = Profiler::QueueSerial();
|
||||||
|
MemWrite( &item->hdr.type, QueueType::LockName );
|
||||||
MemWrite( &item->lockNameFat.id, m_id );
|
MemWrite( &item->lockNameFat.id, m_id );
|
||||||
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
|
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
|
||||||
MemWrite( &item->lockNameFat.size, (uint16_t)size );
|
MemWrite( &item->lockNameFat.size, (uint16_t)size );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
TracyLfqCommit;
|
Profiler::QueueSerialFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1940,14 +1940,6 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
|||||||
MemWrite( &item->zoneEnd.time, dt );
|
MemWrite( &item->zoneEnd.time, dt );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QueueType::LockName:
|
|
||||||
ptr = MemRead<uint64_t>( &item->lockNameFat.name );
|
|
||||||
size = MemRead<uint16_t>( &item->lockNameFat.size );
|
|
||||||
SendSingleString( (const char*)ptr, size );
|
|
||||||
#ifndef TRACY_ON_DEMAND
|
|
||||||
tracy_free( (void*)ptr );
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case QueueType::GpuZoneBegin:
|
case QueueType::GpuZoneBegin:
|
||||||
case QueueType::GpuZoneBeginCallstack:
|
case QueueType::GpuZoneBeginCallstack:
|
||||||
{
|
{
|
||||||
@ -2148,6 +2140,16 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
|
|||||||
MemWrite( &item->lockRelease.time, dt );
|
MemWrite( &item->lockRelease.time, dt );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QueueType::LockName:
|
||||||
|
{
|
||||||
|
ptr = MemRead<uint64_t>( &item->lockNameFat.name );
|
||||||
|
uint16_t size = MemRead<uint16_t>( &item->lockNameFat.size );
|
||||||
|
SendSingleString( (const char*)ptr, size );
|
||||||
|
#ifndef TRACY_ON_DEMAND
|
||||||
|
tracy_free( (void*)ptr );
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
case QueueType::MemAlloc:
|
case QueueType::MemAlloc:
|
||||||
case QueueType::MemAllocCallstack:
|
case QueueType::MemAllocCallstack:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user