1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-01 21:23:52 +00:00

Don't perform background tasks during trace upgrade.

This commit is contained in:
Bartosz Taudul 2019-09-29 20:52:25 +02:00
parent 947eb56f3d
commit 2470936050
3 changed files with 44 additions and 37 deletions

View File

@ -264,7 +264,7 @@ Worker::Worker( const char* addr, int port )
m_thread = std::thread( [this] { SetThreadName( "Tracy Worker" ); Exec(); } ); m_thread = std::thread( [this] { SetThreadName( "Tracy Worker" ); Exec(); } );
} }
Worker::Worker( FileRead& f, EventType::Type eventMask ) Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
: m_hasData( true ) : m_hasData( true )
, m_stream( nullptr ) , m_stream( nullptr )
, m_buffer( nullptr ) , m_buffer( nullptr )
@ -1634,6 +1634,12 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
s_loadProgress.total.store( 0, std::memory_order_relaxed ); s_loadProgress.total.store( 0, std::memory_order_relaxed );
m_loadTime = std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now() - loadStart ).count(); m_loadTime = std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now() - loadStart ).count();
if( !bgTasks )
{
m_backgroundDone.store( true, std::memory_order_relaxed );
}
else
{
m_backgroundDone.store( false, std::memory_order_relaxed ); m_backgroundDone.store( false, std::memory_order_relaxed );
#ifndef TRACY_NO_STATISTICS #ifndef TRACY_NO_STATISTICS
m_threadBackground = std::thread( [this, reconstructMemAllocPlot] { m_threadBackground = std::thread( [this, reconstructMemAllocPlot] {
@ -1680,6 +1686,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
m_threadBackground = std::thread( [this] { ReconstructMemAllocPlot(); m_backgroundDone.store( true, std::memory_order_relaxed ); } ); m_threadBackground = std::thread( [this] { ReconstructMemAllocPlot(); m_backgroundDone.store( true, std::memory_order_relaxed ); } );
} }
#endif #endif
}
} }
Worker::~Worker() Worker::~Worker()

View File

@ -271,7 +271,7 @@ public:
}; };
Worker( const char* addr, int port ); Worker( const char* addr, int port );
Worker( FileRead& f, EventType::Type eventMask = EventType::All ); Worker( FileRead& f, EventType::Type eventMask = EventType::All, bool bgTasks = true );
~Worker(); ~Worker();
const std::string& GetAddr() const { return m_addr; } const std::string& GetAddr() const { return m_addr; }

View File

@ -55,7 +55,7 @@ int main( int argc, char** argv )
{ {
int inVer; int inVer;
{ {
tracy::Worker worker( *f ); tracy::Worker worker( *f, tracy::EventType::All, false );
#ifndef TRACY_NO_STATISTICS #ifndef TRACY_NO_STATISTICS
while( !worker.AreSourceLocationZonesReady() ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) ); while( !worker.AreSourceLocationZonesReady() ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );