MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / DequeueSerial

Method DequeueSerial

Source/ThirdParty/tracy/client/TracyProfiler.cpp:2777–3089  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2775 }
2776
2777Profiler::DequeueStatus Profiler::DequeueSerial()
2778{
2779 {
2780 bool lockHeld = true;
2781 while( !m_serialLock.try_lock() )
2782 {
2783 if( m_shutdownManual.load( std::memory_order_relaxed ) )
2784 {
2785 lockHeld = false;
2786 break;
2787 }
2788 }
2789 if( !m_serialQueue.empty() ) m_serialQueue.swap( m_serialDequeue );
2790 if( lockHeld )
2791 {
2792 m_serialLock.unlock();
2793 }
2794 }
2795
2796 const auto sz = m_serialDequeue.size();
2797 if( sz > 0 )
2798 {
2799 InitRpmalloc();
2800 int64_t refSerial = m_refTimeSerial;
2801 int64_t refGpu = m_refTimeGpu;
2802#ifdef TRACY_FIBERS
2803 int64_t refThread = m_refTimeThread;
2804#endif
2805 auto item = m_serialDequeue.data();
2806 auto end = item + sz;
2807 while( item != end )
2808 {
2809 uint64_t ptr;
2810 auto idx = MemRead<uint8_t>( &item->hdr.idx );
2811 if( idx < (int)QueueType::Terminate )
2812 {
2813 switch( (QueueType)idx )
2814 {
2815 case QueueType::CallstackSerial:
2816 ptr = MemRead<uint64_t>( &item->callstackFat.ptr );
2817 SendCallstackPayload( ptr );
2818 tracy_free_fast( (void*)ptr );
2819 break;
2820 case QueueType::LockWait:
2821 case QueueType::LockSharedWait:
2822 {
2823 int64_t t = MemRead<int64_t>( &item->lockWait.time );
2824 int64_t dt = t - refSerial;
2825 refSerial = t;
2826 MemWrite( &item->lockWait.time, dt );
2827 break;
2828 }
2829 case QueueType::LockObtain:
2830 case QueueType::LockSharedObtain:
2831 {
2832 int64_t t = MemRead<int64_t>( &item->lockObtain.time );
2833 int64_t dt = t - refSerial;
2834 refSerial = t;

Callers

nothing calls this directly

Calls 12

tracy_free_fastFunction · 0.85
MemWriteFunction · 0.85
SendSingleStringFunction · 0.85
AppendDataFunction · 0.85
InitRpmallocFunction · 0.70
try_lockMethod · 0.45
loadMethod · 0.45
emptyMethod · 0.45
swapMethod · 0.45
unlockMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected