From 530e4643474906f2e2c7459d5c117ce93d00ba7d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 24 Jun 2020 01:32:57 +0200 Subject: [PATCH] Add checker for profiler availability. --- client/TracyProfiler.cpp | 4 +++- client/TracyProfiler.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 4ea61fb3..e27c08f0 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -863,7 +863,7 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ ) enum { QueuePrealloc = 256 * 1024 }; -static Profiler* s_instance; +static Profiler* s_instance = nullptr; static Thread* s_thread; static Thread* s_compressThread; @@ -871,6 +871,8 @@ static Thread* s_compressThread; static Thread* s_sysTraceThread = nullptr; #endif +TRACY_API bool ProfilerAvailable() { return s_instance != nullptr; } + #ifdef TRACY_DELAYED_INIT struct ThreadNameData; TRACY_API moodycamel::ConcurrentQueue& GetQueue(); diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 16fad758..6492b932 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -59,6 +59,7 @@ TRACY_API std::atomic& GetGpuCtxCounter(); TRACY_API GpuCtxWrapper& GetGpuCtx(); TRACY_API uint64_t GetThreadHandle(); TRACY_API void InitRPMallocThread(); +TRACY_API bool ProfilerAvailable(); struct SourceLocationData {