mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
More precise profiler init end time measurement.
This commit is contained in:
parent
0ed789825a
commit
51f5ae4796
@ -102,7 +102,8 @@ static Profiler init_order(104) s_profiler;
|
|||||||
|
|
||||||
|
|
||||||
Profiler::Profiler()
|
Profiler::Profiler()
|
||||||
: m_mainThread( GetThreadHandle() )
|
: m_timeBegin( 0 )
|
||||||
|
, m_mainThread( GetThreadHandle() )
|
||||||
, 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_stream( LZ4_createStream() )
|
, m_stream( LZ4_createStream() )
|
||||||
@ -120,12 +121,13 @@ Profiler::Profiler()
|
|||||||
|
|
||||||
CalibrateTimer();
|
CalibrateTimer();
|
||||||
CalibrateDelay();
|
CalibrateDelay();
|
||||||
uint32_t cpu;
|
|
||||||
m_timeBegin = GetTime( cpu );
|
|
||||||
|
|
||||||
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" );
|
||||||
|
|
||||||
|
uint32_t cpu;
|
||||||
|
m_timeBegin.store( GetTime( cpu ), std::memory_order_relaxed );
|
||||||
}
|
}
|
||||||
|
|
||||||
Profiler::~Profiler()
|
Profiler::~Profiler()
|
||||||
@ -155,6 +157,8 @@ void Profiler::Worker()
|
|||||||
ListenSocket listen;
|
ListenSocket listen;
|
||||||
listen.Listen( "8086", 8 );
|
listen.Listen( "8086", 8 );
|
||||||
|
|
||||||
|
while( m_timeBegin.load( std::memory_order_relaxed ) == 0 ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
|
|||||||
@ -177,7 +177,7 @@ private:
|
|||||||
double m_timerMul;
|
double m_timerMul;
|
||||||
uint64_t m_resolution;
|
uint64_t m_resolution;
|
||||||
uint64_t m_delay;
|
uint64_t m_delay;
|
||||||
int64_t m_timeBegin;
|
std::atomic<int64_t> m_timeBegin;
|
||||||
uint64_t m_mainThread;
|
uint64_t m_mainThread;
|
||||||
uint64_t m_epoch;
|
uint64_t m_epoch;
|
||||||
std::atomic<bool> m_shutdown;
|
std::atomic<bool> m_shutdown;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user