mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Track max CPU present in context switch data.
This commit is contained in:
parent
bdb8516d04
commit
eccb0b1e4a
@ -1648,18 +1648,22 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
{
|
||||
int64_t refTime = 0;
|
||||
f.Read( sz );
|
||||
m_data.cpuData[i].cs.reserve_exact( sz, m_slab );
|
||||
auto ptr = m_data.cpuData[i].cs.data();
|
||||
for( uint64_t j=0; j<sz; j++ )
|
||||
if( sz != 0 )
|
||||
{
|
||||
ptr->SetStart( ReadTimeOffset( f, refTime ) );
|
||||
ptr->SetEnd( ReadTimeOffset( f, refTime ) );
|
||||
uint16_t thread;
|
||||
f.Read( thread );
|
||||
ptr->SetThread( thread );
|
||||
ptr++;
|
||||
m_data.cpuDataCount = i+1;
|
||||
m_data.cpuData[i].cs.reserve_exact( sz, m_slab );
|
||||
auto ptr = m_data.cpuData[i].cs.data();
|
||||
for( uint64_t j=0; j<sz; j++ )
|
||||
{
|
||||
ptr->SetStart( ReadTimeOffset( f, refTime ) );
|
||||
ptr->SetEnd( ReadTimeOffset( f, refTime ) );
|
||||
uint16_t thread;
|
||||
f.Read( thread );
|
||||
ptr->SetThread( thread );
|
||||
ptr++;
|
||||
}
|
||||
cnt += sz;
|
||||
}
|
||||
cnt += sz;
|
||||
s_loadProgress.subProgress.store( cnt, std::memory_order_relaxed );
|
||||
}
|
||||
}
|
||||
@ -4361,6 +4365,7 @@ void Worker::ProcessContextSwitch( const QueueContextSwitch& ev )
|
||||
const auto time = TscTime( ev.time - m_data.baseTime );
|
||||
m_data.lastTime = std::max( m_data.lastTime, time );
|
||||
|
||||
if( ev.cpu >= m_data.cpuDataCount ) m_data.cpuDataCount = ev.cpu + 1;
|
||||
auto& cs = m_data.cpuData[ev.cpu].cs;
|
||||
if( ev.oldThread != 0 )
|
||||
{
|
||||
|
@ -214,6 +214,7 @@ private:
|
||||
std::pair<uint64_t, ContextSwitch*> ctxSwitchLast;
|
||||
|
||||
CpuData cpuData[256];
|
||||
int cpuDataCount = 0;
|
||||
flat_hash_map<uint64_t, uint64_t, nohash<uint64_t>> tidToPid;
|
||||
flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>> cpuThreadData;
|
||||
};
|
||||
@ -305,6 +306,7 @@ public:
|
||||
return GetContextSwitchDataImpl( thread );
|
||||
}
|
||||
const CpuData* GetCpuData() const { return m_data.cpuData; }
|
||||
int GetCpuDataCpuCount() const { return m_data.cpuDataCount; }
|
||||
uint64_t GetPidFromTid( uint64_t tid ) const;
|
||||
const flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>>& GetCpuThreadData() const { return m_data.cpuThreadData; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user