diff options
author | Bartosz Taudul <wolf.pld@gmail.com> | 2019-08-16 17:28:58 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf.pld@gmail.com> | 2019-08-16 17:51:18 +0300 |
commit | 69527d2f71d0b4f991287a91e0ee3aaa87c70b55 (patch) | |
tree | 381524b8960e9aea2a156f4c62679e892c4f30e2 /server/TracyWorker.cpp | |
parent | 9e0fe226df4480779058ed3a692da00680efde28 (diff) |
Collect per-cpu context switch data.
Diffstat (limited to 'server/TracyWorker.cpp')
-rw-r--r-- | server/TracyWorker.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 8766002d..2bae4c07 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -3963,6 +3963,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 ); + auto& cs = m_data.cpuData[ev.cpu].cs; if( ev.oldThread != 0 ) { auto it = m_data.ctxSwitch.find( ev.oldThread ); @@ -3978,6 +3979,12 @@ void Worker::ProcessContextSwitch( const QueueContextSwitch& ev ) it->second->runningTime += time - item.Start(); } + if( !cs.empty() ) + { + auto& cx = cs.back(); + assert( cx.Thread() == ev.oldThread ); + cx.SetEnd( time ); + } } if( ev.newThread != 0 ) { @@ -3995,6 +4002,10 @@ void Worker::ProcessContextSwitch( const QueueContextSwitch& ev ) item.SetCpu( ev.cpu ); item.SetReason( -1 ); item.SetState( -1 ); + + auto& cx = cs.push_next(); + cx.SetStart( time ); + cx.SetThread( ev.newThread ); } } |