diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 23bc482d..2b585b90 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -323,7 +323,7 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb ) : m_worker( f ) , m_staticView( true ) , m_frameScale( 0 ) - , m_pause( false ) + , m_pause( true ) , m_frameStart( 0 ) , m_zvStart( 0 ) , m_zvEnd( 0 ) @@ -363,6 +363,7 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb ) s_instance = this; InitTextEditor(); + SetViewToLastFrames(); } View::~View() @@ -893,15 +894,7 @@ void View::DrawFrames() if( !m_pause ) { m_frameStart = ( total < onScreen * group ) ? 0 : total - onScreen * group; - 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 ); - } + SetViewToLastFrames(); } 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 ); + } +} + } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index cb06d2e6..dda491b9 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -150,6 +150,7 @@ private: const char* GetPlotName( const PlotData* plot ) const; void SmallCallstackButton( const char* name, uint32_t callstack, int& idx ); + void SetViewToLastFrames(); flat_hash_map> m_visible; flat_hash_map> m_visibleMsgThread;