Proper way to get full frame count.

This commit is contained in:
Bartosz Taudul 2018-09-01 12:38:12 +02:00
parent faea036c16
commit 9f4d6692dc
3 changed files with 32 additions and 1 deletions

View File

@ -6354,7 +6354,7 @@ void View::DrawInfo()
TextFocused( "Call stacks:", RealToString( m_worker.GetCallstackPayloadCount(), true ) ); TextFocused( "Call stacks:", RealToString( m_worker.GetCallstackPayloadCount(), true ) );
TextFocused( "Call stack frames:", RealToString( m_worker.GetCallstackFrameCount(), true ) ); TextFocused( "Call stack frames:", RealToString( m_worker.GetCallstackFrameCount(), true ) );
const auto fsz = m_worker.GetFrameCount( *m_frames ) - 1; const auto fsz = m_worker.GetFullFrameCount( *m_frames );
if( fsz != 0 ) if( fsz != 0 )
{ {
if( m_frameSortData.frameSet != m_frames || m_frameSortData.frameNum != fsz ) if( m_frameSortData.frameSet != m_frames || m_frameSortData.frameNum != fsz )

View File

@ -953,6 +953,36 @@ uint64_t Worker::GetPlotCount() const
return cnt; return cnt;
} }
size_t Worker::GetFullFrameCount( const FrameData& fd ) const
{
const auto sz = fd.frames.size();
assert( sz != 0 );
if( fd.continuous )
{
if( IsConnected() )
{
return sz - 1;
}
else
{
return sz;
}
}
else
{
const auto& last = fd.frames.back();
if( last.end >= 0 )
{
return sz;
}
else
{
return sz - 1;
}
}
}
int64_t Worker::GetFrameTime( const FrameData& fd, size_t idx ) const int64_t Worker::GetFrameTime( const FrameData& fd, size_t idx ) const
{ {
if( fd.continuous ) if( fd.continuous )

View File

@ -185,6 +185,7 @@ public:
TracyMutex& GetDataLock() { return m_data.lock; } TracyMutex& GetDataLock() { return m_data.lock; }
size_t GetFrameCount( const FrameData& fd ) const { return fd.frames.size(); } size_t GetFrameCount( const FrameData& fd ) const { return fd.frames.size(); }
size_t GetFullFrameCount( const FrameData& fd ) const;
int64_t GetTimeBegin() const { return GetFrameBegin( *m_data.framesBase, 0 ); } int64_t GetTimeBegin() const { return GetFrameBegin( *m_data.framesBase, 0 ); }
int64_t GetLastTime() const { return m_data.lastTime; } int64_t GetLastTime() const { return m_data.lastTime; }
uint64_t GetZoneCount() const { return m_data.zonesCnt; } uint64_t GetZoneCount() const { return m_data.zonesCnt; }