From 87e7cba289ee85d02be7ab2b2ce76c49c6590ccb Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 7 Aug 2020 14:53:39 +0200 Subject: [PATCH] Disable samples limit range until background job is done. --- server/TracyView.cpp | 37 ++++++++++++++++++++++++++++--------- server/TracyWorker.cpp | 1 + server/TracyWorker.hpp | 2 ++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 76984a35..009ff0db 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -11869,20 +11869,39 @@ void View::DrawStatistics() ImGui::SameLine(); ImGui::Spacing(); ImGui::SameLine(); - if( ImGui::Checkbox( "Limit range", &m_statRange.active ) ) + if( m_statMode == 1 && !m_worker.AreSymbolSamplesReady() ) { - if( m_statRange.active && m_statRange.min == 0 && m_statRange.max == 0 ) + m_statRange.active = false; + bool val = false; + ImGui::PushItemFlag( ImGuiItemFlags_Disabled, true ); + ImGui::PushStyleVar( ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f ); + ImGui::Checkbox( "Limit range", &val ); + ImGui::PopItemFlag(); + ImGui::PopStyleVar(); + if( ImGui::IsItemHovered() ) { - m_statRange.min = m_vd.zvStart; - m_statRange.max = m_vd.zvEnd; + ImGui::BeginTooltip(); + ImGui::TextUnformatted( "Waiting for background tasks to finish" ); + ImGui::EndTooltip(); } } - if( m_statRange.active ) + else { - ImGui::SameLine(); - TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE ); - ImGui::SameLine(); - ToggleButton( ICON_FA_RULER " Limits", m_showRanges ); + if( ImGui::Checkbox( "Limit range", &m_statRange.active ) ) + { + if( m_statRange.active && m_statRange.min == 0 && m_statRange.max == 0 ) + { + m_statRange.min = m_vd.zvStart; + m_statRange.max = m_vd.zvEnd; + } + } + if( m_statRange.active ) + { + ImGui::SameLine(); + TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE ); + ImGui::SameLine(); + ToggleButton( ICON_FA_RULER " Limits", m_showRanges ); + } } ImGui::Separator(); diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 98af7966..18e68fdd 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -264,6 +264,7 @@ Worker::Worker( const char* addr, int port ) m_data.callstackSamplesReady = true; m_data.ghostZonesReady = true; m_data.ctxUsageReady = true; + m_data.symbolSamplesReady = true; #endif m_thread = std::thread( [this] { SetThreadName( "Tracy Worker" ); Exec(); } ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index c776f8e7..1b60e52e 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -292,6 +292,7 @@ private: bool callstackSamplesReady = false; bool ghostZonesReady = false; bool ghostZonesPostponed = false; + bool symbolSamplesReady = false; #endif unordered_flat_map lockMap; @@ -552,6 +553,7 @@ public: const unordered_flat_map* GetSymbolInstructionPointers( uint64_t symAddr ) const; bool AreCallstackSamplesReady() const { return m_data.callstackSamplesReady; } bool AreGhostZonesReady() const { return m_data.ghostZonesReady; } + bool AreSymbolSamplesReady() const { return m_data.symbolSamplesReady; } #endif tracy_force_inline uint16_t CompressThread( uint64_t thread ) { return m_data.localThreadCompress.CompressThread( thread ); }