Track trace loading time.

This commit is contained in:
Bartosz Taudul 2019-01-06 19:09:50 +01:00
parent 5ac26ce084
commit 980c54e349
2 changed files with 7 additions and 0 deletions

View File

@ -218,6 +218,7 @@ Worker::Worker( const char* addr )
, m_pendingSourceLocation( 0 )
, m_pendingCallstackFrames( 0 )
, m_traceVersion( CurrentVersion )
, m_loadTime( 0 )
{
m_data.sourceLocationExpand.push_back( 0 );
m_data.threadExpand.push_back( 0 );
@ -238,6 +239,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
, m_stream( nullptr )
, m_buffer( nullptr )
{
auto loadStart = std::chrono::high_resolution_clock::now();
m_data.threadExpand.push_back( 0 );
m_data.callstackPayload.push_back( nullptr );
@ -868,6 +871,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
if( fileVer == 0 && f.IsEOF() )
{
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();
return;
}
@ -1032,6 +1036,7 @@ finishLoading:
}
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();
}
Worker::~Worker()

View File

@ -267,6 +267,7 @@ public:
uint8_t GetHandshakeStatus() const { return m_handshake.load( std::memory_order_relaxed ); }
static const LoadProgress& GetLoadProgress() { return s_loadProgress; }
int64_t GetLoadTime() const { return m_loadTime; }
private:
void Exec();
@ -420,6 +421,7 @@ private:
std::atomic<uint8_t> m_handshake = 0;
static LoadProgress s_loadProgress;
int64_t m_loadTime;
};
}