mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +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;
|
int64_t refTime = 0;
|
||||||
f.Read( sz );
|
f.Read( sz );
|
||||||
m_data.cpuData[i].cs.reserve_exact( sz, m_slab );
|
if( sz != 0 )
|
||||||
auto ptr = m_data.cpuData[i].cs.data();
|
|
||||||
for( uint64_t j=0; j<sz; j++ )
|
|
||||||
{
|
{
|
||||||
ptr->SetStart( ReadTimeOffset( f, refTime ) );
|
m_data.cpuDataCount = i+1;
|
||||||
ptr->SetEnd( ReadTimeOffset( f, refTime ) );
|
m_data.cpuData[i].cs.reserve_exact( sz, m_slab );
|
||||||
uint16_t thread;
|
auto ptr = m_data.cpuData[i].cs.data();
|
||||||
f.Read( thread );
|
for( uint64_t j=0; j<sz; j++ )
|
||||||
ptr->SetThread( thread );
|
{
|
||||||
ptr++;
|
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 );
|
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 );
|
const auto time = TscTime( ev.time - m_data.baseTime );
|
||||||
m_data.lastTime = std::max( m_data.lastTime, time );
|
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;
|
auto& cs = m_data.cpuData[ev.cpu].cs;
|
||||||
if( ev.oldThread != 0 )
|
if( ev.oldThread != 0 )
|
||||||
{
|
{
|
||||||
|
@ -214,6 +214,7 @@ private:
|
|||||||
std::pair<uint64_t, ContextSwitch*> ctxSwitchLast;
|
std::pair<uint64_t, ContextSwitch*> ctxSwitchLast;
|
||||||
|
|
||||||
CpuData cpuData[256];
|
CpuData cpuData[256];
|
||||||
|
int cpuDataCount = 0;
|
||||||
flat_hash_map<uint64_t, uint64_t, nohash<uint64_t>> tidToPid;
|
flat_hash_map<uint64_t, uint64_t, nohash<uint64_t>> tidToPid;
|
||||||
flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>> cpuThreadData;
|
flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>> cpuThreadData;
|
||||||
};
|
};
|
||||||
@ -305,6 +306,7 @@ public:
|
|||||||
return GetContextSwitchDataImpl( thread );
|
return GetContextSwitchDataImpl( thread );
|
||||||
}
|
}
|
||||||
const CpuData* GetCpuData() const { return m_data.cpuData; }
|
const CpuData* GetCpuData() const { return m_data.cpuData; }
|
||||||
|
int GetCpuDataCpuCount() const { return m_data.cpuDataCount; }
|
||||||
uint64_t GetPidFromTid( uint64_t tid ) const;
|
uint64_t GetPidFromTid( uint64_t tid ) const;
|
||||||
const flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>>& GetCpuThreadData() const { return m_data.cpuThreadData; }
|
const flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>>& GetCpuThreadData() const { return m_data.cpuThreadData; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user