Skip to content

Commit

Permalink
Don't error on frame end without start (#666)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
YaLTeR committed Nov 19, 2023
1 parent 906f73c commit ad39a01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/TracyWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,7 @@ void Worker::Exec()
m_captureTime = welcome.epoch;
m_executableTime = welcome.exectime;
m_ignoreMemFreeFaults = ( welcome.flags & WelcomeFlag::OnDemand ) || ( welcome.flags & WelcomeFlag::IsApple );
m_ignoreFrameEndFaults = welcome.flags & WelcomeFlag::OnDemand;
m_data.cpuArch = (CpuArchitecture)welcome.cpuArch;
m_codeTransfer = welcome.flags & WelcomeFlag::CodeTransfer;
m_combineSamples = welcome.flags & WelcomeFlag::CombineSamples;
Expand Down Expand Up @@ -5076,12 +5077,12 @@ void Worker::ProcessFrameMarkEnd( const QueueFrameMark& ev )
} );

assert( fd->continuous == 0 );
const auto time = TscTime( ev.time );
if( fd->frames.empty() )
{
FrameEndFailure();
if( !m_ignoreFrameEndFaults ) FrameEndFailure();
return;
}
const auto time = TscTime( ev.time );
assert( fd->frames.back().end == -1 );
fd->frames.back().end = time;
if( m_data.lastTime < time ) m_data.lastTime = time;
Expand Down
1 change: 1 addition & 0 deletions server/TracyWorker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ class Worker
int m_bufferOffset;
bool m_onDemand;
bool m_ignoreMemFreeFaults;
bool m_ignoreFrameEndFaults;
bool m_codeTransfer;
bool m_combineSamples;
bool m_identifySamples = false;
Expand Down

0 comments on commit ad39a01

Please sign in to comment.