| 2715 | } |
| 2716 | |
| 2717 | Profiler::DequeueStatus Profiler::DequeueSerial() |
| 2718 | { |
| 2719 | { |
| 2720 | bool lockHeld = true; |
| 2721 | while( !m_serialLock.try_lock() ) |
| 2722 | { |
| 2723 | if( m_shutdownManual.load( std::memory_order_relaxed ) ) |
| 2724 | { |
| 2725 | lockHeld = false; |
| 2726 | break; |
| 2727 | } |
| 2728 | } |
| 2729 | if( !m_serialQueue.empty() ) m_serialQueue.swap( m_serialDequeue ); |
| 2730 | if( lockHeld ) |
| 2731 | { |
| 2732 | m_serialLock.unlock(); |
| 2733 | } |
| 2734 | } |
| 2735 | |
| 2736 | const auto sz = m_serialDequeue.size(); |
| 2737 | if( sz > 0 ) |
| 2738 | { |
| 2739 | InitRpmalloc(); |
| 2740 | int64_t refSerial = m_refTimeSerial; |
| 2741 | int64_t refGpu = m_refTimeGpu; |
| 2742 | #ifdef TRACY_FIBERS |
| 2743 | int64_t refThread = m_refTimeThread; |
| 2744 | #endif |
| 2745 | auto item = m_serialDequeue.data(); |
| 2746 | auto end = item + sz; |
| 2747 | while( item != end ) |
| 2748 | { |
| 2749 | uint64_t ptr; |
| 2750 | auto idx = MemRead<uint8_t>( &item->hdr.idx ); |
| 2751 | if( idx < (int)QueueType::Terminate ) |
| 2752 | { |
| 2753 | switch( (QueueType)idx ) |
| 2754 | { |
| 2755 | case QueueType::CallstackSerial: |
| 2756 | ptr = MemRead<uint64_t>( &item->callstackFat.ptr ); |
| 2757 | SendCallstackPayload( ptr ); |
| 2758 | tracy_free_fast( (void*)ptr ); |
| 2759 | break; |
| 2760 | case QueueType::LockWait: |
| 2761 | case QueueType::LockSharedWait: |
| 2762 | { |
| 2763 | int64_t t = MemRead<int64_t>( &item->lockWait.time ); |
| 2764 | int64_t dt = t - refSerial; |
| 2765 | refSerial = t; |
| 2766 | MemWrite( &item->lockWait.time, dt ); |
| 2767 | break; |
| 2768 | } |
| 2769 | case QueueType::LockObtain: |
| 2770 | case QueueType::LockSharedObtain: |
| 2771 | { |
| 2772 | int64_t t = MemRead<int64_t>( &item->lockObtain.time ); |
| 2773 | int64_t dt = t - refSerial; |
| 2774 | refSerial = t; |
nothing calls this directly
no test coverage detected