mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Support TRACY_NO_EXIT env variable in addition to define.
This commit is contained in:
parent
c3ba0ef4eb
commit
e285c837a4
@ -194,6 +194,7 @@ Profiler::Profiler()
|
|||||||
, m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() )
|
, m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() )
|
||||||
, m_shutdown( false )
|
, m_shutdown( false )
|
||||||
, m_sock( nullptr )
|
, m_sock( nullptr )
|
||||||
|
, m_noExit( false )
|
||||||
, m_stream( LZ4_createStream() )
|
, m_stream( LZ4_createStream() )
|
||||||
, m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) )
|
, m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) )
|
||||||
, m_bufferOffset( 0 )
|
, m_bufferOffset( 0 )
|
||||||
@ -220,6 +221,14 @@ Profiler::Profiler()
|
|||||||
CalibrateTimer();
|
CalibrateTimer();
|
||||||
CalibrateDelay();
|
CalibrateDelay();
|
||||||
|
|
||||||
|
#ifndef TRACY_NO_EXIT
|
||||||
|
const char* noExitEnv = getenv( "TRACY_NO_EXIT" );
|
||||||
|
if( noExitEnv && noExitEnv[0] == '1' )
|
||||||
|
{
|
||||||
|
m_noExit = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
s_thread = (Thread*)tracy_malloc( sizeof( Thread ) );
|
s_thread = (Thread*)tracy_malloc( sizeof( Thread ) );
|
||||||
new(s_thread) Thread( LaunchWorker, this );
|
new(s_thread) Thread( LaunchWorker, this );
|
||||||
SetThreadName( s_thread->Handle(), "Tracy Profiler" );
|
SetThreadName( s_thread->Handle(), "Tracy Profiler" );
|
||||||
@ -293,7 +302,7 @@ void Profiler::Worker()
|
|||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
#ifndef TRACY_NO_EXIT
|
#ifndef TRACY_NO_EXIT
|
||||||
if( ShouldExit() ) return;
|
if( !m_noExit && ShouldExit() ) return;
|
||||||
#endif
|
#endif
|
||||||
m_sock = listen.Accept();
|
m_sock = listen.Accept();
|
||||||
if( m_sock ) break;
|
if( m_sock ) break;
|
||||||
|
@ -401,6 +401,7 @@ private:
|
|||||||
uint64_t m_epoch;
|
uint64_t m_epoch;
|
||||||
std::atomic<bool> m_shutdown;
|
std::atomic<bool> m_shutdown;
|
||||||
Socket* m_sock;
|
Socket* m_sock;
|
||||||
|
bool m_noExit;
|
||||||
|
|
||||||
LZ4_stream_t* m_stream;
|
LZ4_stream_t* m_stream;
|
||||||
char* m_buffer;
|
char* m_buffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user