1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Don't track last frames in offline mode.

This commit is contained in:
Bartosz Taudul 2018-10-21 16:03:21 +02:00
parent 2165881efc
commit 9342ba0e71
2 changed files with 19 additions and 10 deletions

View File

@ -323,7 +323,7 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb )
: m_worker( f ) : m_worker( f )
, m_staticView( true ) , m_staticView( true )
, m_frameScale( 0 ) , m_frameScale( 0 )
, m_pause( false ) , m_pause( true )
, m_frameStart( 0 ) , m_frameStart( 0 )
, m_zvStart( 0 ) , m_zvStart( 0 )
, m_zvEnd( 0 ) , m_zvEnd( 0 )
@ -363,6 +363,7 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb )
s_instance = this; s_instance = this;
InitTextEditor(); InitTextEditor();
SetViewToLastFrames();
} }
View::~View() View::~View()
@ -893,15 +894,7 @@ void View::DrawFrames()
if( !m_pause ) if( !m_pause )
{ {
m_frameStart = ( total < onScreen * group ) ? 0 : total - onScreen * group; m_frameStart = ( total < onScreen * group ) ? 0 : total - onScreen * group;
m_zvStart = m_worker.GetFrameBegin( *m_frames, std::max( 0, total - 4 ) ); SetViewToLastFrames();
if( total == 1 )
{
m_zvEnd = m_worker.GetLastTime();
}
else
{
m_zvEnd = m_worker.GetFrameBegin( *m_frames, total - 1 );
}
} }
if( hover ) if( hover )
@ -8372,4 +8365,19 @@ void View::SmallCallstackButton( const char* name, uint32_t callstack, int& idx
} }
} }
void View::SetViewToLastFrames()
{
const int total = m_worker.GetFrameCount( *m_frames );
m_zvStart = m_worker.GetFrameBegin( *m_frames, std::max( 0, total - 4 ) );
if( total == 1 )
{
m_zvEnd = m_worker.GetLastTime();
}
else
{
m_zvEnd = m_worker.GetFrameBegin( *m_frames, total - 1 );
}
}
} }

View File

@ -150,6 +150,7 @@ private:
const char* GetPlotName( const PlotData* plot ) const; const char* GetPlotName( const PlotData* plot ) const;
void SmallCallstackButton( const char* name, uint32_t callstack, int& idx ); void SmallCallstackButton( const char* name, uint32_t callstack, int& idx );
void SetViewToLastFrames();
flat_hash_map<const void*, bool, nohash<const void*>> m_visible; flat_hash_map<const void*, bool, nohash<const void*>> m_visible;
flat_hash_map<uint64_t, bool, nohash<uint64_t>> m_visibleMsgThread; flat_hash_map<uint64_t, bool, nohash<uint64_t>> m_visibleMsgThread;