Don't error on frame end without start (#666)

With on-demand profiling we're very likely to connect in the middle of a
discontinuous frame and thus receive a frame end without any preceding
frame start. So don't error out in this case.
This commit is contained in:
Ivan Molodetskikh 2023-11-19 22:09:58 +04:00 committed by GitHub
parent 906f73cab3
commit ad39a01de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -2756,6 +2756,7 @@ void Worker::Exec()
m_captureTime = welcome.epoch; m_captureTime = welcome.epoch;
m_executableTime = welcome.exectime; m_executableTime = welcome.exectime;
m_ignoreMemFreeFaults = ( welcome.flags & WelcomeFlag::OnDemand ) || ( welcome.flags & WelcomeFlag::IsApple ); m_ignoreMemFreeFaults = ( welcome.flags & WelcomeFlag::OnDemand ) || ( welcome.flags & WelcomeFlag::IsApple );
m_ignoreFrameEndFaults = welcome.flags & WelcomeFlag::OnDemand;
m_data.cpuArch = (CpuArchitecture)welcome.cpuArch; m_data.cpuArch = (CpuArchitecture)welcome.cpuArch;
m_codeTransfer = welcome.flags & WelcomeFlag::CodeTransfer; m_codeTransfer = welcome.flags & WelcomeFlag::CodeTransfer;
m_combineSamples = welcome.flags & WelcomeFlag::CombineSamples; m_combineSamples = welcome.flags & WelcomeFlag::CombineSamples;
@ -5076,12 +5077,12 @@ void Worker::ProcessFrameMarkEnd( const QueueFrameMark& ev )
} ); } );
assert( fd->continuous == 0 ); assert( fd->continuous == 0 );
const auto time = TscTime( ev.time );
if( fd->frames.empty() ) if( fd->frames.empty() )
{ {
FrameEndFailure(); if( !m_ignoreFrameEndFaults ) FrameEndFailure();
return; return;
} }
const auto time = TscTime( ev.time );
assert( fd->frames.back().end == -1 ); assert( fd->frames.back().end == -1 );
fd->frames.back().end = time; fd->frames.back().end = time;
if( m_data.lastTime < time ) m_data.lastTime = time; if( m_data.lastTime < time ) m_data.lastTime = time;

View File

@ -980,6 +980,7 @@ private:
int m_bufferOffset; int m_bufferOffset;
bool m_onDemand; bool m_onDemand;
bool m_ignoreMemFreeFaults; bool m_ignoreMemFreeFaults;
bool m_ignoreFrameEndFaults;
bool m_codeTransfer; bool m_codeTransfer;
bool m_combineSamples; bool m_combineSamples;
bool m_identifySamples = false; bool m_identifySamples = false;