1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Plots can be safely sent in on-demand mode.

This commit is contained in:
Bartosz Taudul 2018-07-10 23:06:27 +02:00
parent d1ddaa8d59
commit e80c677fa0

View File

@ -133,7 +133,9 @@ public:
static tracy_force_inline void PlotData( const char* name, int64_t val ) 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; Magic magic;
auto& token = s_token.ptr; auto& token = s_token.ptr;
auto& tail = token->get_tail_index(); auto& tail = token->get_tail_index();
@ -144,12 +146,13 @@ public:
MemWrite( &item->plotData.type, PlotDataType::Int ); MemWrite( &item->plotData.type, PlotDataType::Int );
MemWrite( &item->plotData.data.i, val ); MemWrite( &item->plotData.data.i, val );
tail.store( magic + 1, std::memory_order_release ); tail.store( magic + 1, std::memory_order_release );
#endif
} }
static tracy_force_inline void PlotData( const char* name, float val ) 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; Magic magic;
auto& token = s_token.ptr; auto& token = s_token.ptr;
auto& tail = token->get_tail_index(); auto& tail = token->get_tail_index();
@ -160,12 +163,13 @@ public:
MemWrite( &item->plotData.type, PlotDataType::Float ); MemWrite( &item->plotData.type, PlotDataType::Float );
MemWrite( &item->plotData.data.f, val ); MemWrite( &item->plotData.data.f, val );
tail.store( magic + 1, std::memory_order_release ); tail.store( magic + 1, std::memory_order_release );
#endif
} }
static tracy_force_inline void PlotData( const char* name, double val ) 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; Magic magic;
auto& token = s_token.ptr; auto& token = s_token.ptr;
auto& tail = token->get_tail_index(); auto& tail = token->get_tail_index();
@ -176,7 +180,6 @@ public:
MemWrite( &item->plotData.type, PlotDataType::Double ); MemWrite( &item->plotData.type, PlotDataType::Double );
MemWrite( &item->plotData.data.d, val ); MemWrite( &item->plotData.data.d, val );
tail.store( magic + 1, std::memory_order_release ); tail.store( magic + 1, std::memory_order_release );
#endif
} }
static tracy_force_inline void Message( const char* txt, size_t size ) static tracy_force_inline void Message( const char* txt, size_t size )