From e80c677fa0404b1058dbbfe08bfefb7a487003ca Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 10 Jul 2018 23:06:27 +0200 Subject: [PATCH] Plots can be safely sent in on-demand mode. --- client/TracyProfiler.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 65c534a2..873f518a 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -133,7 +133,9 @@ public: static tracy_force_inline void PlotData( const char* name, int64_t val ) { -#ifndef TRACY_ON_DEMAND +#ifdef TRACY_ON_DEMAND + if( !s_profiler.IsConnected() ) return; +#endif Magic magic; auto& token = s_token.ptr; auto& tail = token->get_tail_index(); @@ -144,12 +146,13 @@ public: MemWrite( &item->plotData.type, PlotDataType::Int ); MemWrite( &item->plotData.data.i, val ); tail.store( magic + 1, std::memory_order_release ); -#endif } static tracy_force_inline void PlotData( const char* name, float val ) { -#ifndef TRACY_ON_DEMAND +#ifdef TRACY_ON_DEMAND + if( !s_profiler.IsConnected() ) return; +#endif Magic magic; auto& token = s_token.ptr; auto& tail = token->get_tail_index(); @@ -160,12 +163,13 @@ public: MemWrite( &item->plotData.type, PlotDataType::Float ); MemWrite( &item->plotData.data.f, val ); tail.store( magic + 1, std::memory_order_release ); -#endif } static tracy_force_inline void PlotData( const char* name, double val ) { -#ifndef TRACY_ON_DEMAND +#ifdef TRACY_ON_DEMAND + if( !s_profiler.IsConnected() ) return; +#endif Magic magic; auto& token = s_token.ptr; auto& tail = token->get_tail_index(); @@ -176,7 +180,6 @@ public: MemWrite( &item->plotData.type, PlotDataType::Double ); MemWrite( &item->plotData.data.d, val ); tail.store( magic + 1, std::memory_order_release ); -#endif } static tracy_force_inline void Message( const char* txt, size_t size )