Add fiber enter API with group hint.

This commit is contained in:
Bartosz Taudul 2024-08-04 00:06:48 +02:00
parent 46852a7066
commit 37bfde5106
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
5 changed files with 8 additions and 4 deletions

View File

@ -4724,7 +4724,7 @@ TRACY_API int ___tracy_connected( void )
} }
#ifdef TRACY_FIBERS #ifdef TRACY_FIBERS
TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::EnterFiber( fiber ); } TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::EnterFiber( fiber, 0 ); }
TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); } TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); }
#endif #endif

View File

@ -675,11 +675,12 @@ public:
} }
#ifdef TRACY_FIBERS #ifdef TRACY_FIBERS
static tracy_force_inline void EnterFiber( const char* fiber ) static tracy_force_inline void EnterFiber( const char* fiber, int32_t groupHint )
{ {
TracyQueuePrepare( QueueType::FiberEnter ); TracyQueuePrepare( QueueType::FiberEnter );
MemWrite( &item->fiberEnter.time, GetTime() ); MemWrite( &item->fiberEnter.time, GetTime() );
MemWrite( &item->fiberEnter.fiber, (uint64_t)fiber ); MemWrite( &item->fiberEnter.fiber, (uint64_t)fiber );
MemWrite( &item->fiberEnter.groupHint, groupHint );
TracyQueueCommit( fiberEnter ); TracyQueueCommit( fiberEnter );
} }

View File

@ -9,7 +9,7 @@ namespace tracy
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; } constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
enum : uint32_t { ProtocolVersion = 67 }; enum : uint32_t { ProtocolVersion = 68 };
enum : uint16_t { BroadcastVersion = 3 }; enum : uint16_t { BroadcastVersion = 3 };
using lz4sz_t = uint32_t; using lz4sz_t = uint32_t;

View File

@ -260,6 +260,7 @@ struct QueueFiberEnter
int64_t time; int64_t time;
uint64_t fiber; // ptr uint64_t fiber; // ptr
uint32_t thread; uint32_t thread;
int32_t groupHint;
}; };
struct QueueFiberLeave struct QueueFiberLeave

View File

@ -119,6 +119,7 @@
#define TracySetProgramName(x) #define TracySetProgramName(x)
#define TracyFiberEnter(x) #define TracyFiberEnter(x)
#define TracyFiberEnterHint(x,y)
#define TracyFiberLeave #define TracyFiberLeave
#else #else
@ -287,7 +288,8 @@
#define TracySetProgramName( name ) tracy::GetProfiler().SetProgramName( name ); #define TracySetProgramName( name ) tracy::GetProfiler().SetProgramName( name );
#ifdef TRACY_FIBERS #ifdef TRACY_FIBERS
# define TracyFiberEnter( fiber ) tracy::Profiler::EnterFiber( fiber ) # define TracyFiberEnter( fiber ) tracy::Profiler::EnterFiber( fiber, 0 )
# define TracyFiberEnterHint( fiber, groupHint ) tracy::Profiler::EnterFiber( fiber, groupHint )
# define TracyFiberLeave tracy::Profiler::LeaveFiber() # define TracyFiberLeave tracy::Profiler::LeaveFiber()
#endif #endif