Threads may be mapped to fibers.

This commit is contained in:
Bartosz Taudul 2021-11-02 01:51:54 +01:00
parent 0718330016
commit d522af99b9
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 38 additions and 12 deletions

View File

@ -3558,6 +3558,9 @@ void Worker::InsertMessageData( MessageData* msg )
ThreadData* Worker::NoticeThreadReal( uint64_t thread ) ThreadData* Worker::NoticeThreadReal( uint64_t thread )
{ {
auto fit = m_data.threadToFiberMap.find( thread );
if( fit == m_data.threadToFiberMap.end() )
{
auto it = m_threadMap.find( thread ); auto it = m_threadMap.find( thread );
if( it != m_threadMap.end() ) if( it != m_threadMap.end() )
{ {
@ -3569,10 +3572,22 @@ ThreadData* Worker::NoticeThreadReal( uint64_t thread )
{ {
return NewThread( thread, false ); return NewThread( thread, false );
} }
}
else
{
auto it = m_threadMap.find( fit->second );
assert( it != m_threadMap.end() );
m_data.threadDataLast.first = thread;
m_data.threadDataLast.second = it->second;
return it->second;
}
} }
ThreadData* Worker::RetrieveThreadReal( uint64_t thread ) ThreadData* Worker::RetrieveThreadReal( uint64_t thread )
{ {
auto fit = m_data.threadToFiberMap.find( thread );
if( fit == m_data.threadToFiberMap.end() )
{
auto it = m_threadMap.find( thread ); auto it = m_threadMap.find( thread );
if( it != m_threadMap.end() ) if( it != m_threadMap.end() )
{ {
@ -3584,6 +3599,15 @@ ThreadData* Worker::RetrieveThreadReal( uint64_t thread )
{ {
return nullptr; return nullptr;
} }
}
else
{
auto it = m_threadMap.find( fit->second );
assert( it != m_threadMap.end() );
m_data.threadDataLast.first = thread;
m_data.threadDataLast.second = it->second;
return it->second;
}
} }
#ifndef TRACY_NO_STATISTICS #ifndef TRACY_NO_STATISTICS

View File

@ -363,6 +363,8 @@ private:
unordered_flat_map<const char*, MemoryBlock, charutil::Hasher, charutil::Comparator> sourceFileCache; unordered_flat_map<const char*, MemoryBlock, charutil::Hasher, charutil::Comparator> sourceFileCache;
unordered_flat_map<uint64_t, HwSampleData> hwSamples; unordered_flat_map<uint64_t, HwSampleData> hwSamples;
unordered_flat_map<uint64_t, uint64_t> threadToFiberMap;
}; };
struct MbpsBlock struct MbpsBlock