Allow sending named frames.

This commit is contained in:
Bartosz Taudul 2018-08-04 15:04:18 +02:00
parent 922882d3b0
commit adde6cf4fd
2 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#define ZoneName(x,y)
#define FrameMark
#define FrameMarkNamed(x)
#define TracyLockable( type, varname ) type varname;
#define TracyLockableN( type, varname, desc ) type varname;
@ -70,6 +71,7 @@
#define ZoneName( txt, size ) ___tracy_scoped_zone.Name( txt, size );
#define FrameMark tracy::Profiler::SendFrameMark();
#define FrameMarkNamed( name ) tracy::Profiler::SendFrameMark( name );
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocationData* { static const tracy::SourceLocationData srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() };
#define TracyLockableN( type, varname, desc ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocationData* { static const tracy::SourceLocationData srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() };

View File

@ -143,6 +143,21 @@ public:
tail.store( magic + 1, std::memory_order_release );
}
static tracy_force_inline void SendFrameMark( const char* name )
{
#ifdef TRACY_ON_DEMAND
if( !s_profiler.IsConnected() ) return;
#endif
Magic magic;
auto& token = s_token.ptr;
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
MemWrite( &item->hdr.type, QueueType::FrameMarkMsg );
MemWrite( &item->frameMark.time, GetTime() );
MemWrite( &item->frameMark.name, uint64_t( name ) );
tail.store( magic + 1, std::memory_order_release );
}
static tracy_force_inline void PlotData( const char* name, int64_t val )
{
#ifdef TRACY_ON_DEMAND