From 9f9cd047615eba5992feeb4cb0fd6b21a3fc37f1 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 24 Mar 2024 17:38:45 +0100 Subject: [PATCH] Add function to determine if the program is busy. --- profiler/src/main.cpp | 7 +++++++ profiler/src/profiler/TracyView.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index e46e526a..a79f4d6a 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -196,6 +196,13 @@ static void SetupScaleCallback( float scale ) RunOnMainThread( []{ SetupDPIScale(); }, true ); } +static int IsBusy() +{ + if( loadThread.joinable() ) return 2; + if( view && !view->IsBackgroundDone() ) return 1; + return 0; +} + static void LoadConfig() { const auto fn = tracy::GetSavePath( "tracy.ini" ); diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index ac099ff4..589dc864 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -152,6 +152,8 @@ public: bool DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset ); bool DrawCpuData( const TimelineContext& ctx, const std::vector& cpuDraw, const std::vector>& ctxDraw, int& offset, bool hasCpuData ); + bool IsBackgroundDone() const { return m_worker.IsBackgroundDone(); } + bool m_showRanges = false; Range m_statRange; Range m_waitStackRange;