1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Context switch usage reconstruction skeleton.

This commit is contained in:
Bartosz Taudul
2019-11-05 00:40:41 +01:00
parent a62c4135ad
commit 50b96c757e
2 changed files with 21 additions and 0 deletions
+11
View File
@@ -259,6 +259,7 @@ Worker::Worker( const char* addr, int port )
#ifndef TRACY_NO_STATISTICS
m_data.sourceLocationZonesReady = true;
m_data.ctxUsageReady = true;
#endif
m_thread = std::thread( [this] { SetThreadName( "Tracy Worker" ); Exec(); } );
@@ -1787,6 +1788,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.sourceLocationZonesReady = true;
}
if( m_shutdown.load( std::memory_order_relaxed ) ) return;
if( !m_data.ctxSwitch.empty() ) ReconstructContextSwitchUsage();
if( m_shutdown.load( std::memory_order_relaxed ) ) return;
if( reconstructMemAllocPlot ) ReconstructMemAllocPlot();
m_backgroundDone.store( true, std::memory_order_relaxed );
} );
@@ -4862,6 +4865,14 @@ void Worker::ReconstructMemAllocPlot()
m_data.memory.plot = plot;
}
#ifndef TRACY_NO_STATISTICS
void Worker::ReconstructContextSwitchUsage()
{
std::lock_guard<std::shared_mutex> lock( m_data.lock );
m_data.ctxUsageReady = true;
}
#endif
void Worker::ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int32_t& childIdx )
{
uint64_t sz;