| 2775 | } |
| 2776 | |
| 2777 | Profiler::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; |
nothing calls this directly
no test coverage detected