Allow remote plot configuration.

This commit is contained in:
Bartosz Taudul 2019-11-05 16:47:41 +01:00 committed by Bartosz Taudul
parent a7a739eea9
commit 907574e637
4 changed files with 36 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#define LockMark(x) (void)x; #define LockMark(x) (void)x;
#define TracyPlot(x,y) #define TracyPlot(x,y)
#define TracyPlotConfig(x,y)
#define TracyMessage(x,y) #define TracyMessage(x,y)
#define TracyMessageL(x) #define TracyMessageL(x)
@ -100,6 +101,7 @@
#define LockMark( varname ) static const tracy::SourceLocationData __tracy_lock_location_##varname { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname ); #define LockMark( varname ) static const tracy::SourceLocationData __tracy_lock_location_##varname { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname );
#define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val ); #define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val );
#define TracyPlotConfig( name, type ) tracy::Profiler::ConfigurePlot( name, type );
#define TracyMessage( txt, size ) tracy::Profiler::Message( txt, size ); #define TracyMessage( txt, size ) tracy::Profiler::Message( txt, size );
#define TracyMessageL( txt ) tracy::Profiler::Message( txt ); #define TracyMessageL( txt ) tracy::Profiler::Message( txt );

View File

@ -244,6 +244,23 @@ public:
tail.store( magic + 1, std::memory_order_release ); tail.store( magic + 1, std::memory_order_release );
} }
static tracy_force_inline void ConfigurePlot( const char* name, PlotFormatType type )
{
Magic magic;
auto token = GetToken();
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin( magic );
MemWrite( &item->hdr.type, QueueType::PlotConfig );
MemWrite( &item->plotConfig.name, (uint64_t)name );
MemWrite( &item->plotConfig.type, (uint8_t)type );
#ifdef TRACY_ON_DEMAND
GetProfiler().DeferItem( *item );
#endif
tail.store( magic + 1, std::memory_order_release );
}
static tracy_force_inline void Message( const char* txt, size_t size ) static tracy_force_inline void Message( const char* txt, size_t size )
{ {
#ifdef TRACY_ON_DEMAND #ifdef TRACY_ON_DEMAND

View File

@ -9,7 +9,7 @@
namespace tracy namespace tracy
{ {
enum : uint32_t { ProtocolVersion = 21 }; enum : uint32_t { ProtocolVersion = 22 };
enum : uint32_t { BroadcastVersion = 0 }; enum : uint32_t { BroadcastVersion = 0 };
using lz4sz_t = uint32_t; using lz4sz_t = uint32_t;

View File

@ -62,6 +62,7 @@ enum class QueueType : uint8_t
CallstackFrame, CallstackFrame,
SysTimeReport, SysTimeReport,
TidToPid, TidToPid,
PlotConfig,
StringData, StringData,
ThreadName, ThreadName,
CustomStringData, CustomStringData,
@ -330,6 +331,19 @@ struct QueueTidToPid
uint64_t pid; uint64_t pid;
}; };
enum class PlotFormatType : uint8_t
{
Number,
Memory,
Percentage
};
struct QueuePlotConfig
{
uint64_t name; // ptr
uint8_t type;
};
struct QueueHeader struct QueueHeader
{ {
union union
@ -378,6 +392,7 @@ struct QueueItem
QueueContextSwitch contextSwitch; QueueContextSwitch contextSwitch;
QueueThreadWakeup threadWakeup; QueueThreadWakeup threadWakeup;
QueueTidToPid tidToPid; QueueTidToPid tidToPid;
QueuePlotConfig plotConfig;
}; };
}; };
#pragma pack() #pragma pack()
@ -441,6 +456,7 @@ static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueCallstackFrame ), sizeof( QueueHeader ) + sizeof( QueueCallstackFrame ),
sizeof( QueueHeader ) + sizeof( QueueSysTime ), sizeof( QueueHeader ) + sizeof( QueueSysTime ),
sizeof( QueueHeader ) + sizeof( QueueTidToPid ), sizeof( QueueHeader ) + sizeof( QueueTidToPid ),
sizeof( QueueHeader ) + sizeof( QueuePlotConfig ),
// keep all QueueStringTransfer below // keep all QueueStringTransfer below
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // string data sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // string data
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // thread name sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // thread name