mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Thread id compression/decompression.
This commit is contained in:
parent
40c6f01a41
commit
777d672e05
@ -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;
|
||||
|
@ -69,6 +69,9 @@ class Worker
|
||||
#endif
|
||||
|
||||
std::map<uint32_t, LockMap> lockMap;
|
||||
|
||||
flat_hash_map<uint64_t, uint16_t, nohash<uint64_t>> threadMap;
|
||||
Vector<uint64_t> 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<float>& GetMbpsData() const { return m_mbpsData.mbps; }
|
||||
float GetCompRatio() const { return m_mbpsData.compRatio; }
|
||||
|
Loading…
Reference in New Issue
Block a user