1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Add connection id for on-demand mode.

Long-lived zones could send their end events without begin events in a
following scenario:

1. On-demand connection is made.
2. Zone begin is emitted, m_active is set to true.
3. Connection is terminated.
4. A new connection is made.
5. Zone end is emitted, because m_active is true.

To this point it was assumed that all zone end events will happen before
a new connection is made, but it's not necessarily true.
This commit is contained in:
Bartosz Taudul
2019-06-09 17:15:47 +02:00
parent 0db9c73d76
commit 80dff1ede1
3 changed files with 24 additions and 1 deletions
+7 -1
View File
@@ -405,11 +405,16 @@ public:
static bool ShouldExit();
#ifdef TRACY_ON_DEMAND
tracy_force_inline bool IsConnected()
tracy_force_inline bool IsConnected() const
{
return m_isConnected.load( std::memory_order_acquire );
}
tracy_force_inline uint64_t ConnectionId() const
{
return m_connectionId.load( std::memory_order_acquire );
}
tracy_force_inline void DeferItem( const QueueItem& item )
{
m_deferredLock.lock();
@@ -529,6 +534,7 @@ private:
#ifdef TRACY_ON_DEMAND
std::atomic<bool> m_isConnected;
std::atomic<uint64_t> m_frameCount;
std::atomic<uint64_t> m_connectionId;
TracyMutex m_deferredLock;
FastVector<QueueItem> m_deferredQueue;