diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 13178d0a..e9273711 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -426,6 +426,28 @@ const Worker::SourceLocationZones& Worker::GetZonesForSourceLocation( int32_t sr } #endif +uint16_t Worker::CompressThread( uint64_t thread ) +{ + auto it = m_data.threadMap.find( thread ); + if( it != m_data.threadMap.end() ) + { + return it->second; + } + else + { + auto sz = m_data.threadExpand.size(); + m_data.threadExpand.push_back( thread ); + m_data.threadMap.emplace( thread, sz ); + return sz; + } +} + +uint64_t Worker::DecompressThread( uint16_t thread ) const +{ + assert( thread < m_data.threadExpand.size() ); + return m_data.threadExpand[thread]; +} + void Worker::Exec() { timeval tv; diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index fd640216..7e862682 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -69,6 +69,9 @@ class Worker #endif std::map lockMap; + + flat_hash_map> threadMap; + Vector threadExpand; }; struct MbpsBlock @@ -126,6 +129,9 @@ public: const SourceLocationZones& GetZonesForSourceLocation( int32_t srcloc ) const; #endif + uint16_t CompressThread( uint64_t thread ); + uint64_t DecompressThread( uint16_t thread ) const; + NonRecursiveBenaphore& GetMbpsDataLock() { return m_mbpsData.lock; } const std::vector& GetMbpsData() const { return m_mbpsData.mbps; } float GetCompRatio() const { return m_mbpsData.compRatio; }