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

Thread id compression/decompression.

This commit is contained in:
Bartosz Taudul
2018-03-18 20:45:22 +01:00
parent 40c6f01a41
commit 777d672e05
2 changed files with 28 additions and 0 deletions
+22
View File
@@ -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;