mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Build reverse CPU topology map.
This commit is contained in:
parent
712403e9fd
commit
db3e802643
@ -366,6 +366,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
uint32_t thread;
|
uint32_t thread;
|
||||||
f.Read( thread );
|
f.Read( thread );
|
||||||
core.second.emplace_back( thread );
|
core.second.emplace_back( thread );
|
||||||
|
|
||||||
|
m_data.cpuTopologyMap.emplace( thread, CpuThreadTopology { packageId, coreId } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4622,6 +4624,9 @@ void Worker::ProcessCpuTopology( const QueueCpuTopology& ev )
|
|||||||
auto core = package->second.find( ev.core );
|
auto core = package->second.find( ev.core );
|
||||||
if( core == package->second.end() ) core = package->second.emplace( ev.core, std::vector<uint32_t> {} ).first;
|
if( core == package->second.end() ) core = package->second.emplace( ev.core, std::vector<uint32_t> {} ).first;
|
||||||
core->second.emplace_back( ev.thread );
|
core->second.emplace_back( ev.thread );
|
||||||
|
|
||||||
|
assert( m_data.cpuTopologyMap.find( ev.thread ) == m_data.cpuTopologyMap.end() );
|
||||||
|
m_data.cpuTopologyMap.emplace( ev.thread, CpuThreadTopology { ev.package, ev.core } );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::MemAllocChanged( int64_t time )
|
void Worker::MemAllocChanged( int64_t time )
|
||||||
@ -5747,4 +5752,11 @@ void Worker::SetParameter( size_t paramIdx, int32_t val )
|
|||||||
Query( ServerQueryParameter, ( idx << 32 ) | val );
|
Query( ServerQueryParameter, ( idx << 32 ) | val );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Worker::CpuThreadTopology* Worker::GetThreadTopology( uint32_t cpuThread ) const
|
||||||
|
{
|
||||||
|
auto it = m_data.cpuTopologyMap.find( cpuThread );
|
||||||
|
if( it == m_data.cpuTopologyMap.end() ) return nullptr;
|
||||||
|
return &it->second;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,12 @@ public:
|
|||||||
enum { ZoneThreadDataSize = sizeof( ZoneThreadData ) };
|
enum { ZoneThreadDataSize = sizeof( ZoneThreadData ) };
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
struct CpuThreadTopology
|
||||||
|
{
|
||||||
|
uint32_t package;
|
||||||
|
uint32_t core;
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct SourceLocationZones
|
struct SourceLocationZones
|
||||||
{
|
{
|
||||||
@ -230,6 +236,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
flat_hash_map<uint32_t, flat_hash_map<uint32_t, std::vector<uint32_t>>> cpuTopology;
|
flat_hash_map<uint32_t, flat_hash_map<uint32_t, std::vector<uint32_t>>> cpuTopology;
|
||||||
|
flat_hash_map<uint32_t, CpuThreadTopology, nohash<uint32_t>> cpuTopologyMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MbpsBlock
|
struct MbpsBlock
|
||||||
@ -425,6 +432,7 @@ public:
|
|||||||
void SetParameter( size_t paramIdx, int32_t val );
|
void SetParameter( size_t paramIdx, int32_t val );
|
||||||
|
|
||||||
const decltype(DataBlock::cpuTopology)& GetCpuTopology() const { return m_data.cpuTopology; }
|
const decltype(DataBlock::cpuTopology)& GetCpuTopology() const { return m_data.cpuTopology; }
|
||||||
|
const CpuThreadTopology* GetThreadTopology( uint32_t cpuThread ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Network();
|
void Network();
|
||||||
|
Loading…
Reference in New Issue
Block a user