From a14238c199edd0e4eba54c31645fa1120b35bf7f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 28 Jul 2018 18:56:52 +0200 Subject: [PATCH] Add sub progress display. --- server/TracyWorker.cpp | 1 + server/TracyWorker.hpp | 2 ++ standalone/src/main.cpp | 13 +++++++++++++ 3 files changed, 16 insertions(+) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index ca756ba5..c780cfbb 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -253,6 +253,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) s_loadProgress.total.store( 8, std::memory_order_relaxed ); } + s_loadProgress.subTotal.store( 0, std::memory_order_relaxed ); s_loadProgress.progress.store( 0, std::memory_order_relaxed ); f.Read( m_resolution ); f.Read( m_timerMul ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index d7b7ea65..7cb31110 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -49,6 +49,8 @@ struct LoadProgress { std::atomic total = 0; std::atomic progress = 0; + std::atomic subTotal = 0; + std::atomic subProgress = 0; }; class Worker diff --git a/standalone/src/main.cpp b/standalone/src/main.cpp index 859bcfd6..81511330 100644 --- a/standalone/src/main.cpp +++ b/standalone/src/main.cpp @@ -192,6 +192,19 @@ int main( int argc, char** argv ) } ImGui::Text( "Total progress: %" PRIu64 "/%" PRIu64, currProgress, totalProgress ); ImGui::ProgressBar( float( currProgress ) / totalProgress, ImVec2( 200 * dpiScale, 0 ) ); + + auto subTotal = progress.subTotal.load( std::memory_order_relaxed ); + auto subProgress = progress.subProgress.load( std::memory_order_relaxed ); + if( subTotal == 0 ) + { + ImGui::Text( "Sub progress..." ); + ImGui::ProgressBar( 1.f, ImVec2( 200 * dpiScale, 0 ) ); + } + else + { + ImGui::Text( "Sub progress: %" PRIu64 "/%" PRIu64, subProgress, subTotal ); + ImGui::ProgressBar( float( subProgress ) / subTotal, ImVec2( 200 * dpiScale, 0 ) ); + } ImGui::EndPopup(); }