Update Tracy Profiler to 0.10
This commit is contained in:
7
Source/ThirdParty/tracy/TracyClient.cpp
vendored
7
Source/ThirdParty/tracy/TracyClient.cpp
vendored
@@ -11,10 +11,10 @@
|
||||
|
||||
// Define TRACY_ENABLE to enable profiler.
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
|
||||
#include "common/TracySystem.cpp"
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push, 0)
|
||||
#endif
|
||||
@@ -22,12 +22,13 @@
|
||||
#include <ThirdParty/LZ4/lz4.h>
|
||||
#include "client/TracyProfiler.cpp"
|
||||
#include "client/TracyCallstack.cpp"
|
||||
#include "client/TracySysPower.cpp"
|
||||
#include "client/TracySysTime.cpp"
|
||||
#include "client/TracySysTrace.cpp"
|
||||
#include "common/TracySocket.cpp"
|
||||
#include "client/tracy_rpmalloc.cpp"
|
||||
#include "client/TracyAlloc.cpp"
|
||||
|
||||
#include "client/TracyOverride.cpp"
|
||||
|
||||
#if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6
|
||||
# include "libbacktrace/alloc.cpp"
|
||||
|
||||
@@ -154,7 +154,6 @@ void InitCallstack()
|
||||
DBGHELP_LOCK;
|
||||
#endif
|
||||
|
||||
//SymInitialize( GetCurrentProcess(), "C:\\Flax\\FlaxEngine\\Binaries\\Editor\\Win64\\Debug;C:\\Flax\\FlaxEngine\\Cache\\Projects", true );
|
||||
SymInitialize( GetCurrentProcess(), nullptr, true );
|
||||
SymSetOptions( SYMOPT_LOAD_LINES );
|
||||
|
||||
@@ -228,6 +227,10 @@ void InitCallstack()
|
||||
const auto res = GetModuleFileNameA( mod[i], name, 1021 );
|
||||
if( res > 0 )
|
||||
{
|
||||
// This may be a new module loaded since our call to SymInitialize.
|
||||
// Just in case, force DbgHelp to load its pdb !
|
||||
SymLoadModuleEx(proc, NULL, name, NULL, (DWORD64)info.lpBaseOfDll, info.SizeOfImage, NULL, 0);
|
||||
|
||||
auto ptr = name + res;
|
||||
while( ptr > name && *ptr != '\\' && *ptr != '/' ) ptr--;
|
||||
if( ptr > name ) ptr++;
|
||||
@@ -683,7 +686,9 @@ void InitCallstackCritical()
|
||||
void InitCallstack()
|
||||
{
|
||||
cb_bts = backtrace_create_state( nullptr, 0, nullptr, nullptr );
|
||||
#ifndef TRACY_DEMANGLE
|
||||
___tracy_init_demangle_buffer();
|
||||
#endif
|
||||
|
||||
#ifdef __linux
|
||||
InitKernelSymbols();
|
||||
@@ -758,7 +763,9 @@ debuginfod_client* GetDebuginfodClient()
|
||||
|
||||
void EndCallstack()
|
||||
{
|
||||
#ifndef TRACY_DEMANGLE
|
||||
___tracy_free_demangle_buffer();
|
||||
#endif
|
||||
#ifdef TRACY_DEBUGINFOD
|
||||
ClearDebugInfoVector( s_di_known );
|
||||
debuginfod_end( s_debuginfod );
|
||||
|
||||
@@ -10,7 +10,14 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
#ifndef TRACY_HAS_CALLSTACK
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
static tracy_force_inline void* Callstack( int depth ) { return nullptr; }
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef TRACY_DEBUGINFOD
|
||||
# include <elfutils/debuginfod.h>
|
||||
|
||||
8
Source/ThirdParty/tracy/client/TracyLock.hpp
vendored
8
Source/ThirdParty/tracy/client/TracyLock.hpp
vendored
@@ -21,7 +21,7 @@ public:
|
||||
, m_active( false )
|
||||
#endif
|
||||
{
|
||||
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
||||
assert( m_id != (std::numeric_limits<uint32_t>::max)() );
|
||||
|
||||
auto item = Profiler::QueueSerial();
|
||||
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
|
||||
tracy_force_inline void CustomName( const char* name, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
auto ptr = (char*)tracy_malloc( size );
|
||||
memcpy( ptr, name, size );
|
||||
auto item = Profiler::QueueSerial();
|
||||
@@ -235,7 +235,7 @@ public:
|
||||
, m_active( false )
|
||||
#endif
|
||||
{
|
||||
assert( m_id != std::numeric_limits<uint32_t>::max() );
|
||||
assert( m_id != (std::numeric_limits<uint32_t>::max)() );
|
||||
|
||||
auto item = Profiler::QueueSerial();
|
||||
MemWrite( &item->hdr.type, QueueType::LockAnnounce );
|
||||
@@ -450,7 +450,7 @@ public:
|
||||
|
||||
tracy_force_inline void CustomName( const char* name, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
auto ptr = (char*)tracy_malloc( size );
|
||||
memcpy( ptr, name, size );
|
||||
auto item = Profiler::QueueSerial();
|
||||
|
||||
26
Source/ThirdParty/tracy/client/TracyOverride.cpp
vendored
Normal file
26
Source/ThirdParty/tracy/client/TracyOverride.cpp
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifdef TRACY_ENABLE
|
||||
# ifdef __linux__
|
||||
# include "TracyDebug.hpp"
|
||||
# ifdef TRACY_VERBOSE
|
||||
# include <dlfcn.h>
|
||||
# include <link.h>
|
||||
# endif
|
||||
|
||||
extern "C" int dlclose( void* hnd )
|
||||
{
|
||||
#ifdef TRACY_VERBOSE
|
||||
struct link_map* lm;
|
||||
if( dlinfo( hnd, RTLD_DI_LINKMAP, &lm ) == 0 )
|
||||
{
|
||||
TracyDebug( "Overriding dlclose for %s\n", lm->l_name );
|
||||
}
|
||||
else
|
||||
{
|
||||
TracyDebug( "Overriding dlclose for unknown object (%s)\n", dlerror() );
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
# endif
|
||||
#endif
|
||||
544
Source/ThirdParty/tracy/client/TracyProfiler.cpp
vendored
544
Source/ThirdParty/tracy/client/TracyProfiler.cpp
vendored
@@ -81,7 +81,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
# define TRACY_DELAYED_INIT
|
||||
# ifndef TRACY_DELAYED_INIT
|
||||
# define TRACY_DELAYED_INIT
|
||||
# endif
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
# define init_order( val ) __attribute__ ((init_priority(val)))
|
||||
@@ -1074,7 +1076,9 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ )
|
||||
}
|
||||
closedir( dp );
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
if( selfTid == s_symbolTid ) s_symbolThreadGone.store( true, std::memory_order_release );
|
||||
#endif
|
||||
|
||||
TracyLfqPrepare( QueueType::Crash );
|
||||
TracyLfqCommit;
|
||||
@@ -1355,6 +1359,7 @@ Profiler::Profiler()
|
||||
, m_queryImage( nullptr )
|
||||
, m_queryData( nullptr )
|
||||
, m_crashHandlerInstalled( false )
|
||||
, m_programName( nullptr )
|
||||
{
|
||||
assert( !s_instance );
|
||||
s_instance = this;
|
||||
@@ -1417,7 +1422,9 @@ void Profiler::SpawnWorkerThreads()
|
||||
|
||||
#if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
|
||||
s_profilerThreadId = GetThreadId( s_thread->Handle() );
|
||||
# ifdef TRACY_HAS_CALLSTACK
|
||||
s_symbolThreadId = GetThreadId( s_symbolThread->Handle() );
|
||||
# endif
|
||||
m_exceptionHandler = AddVectoredExceptionHandler( 1, CrashFilter );
|
||||
#endif
|
||||
|
||||
@@ -1456,7 +1463,7 @@ Profiler::~Profiler()
|
||||
if( m_crashHandlerInstalled ) RemoveVectoredExceptionHandler( m_exceptionHandler );
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
|
||||
if( m_crashHandlerInstalled )
|
||||
{
|
||||
sigaction( TRACY_CRASH_SIGNAL, &m_prevSignal.pwr, nullptr );
|
||||
@@ -1522,7 +1529,7 @@ bool Profiler::ShouldExit()
|
||||
|
||||
void Profiler::Worker()
|
||||
{
|
||||
#ifdef __linux__
|
||||
#if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
|
||||
s_profilerTid = syscall( SYS_gettid );
|
||||
#endif
|
||||
|
||||
@@ -1711,6 +1718,9 @@ void Profiler::Worker()
|
||||
if( m_sock ) break;
|
||||
#ifndef TRACY_ON_DEMAND
|
||||
ProcessSysTime();
|
||||
# ifdef TRACY_HAS_SYSPOWER
|
||||
m_sysPower.Tick();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if( m_broadcast )
|
||||
@@ -1718,6 +1728,14 @@ void Profiler::Worker()
|
||||
const auto t = std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||
if( t - lastBroadcast > 3000000000 ) // 3s
|
||||
{
|
||||
m_programNameLock.lock();
|
||||
if( m_programName )
|
||||
{
|
||||
broadcastMsg = GetBroadcastMessage( m_programName, strlen( m_programName ), broadcastLen, dataPort );
|
||||
m_programName = nullptr;
|
||||
}
|
||||
m_programNameLock.unlock();
|
||||
|
||||
lastBroadcast = t;
|
||||
const auto ts = std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count();
|
||||
broadcastMsg.activeTime = int32_t( ts - m_epoch );
|
||||
@@ -1828,6 +1846,9 @@ void Profiler::Worker()
|
||||
for(;;)
|
||||
{
|
||||
ProcessSysTime();
|
||||
#ifdef TRACY_HAS_SYSPOWER
|
||||
m_sysPower.Tick();
|
||||
#endif
|
||||
const auto status = Dequeue( token );
|
||||
const auto serialStatus = DequeueSerial();
|
||||
if( status == DequeueStatus::ConnectionLost || serialStatus == DequeueStatus::ConnectionLost )
|
||||
@@ -3026,9 +3047,9 @@ void Profiler::SendSourceLocation( uint64_t ptr )
|
||||
MemWrite( &item.srcloc.file, (uint64_t)srcloc->file );
|
||||
MemWrite( &item.srcloc.function, (uint64_t)srcloc->function );
|
||||
MemWrite( &item.srcloc.line, srcloc->line );
|
||||
MemWrite( &item.srcloc.r, uint8_t( ( srcloc->color ) & 0xFF ) );
|
||||
MemWrite( &item.srcloc.b, uint8_t( ( srcloc->color ) & 0xFF ) );
|
||||
MemWrite( &item.srcloc.g, uint8_t( ( srcloc->color >> 8 ) & 0xFF ) );
|
||||
MemWrite( &item.srcloc.b, uint8_t( ( srcloc->color >> 16 ) & 0xFF ) );
|
||||
MemWrite( &item.srcloc.r, uint8_t( ( srcloc->color >> 16 ) & 0xFF ) );
|
||||
AppendData( &item, QueueDataSize[(int)QueueType::SourceLocation] );
|
||||
}
|
||||
|
||||
@@ -3331,10 +3352,8 @@ bool Profiler::HandleServerQuery()
|
||||
|
||||
uint8_t type;
|
||||
uint64_t ptr;
|
||||
uint32_t extra;
|
||||
memcpy( &type, &payload.type, sizeof( payload.type ) );
|
||||
memcpy( &ptr, &payload.ptr, sizeof( payload.ptr ) );
|
||||
memcpy( &extra, &payload.extra, sizeof( payload.extra ) );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
@@ -3381,7 +3400,7 @@ bool Profiler::HandleServerQuery()
|
||||
break;
|
||||
#ifndef TRACY_NO_CODE_TRANSFER
|
||||
case ServerQuerySymbolCode:
|
||||
HandleSymbolCodeQuery( ptr, extra );
|
||||
HandleSymbolCodeQuery( ptr, payload.extra );
|
||||
break;
|
||||
#endif
|
||||
case ServerQuerySourceCode:
|
||||
@@ -3398,7 +3417,7 @@ bool Profiler::HandleServerQuery()
|
||||
break;
|
||||
case ServerQueryDataTransferPart:
|
||||
memcpy( m_queryDataPtr, &ptr, 8 );
|
||||
memcpy( m_queryDataPtr+8, &extra, 4 );
|
||||
memcpy( m_queryDataPtr+8, &payload.extra, 4 );
|
||||
m_queryDataPtr += 12;
|
||||
AckServerQuery();
|
||||
break;
|
||||
@@ -3753,7 +3772,7 @@ void Profiler::SendFrameImage( const void* image, uint16_t w, uint16_t h, uint8_
|
||||
{
|
||||
#ifndef TRACY_NO_FRAME_IMAGE
|
||||
auto& profiler = GetProfiler();
|
||||
assert( profiler.m_frameCount.load( std::memory_order_relaxed ) < std::numeric_limits<uint32_t>::max() );
|
||||
assert( profiler.m_frameCount.load( std::memory_order_relaxed ) < (std::numeric_limits<uint32_t>::max)() );
|
||||
# ifdef TRACY_ON_DEMAND
|
||||
if( !profiler.IsConnected() ) return;
|
||||
# endif
|
||||
@@ -3770,6 +3789,12 @@ void Profiler::SendFrameImage( const void* image, uint16_t w, uint16_t h, uint8_
|
||||
fi->flip = flip;
|
||||
profiler.m_fiQueue.commit_next();
|
||||
profiler.m_fiLock.unlock();
|
||||
#else
|
||||
static_cast<void>(image); // unused
|
||||
static_cast<void>(w); // unused
|
||||
static_cast<void>(h); // unused
|
||||
static_cast<void>(offset); // unused
|
||||
static_cast<void>(flip); // unused
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3827,7 +3852,7 @@ void Profiler::ConfigurePlot( const char* name, PlotFormatType type, bool step,
|
||||
|
||||
void Profiler::Message( const char* txt, size_t size, int callstack )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( !GetProfiler().IsConnected() ) return;
|
||||
#endif
|
||||
@@ -3864,7 +3889,7 @@ void Profiler::Message( const char* txt, int callstack )
|
||||
|
||||
void Profiler::MessageColor( const char* txt, size_t size, uint32_t color, int callstack )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( !GetProfiler().IsConnected() ) return;
|
||||
#endif
|
||||
@@ -3879,9 +3904,9 @@ void Profiler::MessageColor( const char* txt, size_t size, uint32_t color, int c
|
||||
TracyQueuePrepare( callstack == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack );
|
||||
MemWrite( &item->messageColorFat.time, GetTime() );
|
||||
MemWrite( &item->messageColorFat.text, (uint64_t)ptr );
|
||||
MemWrite( &item->messageColorFat.r, uint8_t( ( color ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorFat.b, uint8_t( ( color ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorFat.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorFat.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorFat.r, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorFat.size, (uint16_t)size );
|
||||
TracyQueueCommit( messageColorFatThread );
|
||||
}
|
||||
@@ -3899,15 +3924,15 @@ void Profiler::MessageColor( const char* txt, uint32_t color, int callstack )
|
||||
TracyQueuePrepare( callstack == 0 ? QueueType::MessageLiteralColor : QueueType::MessageLiteralColorCallstack );
|
||||
MemWrite( &item->messageColorLiteral.time, GetTime() );
|
||||
MemWrite( &item->messageColorLiteral.text, (uint64_t)txt );
|
||||
MemWrite( &item->messageColorLiteral.r, uint8_t( ( color ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorLiteral.b, uint8_t( ( color ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorLiteral.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorLiteral.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||
MemWrite( &item->messageColorLiteral.r, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||
TracyQueueCommit( messageColorLiteralThread );
|
||||
}
|
||||
|
||||
void Profiler::MessageAppInfo( const char* txt, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
auto ptr = (char*)tracy_malloc( size );
|
||||
memcpy( ptr, txt, size );
|
||||
TracyLfqPrepare( QueueType::MessageAppInfo );
|
||||
@@ -3922,7 +3947,7 @@ void Profiler::MessageAppInfo( const char* txt, size_t size )
|
||||
TracyLfqCommit;
|
||||
}
|
||||
|
||||
void Profiler::MemAlloc(const void* ptr, size_t size, bool secure)
|
||||
void Profiler::MemAlloc( const void* ptr, size_t size, bool secure )
|
||||
{
|
||||
if( secure && !ProfilerAvailable() ) return;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
@@ -4085,7 +4110,6 @@ void Profiler::SendCallstack( int depth )
|
||||
#endif
|
||||
}
|
||||
|
||||
void Profiler::ParameterRegister( ParameterCallback cb ) { GetProfiler().m_paramCallback = cb; }
|
||||
void Profiler::ParameterRegister( ParameterCallback cb, void* data )
|
||||
{
|
||||
auto& profiler = GetProfiler();
|
||||
@@ -4301,486 +4325,4 @@ int64_t Profiler::GetTimeQpc()
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin( const struct ___tracy_source_location_data* srcloc, int active )
|
||||
{
|
||||
___tracy_c_zone_context ctx;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
ctx.active = active && tracy::GetProfiler().IsConnected();
|
||||
#else
|
||||
ctx.active = active;
|
||||
#endif
|
||||
if( !ctx.active ) return ctx;
|
||||
const auto id = tracy::GetProfiler().GetNextZoneId();
|
||||
ctx.id = id;
|
||||
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneBegin );
|
||||
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
||||
TracyQueueCommitC( zoneBeginThread );
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___tracy_source_location_data* srcloc, int depth, int active )
|
||||
{
|
||||
___tracy_c_zone_context ctx;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
ctx.active = active && tracy::GetProfiler().IsConnected();
|
||||
#else
|
||||
ctx.active = active;
|
||||
#endif
|
||||
if( !ctx.active ) return ctx;
|
||||
const auto id = tracy::GetProfiler().GetNextZoneId();
|
||||
ctx.id = id;
|
||||
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
tracy::GetProfiler().SendCallstack( depth );
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneBeginCallstack );
|
||||
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
||||
TracyQueueCommitC( zoneBeginThread );
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc( uint64_t srcloc, int active )
|
||||
{
|
||||
___tracy_c_zone_context ctx;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
ctx.active = active && tracy::GetProfiler().IsConnected();
|
||||
#else
|
||||
ctx.active = active;
|
||||
#endif
|
||||
if( !ctx.active )
|
||||
{
|
||||
tracy::tracy_free( (void*)srcloc );
|
||||
return ctx;
|
||||
}
|
||||
const auto id = tracy::GetProfiler().GetNextZoneId();
|
||||
ctx.id = id;
|
||||
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneBeginAllocSrcLoc );
|
||||
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||
TracyQueueCommitC( zoneBeginThread );
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srcloc, int depth, int active )
|
||||
{
|
||||
___tracy_c_zone_context ctx;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
ctx.active = active && tracy::GetProfiler().IsConnected();
|
||||
#else
|
||||
ctx.active = active;
|
||||
#endif
|
||||
if( !ctx.active )
|
||||
{
|
||||
tracy::tracy_free( (void*)srcloc );
|
||||
return ctx;
|
||||
}
|
||||
const auto id = tracy::GetProfiler().GetNextZoneId();
|
||||
ctx.id = id;
|
||||
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
tracy::GetProfiler().SendCallstack( depth );
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneBeginAllocSrcLocCallstack );
|
||||
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||
TracyQueueCommitC( zoneBeginThread );
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_zone_end( TracyCZoneCtx ctx )
|
||||
{
|
||||
if( !ctx.active ) return;
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, ctx.id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneEnd );
|
||||
tracy::MemWrite( &item->zoneEnd.time, tracy::Profiler::GetTime() );
|
||||
TracyQueueCommitC( zoneEndThread );
|
||||
}
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_zone_text( TracyCZoneCtx ctx, const char* txt, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
if( !ctx.active ) return;
|
||||
auto ptr = (char*)tracy::tracy_malloc( size );
|
||||
memcpy( ptr, txt, size );
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, ctx.id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneText );
|
||||
tracy::MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
|
||||
tracy::MemWrite( &item->zoneTextFat.size, (uint16_t)size );
|
||||
TracyQueueCommitC( zoneTextFatThread );
|
||||
}
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_zone_name( TracyCZoneCtx ctx, const char* txt, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
if( !ctx.active ) return;
|
||||
auto ptr = (char*)tracy::tracy_malloc( size );
|
||||
memcpy( ptr, txt, size );
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, ctx.id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneName );
|
||||
tracy::MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
|
||||
tracy::MemWrite( &item->zoneTextFat.size, (uint16_t)size );
|
||||
TracyQueueCommitC( zoneTextFatThread );
|
||||
}
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_zone_color( TracyCZoneCtx ctx, uint32_t color ) {
|
||||
if( !ctx.active ) return;
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, ctx.id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneColor );
|
||||
tracy::MemWrite( &item->zoneColor.r, uint8_t( ( color ) & 0xFF ) );
|
||||
tracy::MemWrite( &item->zoneColor.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
||||
tracy::MemWrite( &item->zoneColor.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||
TracyQueueCommitC( zoneColorThread );
|
||||
}
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_zone_value( TracyCZoneCtx ctx, uint64_t value )
|
||||
{
|
||||
if( !ctx.active ) return;
|
||||
#ifndef TRACY_NO_VERIFY
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValidation );
|
||||
tracy::MemWrite( &item->zoneValidation.id, ctx.id );
|
||||
TracyQueueCommitC( zoneValidationThread );
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TracyQueuePrepareC( tracy::QueueType::ZoneValue );
|
||||
tracy::MemWrite( &item->zoneValue.value, value );
|
||||
TracyQueueCommitC( zoneValueThread );
|
||||
}
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_memory_alloc( const void* ptr, size_t size, int secure ) { tracy::Profiler::MemAlloc( ptr, size, secure != 0 ); }
|
||||
TRACY_API void ___tracy_emit_memory_alloc_callstack( const void* ptr, size_t size, int depth, int secure ) { tracy::Profiler::MemAllocCallstack( ptr, size, depth, secure != 0 ); }
|
||||
TRACY_API void ___tracy_emit_memory_free( const void* ptr, int secure ) { tracy::Profiler::MemFree( ptr, secure != 0 ); }
|
||||
TRACY_API void ___tracy_emit_memory_free_callstack( const void* ptr, int depth, int secure ) { tracy::Profiler::MemFreeCallstack( ptr, depth, secure != 0 ); }
|
||||
TRACY_API void ___tracy_emit_memory_alloc_named( const void* ptr, size_t size, int secure, const char* name ) { tracy::Profiler::MemAllocNamed( ptr, size, secure != 0, name ); }
|
||||
TRACY_API void ___tracy_emit_memory_alloc_callstack_named( const void* ptr, size_t size, int depth, int secure, const char* name ) { tracy::Profiler::MemAllocCallstackNamed( ptr, size, depth, secure != 0, name ); }
|
||||
TRACY_API void ___tracy_emit_memory_free_named( const void* ptr, int secure, const char* name ) { tracy::Profiler::MemFreeNamed( ptr, secure != 0, name ); }
|
||||
TRACY_API void ___tracy_emit_memory_free_callstack_named( const void* ptr, int depth, int secure, const char* name ) { tracy::Profiler::MemFreeCallstackNamed( ptr, depth, secure != 0, name ); }
|
||||
TRACY_API void ___tracy_emit_frame_mark( const char* name ) { tracy::Profiler::SendFrameMark( name ); }
|
||||
TRACY_API void ___tracy_emit_frame_mark_start( const char* name ) { tracy::Profiler::SendFrameMark( name, tracy::QueueType::FrameMarkMsgStart ); }
|
||||
TRACY_API void ___tracy_emit_frame_mark_end( const char* name ) { tracy::Profiler::SendFrameMark( name, tracy::QueueType::FrameMarkMsgEnd ); }
|
||||
TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_t h, uint8_t offset, int flip ) { tracy::Profiler::SendFrameImage( image, w, h, offset, flip ); }
|
||||
TRACY_API void ___tracy_emit_plot( const char* name, double val ) { tracy::Profiler::PlotData( name, val ); }
|
||||
TRACY_API void ___tracy_emit_message( const char* txt, size_t size, int callstack ) { tracy::Profiler::Message( txt, size, callstack ); }
|
||||
TRACY_API void ___tracy_emit_messageL( const char* txt, int callstack ) { tracy::Profiler::Message( txt, callstack ); }
|
||||
TRACY_API void ___tracy_emit_messageC( const char* txt, size_t size, uint32_t color, int callstack ) { tracy::Profiler::MessageColor( txt, size, color, callstack ); }
|
||||
TRACY_API void ___tracy_emit_messageLC( const char* txt, uint32_t color, int callstack ) { tracy::Profiler::MessageColor( txt, color, callstack ); }
|
||||
TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size ) { tracy::Profiler::MessageAppInfo( txt, size ); }
|
||||
|
||||
TRACY_API uint64_t ___tracy_alloc_srcloc( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz ) {
|
||||
return tracy::Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz );
|
||||
}
|
||||
|
||||
TRACY_API uint64_t ___tracy_alloc_srcloc_name( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz ) {
|
||||
return tracy::Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin( const struct ___tracy_gpu_zone_begin_data data )
|
||||
{
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuZoneBegin );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin_callstack( const struct ___tracy_gpu_zone_begin_callstack_data data )
|
||||
{
|
||||
tracy::GetProfiler().SendCallstack( data.depth );
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuZoneBeginCallstack );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin_alloc( const struct ___tracy_gpu_zone_begin_data data )
|
||||
{
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuZoneBeginAllocSrcLoc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin_alloc_callstack( const struct ___tracy_gpu_zone_begin_callstack_data data )
|
||||
{
|
||||
tracy::GetProfiler().SendCallstack( data.depth );
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuZoneBeginAllocSrcLocCallstack );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_time( const struct ___tracy_gpu_time_data data )
|
||||
{
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuTime );
|
||||
tracy::MemWrite( &item->gpuTime.gpuTime, data.gpuTime );
|
||||
tracy::MemWrite( &item->gpuTime.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuTime.context, data.context );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_end( const struct ___tracy_gpu_zone_end_data data )
|
||||
{
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuZoneEnd );
|
||||
tracy::MemWrite( &item->gpuZoneEnd.cpuTime, tracy::Profiler::GetTime() );
|
||||
memset( &item->gpuZoneEnd.thread, 0, sizeof( item->gpuZoneEnd.thread ) );
|
||||
tracy::MemWrite( &item->gpuZoneEnd.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneEnd.context, data.context );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_new_context( ___tracy_gpu_new_context_data data )
|
||||
{
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuNewContext );
|
||||
tracy::MemWrite( &item->gpuNewContext.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuNewContext.gpuTime, data.gpuTime );
|
||||
tracy::MemWrite( &item->gpuNewContext.period, data.period );
|
||||
tracy::MemWrite( &item->gpuNewContext.context, data.context );
|
||||
tracy::MemWrite( &item->gpuNewContext.flags, data.flags );
|
||||
tracy::MemWrite( &item->gpuNewContext.type, data.type );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_context_name( const struct ___tracy_gpu_context_name_data data )
|
||||
{
|
||||
auto ptr = (char*)tracy::tracy_malloc( data.len );
|
||||
memcpy( ptr, data.name, data.len );
|
||||
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuContextName );
|
||||
tracy::MemWrite( &item->gpuContextNameFat.context, data.context );
|
||||
tracy::MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr );
|
||||
tracy::MemWrite( &item->gpuContextNameFat.size, data.len );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_calibration( const struct ___tracy_gpu_calibration_data data )
|
||||
{
|
||||
TracyLfqPrepareC( tracy::QueueType::GpuCalibration );
|
||||
tracy::MemWrite( &item->gpuCalibration.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuCalibration.gpuTime, data.gpuTime );
|
||||
tracy::MemWrite( &item->gpuCalibration.cpuDelta, data.cpuDelta );
|
||||
tracy::MemWrite( &item->gpuCalibration.context, data.context );
|
||||
TracyLfqCommitC;
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin_serial( const struct ___tracy_gpu_zone_begin_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerial();
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuZoneBeginSerial );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin_callstack_serial( const struct ___tracy_gpu_zone_begin_callstack_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerialCallstack( tracy::Callstack( data.depth ) );
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuZoneBeginCallstackSerial );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin_alloc_serial( const struct ___tracy_gpu_zone_begin_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerial();
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuZoneBeginAllocSrcLocSerial );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_begin_alloc_callstack_serial( const struct ___tracy_gpu_zone_begin_callstack_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerialCallstack( tracy::Callstack( data.depth ) );
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuZoneBeginAllocSrcLocCallstackSerial );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.srcloc, data.srcloc );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneBegin.context, data.context );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_time_serial( const struct ___tracy_gpu_time_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerial();
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuTime );
|
||||
tracy::MemWrite( &item->gpuTime.gpuTime, data.gpuTime );
|
||||
tracy::MemWrite( &item->gpuTime.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuTime.context, data.context );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_zone_end_serial( const struct ___tracy_gpu_zone_end_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerial();
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuZoneEndSerial );
|
||||
tracy::MemWrite( &item->gpuZoneEnd.cpuTime, tracy::Profiler::GetTime() );
|
||||
memset( &item->gpuZoneEnd.thread, 0, sizeof( item->gpuZoneEnd.thread ) );
|
||||
tracy::MemWrite( &item->gpuZoneEnd.queryId, data.queryId );
|
||||
tracy::MemWrite( &item->gpuZoneEnd.context, data.context );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_new_context_serial( ___tracy_gpu_new_context_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerial();
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuNewContext );
|
||||
tracy::MemWrite( &item->gpuNewContext.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuNewContext.thread, tracy::GetThreadHandle() );
|
||||
tracy::MemWrite( &item->gpuNewContext.gpuTime, data.gpuTime );
|
||||
tracy::MemWrite( &item->gpuNewContext.period, data.period );
|
||||
tracy::MemWrite( &item->gpuNewContext.context, data.context );
|
||||
tracy::MemWrite( &item->gpuNewContext.flags, data.flags );
|
||||
tracy::MemWrite( &item->gpuNewContext.type, data.type );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_context_name_serial( const struct ___tracy_gpu_context_name_data data )
|
||||
{
|
||||
auto ptr = (char*)tracy::tracy_malloc( data.len );
|
||||
memcpy( ptr, data.name, data.len );
|
||||
|
||||
auto item = tracy::Profiler::QueueSerial();
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuContextName );
|
||||
tracy::MemWrite( &item->gpuContextNameFat.context, data.context );
|
||||
tracy::MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr );
|
||||
tracy::MemWrite( &item->gpuContextNameFat.size, data.len );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_emit_gpu_calibration_serial( const struct ___tracy_gpu_calibration_data data )
|
||||
{
|
||||
auto item = tracy::Profiler::QueueSerial();
|
||||
tracy::MemWrite( &item->hdr.type, tracy::QueueType::GpuCalibration );
|
||||
tracy::MemWrite( &item->gpuCalibration.cpuTime, tracy::Profiler::GetTime() );
|
||||
tracy::MemWrite( &item->gpuCalibration.gpuTime, data.gpuTime );
|
||||
tracy::MemWrite( &item->gpuCalibration.cpuDelta, data.cpuDelta );
|
||||
tracy::MemWrite( &item->gpuCalibration.context, data.context );
|
||||
tracy::Profiler::QueueSerialFinish();
|
||||
}
|
||||
|
||||
TRACY_API int ___tracy_connected( void )
|
||||
{
|
||||
return tracy::GetProfiler().IsConnected();
|
||||
}
|
||||
|
||||
#ifdef TRACY_FIBERS
|
||||
TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::EnterFiber( fiber ); }
|
||||
TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); }
|
||||
#endif
|
||||
|
||||
# ifdef TRACY_MANUAL_LIFETIME
|
||||
TRACY_API void ___tracy_startup_profiler( void )
|
||||
{
|
||||
tracy::StartupProfiler();
|
||||
}
|
||||
|
||||
TRACY_API void ___tracy_shutdown_profiler( void )
|
||||
{
|
||||
tracy::ShutdownProfiler();
|
||||
}
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
105
Source/ThirdParty/tracy/client/TracyProfiler.hpp
vendored
105
Source/ThirdParty/tracy/client/TracyProfiler.hpp
vendored
@@ -10,6 +10,7 @@
|
||||
#include "tracy_concurrentqueue.h"
|
||||
#include "tracy_SPSCQueue.h"
|
||||
#include "TracyCallstack.hpp"
|
||||
#include "TracySysPower.hpp"
|
||||
#include "TracySysTime.hpp"
|
||||
#include "TracyFastVector.hpp"
|
||||
#include "../common/TracyQueue.hpp"
|
||||
@@ -190,7 +191,22 @@ public:
|
||||
if( HardwareSupportsInvariantTSC() )
|
||||
{
|
||||
uint64_t rax, rdx;
|
||||
#ifdef TRACY_PATCHABLE_NOPSLEDS
|
||||
// Some external tooling (such as rr) wants to patch our rdtsc and replace it by a
|
||||
// branch to control the external input seen by a program. This kind of patching is
|
||||
// not generally possible depending on the surrounding code and can lead to significant
|
||||
// slowdowns if the compiler generated unlucky code and rr and tracy are used together.
|
||||
// To avoid this, use the rr-safe `nopl 0(%rax, %rax, 1); rdtsc` instruction sequence,
|
||||
// which rr promises will be patchable independent of the surrounding code.
|
||||
asm volatile (
|
||||
// This is nopl 0(%rax, %rax, 1), but assemblers are inconsistent about whether
|
||||
// they emit that as a 4 or 5 byte sequence and we need to be guaranteed to use
|
||||
// the 5 byte one.
|
||||
".byte 0x0f, 0x1f, 0x44, 0x00, 0x00\n\t"
|
||||
"rdtsc" : "=a" (rax), "=d" (rdx) );
|
||||
#else
|
||||
asm volatile ( "rdtsc" : "=a" (rax), "=d" (rdx) );
|
||||
#endif
|
||||
return (int64_t)(( rdx << 32 ) + rax);
|
||||
}
|
||||
# else
|
||||
@@ -240,6 +256,30 @@ public:
|
||||
p.m_serialLock.unlock();
|
||||
}
|
||||
|
||||
static void SendFrameMark( const char* name );
|
||||
static void SendFrameMark( const char* name, QueueType type );
|
||||
static void SendFrameImage( const void* image, uint16_t w, uint16_t h, uint8_t offset, bool flip );
|
||||
static void PlotData( const char* name, int64_t val );
|
||||
static void PlotData( const char* name, float val );
|
||||
static void PlotData( const char* name, double val );
|
||||
static void ConfigurePlot( const char* name, PlotFormatType type, bool step, bool fill, uint32_t color );
|
||||
static void Message( const char* txt, size_t size, int callstack );
|
||||
static void Message( const char* txt, int callstack );
|
||||
static void MessageColor( const char* txt, size_t size, uint32_t color, int callstack );
|
||||
static void MessageColor( const char* txt, uint32_t color, int callstack );
|
||||
static void MessageAppInfo( const char* txt, size_t size );
|
||||
static void MemAlloc( const void* ptr, size_t size, bool secure );
|
||||
static void MemFree( const void* ptr, bool secure );
|
||||
static void MemAllocCallstack( const void* ptr, size_t size, int depth, bool secure );
|
||||
static void MemFreeCallstack( const void* ptr, int depth, bool secure );
|
||||
static void MemAllocNamed( const void* ptr, size_t size, bool secure, const char* name );
|
||||
static void MemFreeNamed( const void* ptr, bool secure, const char* name );
|
||||
static void MemAllocCallstackNamed( const void* ptr, size_t size, int depth, bool secure, const char* name );
|
||||
static void MemFreeCallstackNamed( const void* ptr, int depth, bool secure, const char* name );
|
||||
static void SendCallstack( int depth );
|
||||
static void ParameterRegister( ParameterCallback cb, void* data );
|
||||
static void ParameterSetup( uint32_t idx, const char* name, bool isBool, int32_t val );
|
||||
|
||||
static tracy_force_inline void SourceCallbackRegister( SourceContentsCallback cb, void* data )
|
||||
{
|
||||
auto& profiler = GetProfiler();
|
||||
@@ -264,31 +304,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
static void SendFrameMark( const char* name );
|
||||
static void SendFrameMark( const char* name, QueueType type );
|
||||
static void SendFrameImage( const void* image, uint16_t w, uint16_t h, uint8_t offset, bool flip );
|
||||
static void PlotData( const char* name, int64_t val );
|
||||
static void PlotData( const char* name, float val );
|
||||
static void PlotData( const char* name, double val );
|
||||
static void ConfigurePlot( const char* name, PlotFormatType type, bool step, bool fill, uint32_t color );
|
||||
static void Message( const char* txt, size_t size, int callstack );
|
||||
static void Message( const char* txt, int callstack );
|
||||
static void MessageColor( const char* txt, size_t size, uint32_t color, int callstack );
|
||||
static void MessageColor( const char* txt, uint32_t color, int callstack );
|
||||
static void MessageAppInfo( const char* txt, size_t size );
|
||||
static void MemAlloc( const void* ptr, size_t size, bool secure );
|
||||
static void MemFree( const void* ptr, bool secure );
|
||||
static void MemAllocCallstack( const void* ptr, size_t size, int depth, bool secure );
|
||||
static void MemFreeCallstack( const void* ptr, int depth, bool secure );
|
||||
static void MemAllocNamed( const void* ptr, size_t size, bool secure, const char* name );
|
||||
static void MemFreeNamed( const void* ptr, bool secure, const char* name );
|
||||
static void MemAllocCallstackNamed( const void* ptr, size_t size, int depth, bool secure, const char* name );
|
||||
static void MemFreeCallstackNamed( const void* ptr, int depth, bool secure, const char* name );
|
||||
static void SendCallstack( int depth );
|
||||
static void ParameterRegister( ParameterCallback cb );
|
||||
static void ParameterRegister( ParameterCallback cb, void* data );
|
||||
static void ParameterSetup( uint32_t idx, const char* name, bool isBool, int32_t val );
|
||||
|
||||
void SendCallstack( int depth, const char* skipBefore );
|
||||
static void CutCallstack( void* callstack, const char* skipBefore );
|
||||
|
||||
@@ -299,6 +314,13 @@ public:
|
||||
return m_isConnected.load( std::memory_order_acquire );
|
||||
}
|
||||
|
||||
tracy_force_inline void SetProgramName( const char* name )
|
||||
{
|
||||
m_programNameLock.lock();
|
||||
m_programName = name;
|
||||
m_programNameLock.unlock();
|
||||
}
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
tracy_force_inline uint64_t ConnectionId() const
|
||||
{
|
||||
@@ -347,13 +369,13 @@ public:
|
||||
|
||||
static tracy_force_inline uint64_t AllocSourceLocation( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz )
|
||||
{
|
||||
return AllocSourceLocation( line, source, sourceSz, function, functionSz, (const char*)nullptr, 0 );
|
||||
return AllocSourceLocation( line, source, sourceSz, function, functionSz, nullptr, 0 );
|
||||
}
|
||||
|
||||
static tracy_force_inline uint64_t AllocSourceLocation( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz )
|
||||
{
|
||||
const auto sz32 = uint32_t( 2 + 4 + 4 + functionSz + 1 + sourceSz + 1 + nameSz );
|
||||
assert( sz32 <= std::numeric_limits<uint16_t>::max() );
|
||||
assert( sz32 <= (std::numeric_limits<uint16_t>::max)() );
|
||||
const auto sz = uint16_t( sz32 );
|
||||
auto ptr = (char*)tracy_malloc( sz );
|
||||
memcpy( ptr, &sz, 2 );
|
||||
@@ -370,28 +392,6 @@ public:
|
||||
return uint64_t( ptr );
|
||||
}
|
||||
|
||||
static tracy_force_inline uint64_t AllocSourceLocation( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const Char* name, size_t nameSz )
|
||||
{
|
||||
const auto sz32 = uint32_t( 2 + 4 + 4 + functionSz + 1 + sourceSz + 1 + nameSz );
|
||||
assert( sz32 <= std::numeric_limits<uint16_t>::max() );
|
||||
const auto sz = uint16_t( sz32 );
|
||||
auto ptr = (char*)tracy_malloc( sz );
|
||||
memcpy( ptr, &sz, 2 );
|
||||
memset( ptr + 2, 0, 4 );
|
||||
memcpy( ptr + 6, &line, 4 );
|
||||
memcpy( ptr + 10, function, functionSz );
|
||||
ptr[10 + functionSz] = '\0';
|
||||
memcpy( ptr + 10 + functionSz + 1, source, sourceSz );
|
||||
ptr[10 + functionSz + 1 + sourceSz] = '\0';
|
||||
if( nameSz != 0 )
|
||||
{
|
||||
char* dst = ptr + 10 + functionSz + 1 + sourceSz + 1;
|
||||
for ( size_t i = 0; i < nameSz; i++)
|
||||
dst[i] = (char)name[i];
|
||||
}
|
||||
return uint64_t( ptr );
|
||||
}
|
||||
|
||||
private:
|
||||
enum class DequeueStatus { DataDequeued, ConnectionLost, QueueEmpty };
|
||||
enum class ThreadCtxStatus { Same, Changed, ConnectionLost };
|
||||
@@ -586,6 +586,10 @@ private:
|
||||
void ProcessSysTime() {}
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_HAS_SYSPOWER
|
||||
SysPower m_sysPower;
|
||||
#endif
|
||||
|
||||
ParameterCallback m_paramCallback;
|
||||
void* m_paramCallbackData;
|
||||
SourceContentsCallback m_sourceCallback;
|
||||
@@ -604,6 +608,9 @@ private:
|
||||
} m_prevSignal;
|
||||
#endif
|
||||
bool m_crashHandlerInstalled;
|
||||
|
||||
const char* m_programName;
|
||||
TracyMutex m_programNameLock;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
28
Source/ThirdParty/tracy/client/TracyScoped.hpp
vendored
28
Source/ThirdParty/tracy/client/TracyScoped.hpp
vendored
@@ -20,19 +20,7 @@ void ScopedZone::Begin(const SourceLocationData* srcloc)
|
||||
TracyLfqPrepare( QueueType::ZoneBegin );
|
||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
||||
TracyLfqCommit;
|
||||
}
|
||||
|
||||
void ScopedZone::Begin(uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const Char* name, size_t nameSz)
|
||||
{
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if (!GetProfiler().IsConnected()) return;
|
||||
#endif
|
||||
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLoc );
|
||||
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||
TracyLfqCommit;
|
||||
TracyQueueCommit( zoneBeginThread );
|
||||
}
|
||||
|
||||
void ScopedZone::End()
|
||||
@@ -42,7 +30,7 @@ void ScopedZone::End()
|
||||
#endif
|
||||
TracyLfqPrepare( QueueType::ZoneEnd );
|
||||
MemWrite( &item->zoneEnd.time, Profiler::GetTime() );
|
||||
TracyLfqCommit;
|
||||
TracyQueueCommit( zoneEndThread );
|
||||
}
|
||||
|
||||
ScopedZone::ScopedZone( const SourceLocationData* srcloc, bool is_active )
|
||||
@@ -132,7 +120,7 @@ ScopedZone::~ScopedZone()
|
||||
|
||||
void ScopedZone::Text( const char* txt, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
if( !m_active ) return;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||
@@ -147,7 +135,7 @@ void ScopedZone::Text( const char* txt, size_t size )
|
||||
|
||||
void ScopedZone::Text( const Char* txt, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
if( !m_active ) return;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||
@@ -163,7 +151,7 @@ void ScopedZone::Text( const Char* txt, size_t size )
|
||||
|
||||
void ScopedZone::Name( const char* txt, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
if( !m_active ) return;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||
@@ -178,7 +166,7 @@ void ScopedZone::Name( const char* txt, size_t size )
|
||||
|
||||
void ScopedZone::Name( const Char* txt, size_t size )
|
||||
{
|
||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||
if( !m_active ) return;
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||
@@ -199,9 +187,9 @@ void ScopedZone::Color( uint32_t color )
|
||||
if( GetProfiler().ConnectionId() != m_connectionId ) return;
|
||||
#endif
|
||||
TracyQueuePrepare( QueueType::ZoneColor );
|
||||
MemWrite( &item->zoneColor.r, uint8_t( ( color ) & 0xFF ) );
|
||||
MemWrite( &item->zoneColor.b, uint8_t( ( color ) & 0xFF ) );
|
||||
MemWrite( &item->zoneColor.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
||||
MemWrite( &item->zoneColor.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||
MemWrite( &item->zoneColor.r, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||
TracyQueueCommit( zoneColorThread );
|
||||
}
|
||||
|
||||
|
||||
164
Source/ThirdParty/tracy/client/TracySysPower.cpp
vendored
Normal file
164
Source/ThirdParty/tracy/client/TracySysPower.cpp
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
#include "TracySysPower.hpp"
|
||||
|
||||
#ifdef TRACY_HAS_SYSPOWER
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <chrono>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "TracyDebug.hpp"
|
||||
#include "TracyProfiler.hpp"
|
||||
#include "../common/TracyAlloc.hpp"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
SysPower::SysPower()
|
||||
: m_domains( 4 )
|
||||
, m_lastTime( 0 )
|
||||
{
|
||||
ScanDirectory( "/sys/devices/virtual/powercap/intel-rapl", -1 );
|
||||
}
|
||||
|
||||
SysPower::~SysPower()
|
||||
{
|
||||
for( auto& v : m_domains )
|
||||
{
|
||||
fclose( v.handle );
|
||||
// Do not release v.name, as it may be still needed
|
||||
}
|
||||
}
|
||||
|
||||
void SysPower::Tick()
|
||||
{
|
||||
auto t = std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||
if( t - m_lastTime > 10000000 ) // 10 ms
|
||||
{
|
||||
m_lastTime = t;
|
||||
for( auto& v : m_domains )
|
||||
{
|
||||
char tmp[32];
|
||||
if( fread( tmp, 1, 32, v.handle ) > 0 )
|
||||
{
|
||||
rewind( v.handle );
|
||||
auto p = (uint64_t)atoll( tmp );
|
||||
uint64_t delta;
|
||||
if( p >= v.value )
|
||||
{
|
||||
delta = p - v.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = v.overflow - v.value + p;
|
||||
}
|
||||
v.value = p;
|
||||
|
||||
TracyLfqPrepare( QueueType::SysPowerReport );
|
||||
MemWrite( &item->sysPower.time, Profiler::GetTime() );
|
||||
MemWrite( &item->sysPower.delta, delta );
|
||||
MemWrite( &item->sysPower.name, (uint64_t)v.name );
|
||||
TracyLfqCommit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SysPower::ScanDirectory( const char* path, int parent )
|
||||
{
|
||||
DIR* dir = opendir( path );
|
||||
if( !dir ) return;
|
||||
struct dirent* ent;
|
||||
uint64_t maxRange = 0;
|
||||
char* name = nullptr;
|
||||
FILE* handle = nullptr;
|
||||
while( ( ent = readdir( dir ) ) )
|
||||
{
|
||||
if( ent->d_type == DT_REG )
|
||||
{
|
||||
if( strcmp( ent->d_name, "max_energy_range_uj" ) == 0 )
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
snprintf( tmp, PATH_MAX, "%s/max_energy_range_uj", path );
|
||||
FILE* f = fopen( tmp, "r" );
|
||||
if( f )
|
||||
{
|
||||
fscanf( f, "%" PRIu64, &maxRange );
|
||||
fclose( f );
|
||||
}
|
||||
}
|
||||
else if( strcmp( ent->d_name, "name" ) == 0 )
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
snprintf( tmp, PATH_MAX, "%s/name", path );
|
||||
FILE* f = fopen( tmp, "r" );
|
||||
if( f )
|
||||
{
|
||||
char ntmp[128];
|
||||
if( fgets( ntmp, 128, f ) )
|
||||
{
|
||||
// Last character is newline, skip it
|
||||
const auto sz = strlen( ntmp ) - 1;
|
||||
if( parent < 0 )
|
||||
{
|
||||
name = (char*)tracy_malloc( sz + 1 );
|
||||
memcpy( name, ntmp, sz );
|
||||
name[sz] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto p = m_domains[parent];
|
||||
const auto psz = strlen( p.name );
|
||||
name = (char*)tracy_malloc( psz + sz + 2 );
|
||||
memcpy( name, p.name, psz );
|
||||
name[psz] = ':';
|
||||
memcpy( name+psz+1, ntmp, sz );
|
||||
name[psz+sz+1] = '\0';
|
||||
}
|
||||
}
|
||||
fclose( f );
|
||||
}
|
||||
}
|
||||
else if( strcmp( ent->d_name, "energy_uj" ) == 0 )
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
snprintf( tmp, PATH_MAX, "%s/energy_uj", path );
|
||||
handle = fopen( tmp, "r" );
|
||||
}
|
||||
}
|
||||
if( name && handle && maxRange > 0 ) break;
|
||||
}
|
||||
if( name && handle && maxRange > 0 )
|
||||
{
|
||||
parent = (int)m_domains.size();
|
||||
Domain* domain = m_domains.push_next();
|
||||
domain->value = 0;
|
||||
domain->overflow = maxRange;
|
||||
domain->handle = handle;
|
||||
domain->name = name;
|
||||
TracyDebug( "Power domain id %i, %s found at %s\n", parent, name, path );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( name ) tracy_free( name );
|
||||
if( handle ) fclose( handle );
|
||||
}
|
||||
|
||||
rewinddir( dir );
|
||||
while( ( ent = readdir( dir ) ) )
|
||||
{
|
||||
if( ent->d_type == DT_DIR && strncmp( ent->d_name, "intel-rapl:", 11 ) == 0 )
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
snprintf( tmp, PATH_MAX, "%s/%s", path, ent->d_name );
|
||||
ScanDirectory( tmp, parent );
|
||||
}
|
||||
}
|
||||
closedir( dir );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
44
Source/ThirdParty/tracy/client/TracySysPower.hpp
vendored
Normal file
44
Source/ThirdParty/tracy/client/TracySysPower.hpp
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef __TRACYSYSPOWER_HPP__
|
||||
#define __TRACYSYSPOWER_HPP__
|
||||
|
||||
#if defined __linux__
|
||||
# define TRACY_HAS_SYSPOWER
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_HAS_SYSPOWER
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "TracyFastVector.hpp"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
class SysPower
|
||||
{
|
||||
struct Domain
|
||||
{
|
||||
uint64_t value;
|
||||
uint64_t overflow;
|
||||
FILE* handle;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
public:
|
||||
SysPower();
|
||||
~SysPower();
|
||||
|
||||
void Tick();
|
||||
|
||||
private:
|
||||
void ScanDirectory( const char* path, int parent );
|
||||
|
||||
FastVector<Domain> m_domains;
|
||||
uint64_t m_lastTime;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
49
Source/ThirdParty/tracy/client/TracySysTrace.cpp
vendored
49
Source/ThirdParty/tracy/client/TracySysTrace.cpp
vendored
@@ -409,6 +409,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef TRACY_NO_SAMPLING
|
||||
if( isOs64Bit )
|
||||
{
|
||||
CLASSIC_EVENT_ID stackId[2] = {};
|
||||
@@ -423,6 +424,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
WCHAR KernelLoggerName[sizeof( KERNEL_LOGGER_NAME )];
|
||||
@@ -768,6 +770,13 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
||||
TracyDebug( "sched_wakeup id: %i\n", wakeupId );
|
||||
TracyDebug( "drm_vblank_event id: %i\n", vsyncId );
|
||||
|
||||
#ifdef TRACY_NO_SAMPLING
|
||||
const bool noSoftwareSampling = true;
|
||||
#else
|
||||
const char* noSoftwareSamplingEnv = GetEnvVar( "TRACY_NO_SAMPLING" );
|
||||
const bool noSoftwareSampling = noSoftwareSamplingEnv && noSoftwareSamplingEnv[0] == '1';
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_NO_SAMPLE_RETIREMENT
|
||||
const bool noRetirement = true;
|
||||
#else
|
||||
@@ -837,28 +846,31 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
||||
pe.clockid = CLOCK_MONOTONIC_RAW;
|
||||
#endif
|
||||
|
||||
TracyDebug( "Setup software sampling\n" );
|
||||
ProbePreciseIp( pe, currentPid );
|
||||
for( int i=0; i<s_numCpus; i++ )
|
||||
if( !noSoftwareSampling )
|
||||
{
|
||||
int fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
|
||||
if( fd == -1 )
|
||||
TracyDebug( "Setup software sampling\n" );
|
||||
ProbePreciseIp( pe, currentPid );
|
||||
for( int i=0; i<s_numCpus; i++ )
|
||||
{
|
||||
pe.exclude_kernel = 1;
|
||||
ProbePreciseIp( pe, currentPid );
|
||||
fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
|
||||
int fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
|
||||
if( fd == -1 )
|
||||
{
|
||||
TracyDebug( " Failed to setup!\n");
|
||||
break;
|
||||
pe.exclude_kernel = 1;
|
||||
ProbePreciseIp( pe, currentPid );
|
||||
fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
|
||||
if( fd == -1 )
|
||||
{
|
||||
TracyDebug( " Failed to setup!\n");
|
||||
break;
|
||||
}
|
||||
TracyDebug( " No access to kernel samples\n" );
|
||||
}
|
||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
|
||||
if( s_ring[s_numBuffers].IsValid() )
|
||||
{
|
||||
s_numBuffers++;
|
||||
TracyDebug( " Core %i ok\n", i );
|
||||
}
|
||||
TracyDebug( " No access to kernel samples\n" );
|
||||
}
|
||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
|
||||
if( s_ring[s_numBuffers].IsValid() )
|
||||
{
|
||||
s_numBuffers++;
|
||||
TracyDebug( " Core %i ok\n", i );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1263,8 +1275,7 @@ void SysTraceWorker( void* ptr )
|
||||
type = QueueType::HwSampleBranchMiss;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
abort();
|
||||
}
|
||||
|
||||
TracyLfqPrepare( type );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Provides a C++11 implementation of a multi-producer, multi-consumer lock-free queue.
|
||||
// Provides a C++11 implementation of a multi-producer, multi-consumer lock-free queue.
|
||||
// An overview, including benchmark results, is provided here:
|
||||
// http://moodycamel.com/blog/2014/a-fast-general-purpose-lock-free-queue-for-c++
|
||||
// The full design is also described in excruciating detail at:
|
||||
@@ -209,19 +209,14 @@ namespace details
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4554)
|
||||
#endif
|
||||
template<typename T>
|
||||
static inline bool circular_less_than(T a, T b)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value && !std::numeric_limits<T>::is_signed, "circular_less_than is intended to be used only with unsigned integer types");
|
||||
return static_cast<T>(a - b) > (static_cast<T>(static_cast<T>(1) << static_cast<T>(sizeof(T) * CHAR_BIT - 1)));
|
||||
return static_cast<T>(a - b) > static_cast<T>(static_cast<T>(1) << (static_cast<T>(sizeof(T) * CHAR_BIT - 1)));
|
||||
// Note: extra parens around rhs of operator<< is MSVC bug: https://developercommunity2.visualstudio.com/t/C4554-triggers-when-both-lhs-and-rhs-is/10034931
|
||||
// silencing the bug requires #pragma warning(disable: 4554) around the calling code and has no effect when done here.
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<typename U>
|
||||
static inline char* align_for(char* ptr)
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
# if defined(__APPLE__)
|
||||
# include <TargetConditionals.h>
|
||||
# if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
|
||||
# include <mach/mach_vm.h>
|
||||
# include <mach/mach.h>
|
||||
# include <mach/vm_statistics.h>
|
||||
# endif
|
||||
# include <pthread.h>
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace tracy
|
||||
|
||||
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
||||
|
||||
enum : uint32_t { ProtocolVersion = 63 };
|
||||
enum : uint32_t { ProtocolVersion = 64 };
|
||||
enum : uint16_t { BroadcastVersion = 3 };
|
||||
|
||||
using lz4sz_t = uint32_t;
|
||||
|
||||
enum { TargetFrameSize = 256 * 1024 };
|
||||
enum { LZ4Size = Lz4CompressBound( TargetFrameSize ) };
|
||||
static_assert( LZ4Size <= std::numeric_limits<lz4sz_t>::max(), "LZ4Size greater than lz4sz_t" );
|
||||
static_assert( LZ4Size <= (std::numeric_limits<lz4sz_t>::max)(), "LZ4Size greater than lz4sz_t" );
|
||||
static_assert( TargetFrameSize * 2 >= 64 * 1024, "Not enough space for LZ4 stream buffer" );
|
||||
|
||||
enum { HandshakeShibbolethSize = 8 };
|
||||
|
||||
32
Source/ThirdParty/tracy/common/TracyQueue.hpp
vendored
32
Source/ThirdParty/tracy/common/TracyQueue.hpp
vendored
@@ -1,6 +1,7 @@
|
||||
#ifndef __TRACYQUEUE_HPP__
|
||||
#define __TRACYQUEUE_HPP__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace tracy
|
||||
@@ -89,6 +90,7 @@ enum class QueueType : uint8_t
|
||||
GpuNewContext,
|
||||
CallstackFrame,
|
||||
SysTimeReport,
|
||||
SysPowerReport,
|
||||
TidToPid,
|
||||
HwSampleCpuCycle,
|
||||
HwSampleInstructionRetired,
|
||||
@@ -165,9 +167,9 @@ struct QueueZoneValidationThread : public QueueZoneValidation
|
||||
|
||||
struct QueueZoneColor
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
};
|
||||
|
||||
struct QueueZoneColorThread : public QueueZoneColor
|
||||
@@ -221,9 +223,9 @@ struct QueueSourceLocation
|
||||
uint64_t function; // ptr
|
||||
uint64_t file; // ptr
|
||||
uint32_t line;
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
};
|
||||
|
||||
struct QueueZoneTextFat
|
||||
@@ -324,7 +326,7 @@ struct QueuePlotDataInt : public QueuePlotDataBase
|
||||
int64_t val;
|
||||
};
|
||||
|
||||
struct QueuePlotDataFloat : public QueuePlotDataBase
|
||||
struct QueuePlotDataFloat : public QueuePlotDataBase
|
||||
{
|
||||
float val;
|
||||
};
|
||||
@@ -341,9 +343,9 @@ struct QueueMessage
|
||||
|
||||
struct QueueMessageColor : public QueueMessage
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
};
|
||||
|
||||
struct QueueMessageLiteral : public QueueMessage
|
||||
@@ -562,6 +564,13 @@ struct QueueSysTime
|
||||
float sysTime;
|
||||
};
|
||||
|
||||
struct QueueSysPower
|
||||
{
|
||||
int64_t time;
|
||||
uint64_t delta;
|
||||
uint64_t name; // ptr
|
||||
};
|
||||
|
||||
struct QueueContextSwitch
|
||||
{
|
||||
int64_t time;
|
||||
@@ -590,6 +599,13 @@ struct QueueHwSample
|
||||
int64_t time;
|
||||
};
|
||||
|
||||
enum class PlotFormatType : uint8_t
|
||||
{
|
||||
Number,
|
||||
Memory,
|
||||
Percentage
|
||||
};
|
||||
|
||||
struct QueuePlotConfig
|
||||
{
|
||||
uint64_t name; // ptr
|
||||
@@ -721,6 +737,7 @@ struct QueueItem
|
||||
QueueCrashReport crashReport;
|
||||
QueueCrashReportThread crashReportThread;
|
||||
QueueSysTime sysTime;
|
||||
QueueSysPower sysPower;
|
||||
QueueContextSwitch contextSwitch;
|
||||
QueueThreadWakeup threadWakeup;
|
||||
QueueTidToPid tidToPid;
|
||||
@@ -824,6 +841,7 @@ static constexpr size_t QueueDataSize[] = {
|
||||
sizeof( QueueHeader ) + sizeof( QueueGpuNewContext ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstackFrame ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueSysTime ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueSysPower ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueTidToPid ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueHwSample ), // cpu cycle
|
||||
sizeof( QueueHeader ) + sizeof( QueueHwSample ), // instruction retired
|
||||
|
||||
@@ -353,7 +353,7 @@ int Socket::Recv( void* _buf, int len, int timeout )
|
||||
}
|
||||
}
|
||||
|
||||
int Socket::ReadUpTo( void* _buf, int len, int timeout )
|
||||
int Socket::ReadUpTo( void* _buf, int len )
|
||||
{
|
||||
const auto sock = m_sock.load( std::memory_order_relaxed );
|
||||
auto buf = (char*)_buf;
|
||||
@@ -678,10 +678,10 @@ bool UdpListen::Listen( uint16_t port )
|
||||
#endif
|
||||
#if defined _WIN32
|
||||
unsigned long reuse = 1;
|
||||
setsockopt( m_sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse, sizeof( reuse ) );
|
||||
setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse, sizeof( reuse ) );
|
||||
#else
|
||||
int reuse = 1;
|
||||
setsockopt( m_sock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof( reuse ) );
|
||||
setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof( reuse ) );
|
||||
#endif
|
||||
#if defined _WIN32
|
||||
unsigned long broadcast = 1;
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
int Send( const void* buf, int len );
|
||||
int GetSendBufSize();
|
||||
|
||||
int ReadUpTo( void* buf, int len, int timeout );
|
||||
int ReadUpTo( void* buf, int len );
|
||||
bool Read( void* buf, int len, int timeout );
|
||||
|
||||
template<typename ShouldExit>
|
||||
|
||||
97
Source/ThirdParty/tracy/common/TracySystem.cpp
vendored
97
Source/ThirdParty/tracy/common/TracySystem.cpp
vendored
@@ -205,61 +205,60 @@ TRACY_API const char* GetThreadName( uint32_t id )
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
#else
|
||||
# if defined _WIN32
|
||||
# ifdef TRACY_UWP
|
||||
static auto _GetThreadDescription = &::GetThreadDescription;
|
||||
# else
|
||||
static auto _GetThreadDescription = (t_GetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetThreadDescription" );
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined _WIN32
|
||||
# ifdef TRACY_UWP
|
||||
static auto _GetThreadDescription = &::GetThreadDescription;
|
||||
# else
|
||||
static auto _GetThreadDescription = (t_GetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetThreadDescription" );
|
||||
# endif
|
||||
if( _GetThreadDescription )
|
||||
{
|
||||
auto hnd = OpenThread( THREAD_QUERY_LIMITED_INFORMATION, FALSE, (DWORD)id );
|
||||
if( hnd != 0 )
|
||||
{
|
||||
PWSTR tmp;
|
||||
_GetThreadDescription( hnd, &tmp );
|
||||
auto ret = wcstombs( buf, tmp, 256 );
|
||||
CloseHandle( hnd );
|
||||
if( ret != 0 )
|
||||
if( SUCCEEDED( _GetThreadDescription( hnd, &tmp ) ) )
|
||||
{
|
||||
return buf;
|
||||
auto ret = wcstombs( buf, tmp, 256 );
|
||||
CloseHandle( hnd );
|
||||
LocalFree( tmp );
|
||||
if( ret != static_cast<size_t>( -1 ) )
|
||||
{
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# elif defined __linux__
|
||||
int cs, fd;
|
||||
char path[32];
|
||||
# ifdef __ANDROID__
|
||||
int tid = gettid();
|
||||
# else
|
||||
int tid = (int) syscall( SYS_gettid );
|
||||
# endif
|
||||
snprintf( path, sizeof( path ), "/proc/self/task/%d/comm", tid );
|
||||
sprintf( buf, "%" PRIu32, id );
|
||||
# ifndef __ANDROID__
|
||||
pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &cs );
|
||||
# endif
|
||||
if ( ( fd = open( path, O_RDONLY ) ) > 0) {
|
||||
int len = read( fd, buf, 255 );
|
||||
if( len > 0 )
|
||||
{
|
||||
buf[len] = 0;
|
||||
if( len > 1 && buf[len-1] == '\n' )
|
||||
{
|
||||
buf[len-1] = 0;
|
||||
}
|
||||
}
|
||||
close( fd );
|
||||
}
|
||||
# ifndef __ANDROID__
|
||||
pthread_setcancelstate( cs, 0 );
|
||||
# endif
|
||||
return buf;
|
||||
# endif
|
||||
#elif defined __linux__
|
||||
int cs, fd;
|
||||
char path[32];
|
||||
snprintf( path, sizeof( path ), "/proc/self/task/%d/comm", id );
|
||||
sprintf( buf, "%" PRIu32, id );
|
||||
# ifndef __ANDROID__
|
||||
pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &cs );
|
||||
# endif
|
||||
if ( ( fd = open( path, O_RDONLY ) ) > 0) {
|
||||
int len = read( fd, buf, 255 );
|
||||
if( len > 0 )
|
||||
{
|
||||
buf[len] = 0;
|
||||
if( len > 1 && buf[len-1] == '\n' )
|
||||
{
|
||||
buf[len-1] = 0;
|
||||
}
|
||||
}
|
||||
close( fd );
|
||||
}
|
||||
# ifndef __ANDROID__
|
||||
pthread_setcancelstate( cs, 0 );
|
||||
# endif
|
||||
return buf;
|
||||
#endif
|
||||
sprintf( buf, "%" PRIu32, id );
|
||||
return buf;
|
||||
|
||||
sprintf( buf, "%" PRIu32, id );
|
||||
return buf;
|
||||
}
|
||||
|
||||
TRACY_API const char* GetEnvVar( const char* name )
|
||||
@@ -295,3 +294,13 @@ TRACY_API const char* GetEnvVar( const char* name )
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TRACY_API void ___tracy_set_thread_name( const char* name ) { tracy::SetThreadName( name ); }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -25,13 +25,6 @@
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
enum class PlotFormatType : uint8_t
|
||||
{
|
||||
Number,
|
||||
Memory,
|
||||
Percentage
|
||||
};
|
||||
|
||||
typedef void(*ParameterCallback)( void* data, uint32_t idx, int32_t val );
|
||||
|
||||
struct TRACY_API SourceLocationData
|
||||
@@ -47,7 +40,6 @@ class TRACY_API ScopedZone
|
||||
{
|
||||
public:
|
||||
static void Begin( const SourceLocationData* srcloc );
|
||||
static void Begin( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const Char* name, size_t nameSz );
|
||||
static void End();
|
||||
|
||||
ScopedZone( const ScopedZone& ) = delete;
|
||||
@@ -68,7 +60,6 @@ public:
|
||||
void Name( const Char* txt, size_t size );
|
||||
void Color( uint32_t color );
|
||||
void Value( uint64_t value );
|
||||
bool IsActive() const;
|
||||
|
||||
private:
|
||||
const bool m_active;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace tracy
|
||||
namespace Version
|
||||
{
|
||||
enum { Major = 0 };
|
||||
enum { Minor = 9 };
|
||||
enum { Minor = 10 };
|
||||
enum { Patch = 0 };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#include <limits.h>
|
||||
#if defined(__linux__) && !defined(__GLIBC__) && !defined(__WORDSIZE)
|
||||
// include __WORDSIZE headers for musl
|
||||
# include <bits/reg.h>
|
||||
#endif
|
||||
#if __WORDSIZE == 64
|
||||
# define BACKTRACE_ELF_SIZE 64
|
||||
#else
|
||||
|
||||
88
Source/ThirdParty/tracy/libbacktrace/dwarf.cpp
vendored
88
Source/ThirdParty/tracy/libbacktrace/dwarf.cpp
vendored
@@ -473,7 +473,7 @@ enum attr_val_encoding
|
||||
/* An address. */
|
||||
ATTR_VAL_ADDRESS,
|
||||
/* An index into the .debug_addr section, whose value is relative to
|
||||
* the DW_AT_addr_base attribute of the compilation unit. */
|
||||
the DW_AT_addr_base attribute of the compilation unit. */
|
||||
ATTR_VAL_ADDRESS_INDEX,
|
||||
/* A unsigned integer. */
|
||||
ATTR_VAL_UINT,
|
||||
@@ -611,8 +611,8 @@ struct function
|
||||
struct function_addrs
|
||||
{
|
||||
/* Range is LOW <= PC < HIGH. */
|
||||
uint64_t low;
|
||||
uint64_t high;
|
||||
uintptr_t low;
|
||||
uintptr_t high;
|
||||
/* Function for this address range. */
|
||||
struct function *function;
|
||||
};
|
||||
@@ -693,8 +693,8 @@ struct unit
|
||||
struct unit_addrs
|
||||
{
|
||||
/* Range is LOW <= PC < HIGH. */
|
||||
uint64_t low;
|
||||
uint64_t high;
|
||||
uintptr_t low;
|
||||
uintptr_t high;
|
||||
/* Compilation unit for this address range. */
|
||||
struct unit *u;
|
||||
};
|
||||
@@ -1431,7 +1431,7 @@ resolve_addr_index (const struct dwarf_sections *dwarf_sections,
|
||||
uint64_t addr_base, int addrsize, int is_bigendian,
|
||||
uint64_t addr_index,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
uint64_t *address)
|
||||
uintptr_t *address)
|
||||
{
|
||||
uint64_t offset;
|
||||
struct dwarf_buf addr_buf;
|
||||
@@ -1452,7 +1452,7 @@ resolve_addr_index (const struct dwarf_sections *dwarf_sections,
|
||||
addr_buf.data = data;
|
||||
addr_buf.reported_underflow = 0;
|
||||
|
||||
*address = read_address (&addr_buf, addrsize);
|
||||
*address = (uintptr_t) read_address (&addr_buf, addrsize);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1531,7 +1531,7 @@ function_addrs_search (const void *vkey, const void *ventry)
|
||||
|
||||
static int
|
||||
add_unit_addr (struct backtrace_state *state, void *rdata,
|
||||
uint64_t lowpc, uint64_t highpc,
|
||||
uintptr_t lowpc, uintptr_t highpc,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
void *pvec)
|
||||
{
|
||||
@@ -1867,10 +1867,10 @@ lookup_abbrev (struct abbrevs *abbrevs, uint64_t code,
|
||||
lowpc/highpc is set or ranges is set. */
|
||||
|
||||
struct pcrange {
|
||||
uint64_t lowpc; /* The low PC value. */
|
||||
uintptr_t lowpc; /* The low PC value. */
|
||||
int have_lowpc; /* Whether a low PC value was found. */
|
||||
int lowpc_is_addr_index; /* Whether lowpc is in .debug_addr. */
|
||||
uint64_t highpc; /* The high PC value. */
|
||||
uintptr_t highpc; /* The high PC value. */
|
||||
int have_highpc; /* Whether a high PC value was found. */
|
||||
int highpc_is_relative; /* Whether highpc is relative to lowpc. */
|
||||
int highpc_is_addr_index; /* Whether highpc is in .debug_addr. */
|
||||
@@ -1890,12 +1890,12 @@ update_pcrange (const struct attr* attr, const struct attr_val* val,
|
||||
case DW_AT_low_pc:
|
||||
if (val->encoding == ATTR_VAL_ADDRESS)
|
||||
{
|
||||
pcrange->lowpc = val->u.uint;
|
||||
pcrange->lowpc = (uintptr_t) val->u.uint;
|
||||
pcrange->have_lowpc = 1;
|
||||
}
|
||||
else if (val->encoding == ATTR_VAL_ADDRESS_INDEX)
|
||||
{
|
||||
pcrange->lowpc = val->u.uint;
|
||||
pcrange->lowpc = (uintptr_t) val->u.uint;
|
||||
pcrange->have_lowpc = 1;
|
||||
pcrange->lowpc_is_addr_index = 1;
|
||||
}
|
||||
@@ -1904,18 +1904,18 @@ update_pcrange (const struct attr* attr, const struct attr_val* val,
|
||||
case DW_AT_high_pc:
|
||||
if (val->encoding == ATTR_VAL_ADDRESS)
|
||||
{
|
||||
pcrange->highpc = val->u.uint;
|
||||
pcrange->highpc = (uintptr_t) val->u.uint;
|
||||
pcrange->have_highpc = 1;
|
||||
}
|
||||
else if (val->encoding == ATTR_VAL_UINT)
|
||||
{
|
||||
pcrange->highpc = val->u.uint;
|
||||
pcrange->highpc = (uintptr_t) val->u.uint;
|
||||
pcrange->have_highpc = 1;
|
||||
pcrange->highpc_is_relative = 1;
|
||||
}
|
||||
else if (val->encoding == ATTR_VAL_ADDRESS_INDEX)
|
||||
{
|
||||
pcrange->highpc = val->u.uint;
|
||||
pcrange->highpc = (uintptr_t) val->u.uint;
|
||||
pcrange->have_highpc = 1;
|
||||
pcrange->highpc_is_addr_index = 1;
|
||||
}
|
||||
@@ -1950,16 +1950,16 @@ add_low_high_range (struct backtrace_state *state,
|
||||
uintptr_t base_address, int is_bigendian,
|
||||
struct unit *u, const struct pcrange *pcrange,
|
||||
int (*add_range) (struct backtrace_state *state,
|
||||
void *rdata, uint64_t lowpc,
|
||||
uint64_t highpc,
|
||||
void *rdata, uintptr_t lowpc,
|
||||
uintptr_t highpc,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data, void *vec),
|
||||
void *rdata,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
void *vec)
|
||||
{
|
||||
uint64_t lowpc;
|
||||
uint64_t highpc;
|
||||
uintptr_t lowpc;
|
||||
uintptr_t highpc;
|
||||
|
||||
lowpc = pcrange->lowpc;
|
||||
if (pcrange->lowpc_is_addr_index)
|
||||
@@ -1997,10 +1997,10 @@ add_ranges_from_ranges (
|
||||
struct backtrace_state *state,
|
||||
const struct dwarf_sections *dwarf_sections,
|
||||
uintptr_t base_address, int is_bigendian,
|
||||
struct unit *u, uint64_t base,
|
||||
struct unit *u, uintptr_t base,
|
||||
const struct pcrange *pcrange,
|
||||
int (*add_range) (struct backtrace_state *state, void *rdata,
|
||||
uint64_t lowpc, uint64_t highpc,
|
||||
uintptr_t lowpc, uintptr_t highpc,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
void *vec),
|
||||
void *rdata,
|
||||
@@ -2039,12 +2039,12 @@ add_ranges_from_ranges (
|
||||
break;
|
||||
|
||||
if (is_highest_address (low, u->addrsize))
|
||||
base = high;
|
||||
base = (uintptr_t) high;
|
||||
else
|
||||
{
|
||||
if (!add_range (state, rdata,
|
||||
low + base + base_address,
|
||||
high + base + base_address,
|
||||
(uintptr_t) low + base + base_address,
|
||||
(uintptr_t) high + base + base_address,
|
||||
error_callback, data, vec))
|
||||
return 0;
|
||||
}
|
||||
@@ -2064,10 +2064,10 @@ add_ranges_from_rnglists (
|
||||
struct backtrace_state *state,
|
||||
const struct dwarf_sections *dwarf_sections,
|
||||
uintptr_t base_address, int is_bigendian,
|
||||
struct unit *u, uint64_t base,
|
||||
struct unit *u, uintptr_t base,
|
||||
const struct pcrange *pcrange,
|
||||
int (*add_range) (struct backtrace_state *state, void *rdata,
|
||||
uint64_t lowpc, uint64_t highpc,
|
||||
uintptr_t lowpc, uintptr_t highpc,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
void *vec),
|
||||
void *rdata,
|
||||
@@ -2133,8 +2133,8 @@ add_ranges_from_rnglists (
|
||||
case DW_RLE_startx_endx:
|
||||
{
|
||||
uint64_t index;
|
||||
uint64_t low;
|
||||
uint64_t high;
|
||||
uintptr_t low;
|
||||
uintptr_t high;
|
||||
|
||||
index = read_uleb128 (&rnglists_buf);
|
||||
if (!resolve_addr_index (dwarf_sections, u->addr_base,
|
||||
@@ -2156,8 +2156,8 @@ add_ranges_from_rnglists (
|
||||
case DW_RLE_startx_length:
|
||||
{
|
||||
uint64_t index;
|
||||
uint64_t low;
|
||||
uint64_t length;
|
||||
uintptr_t low;
|
||||
uintptr_t length;
|
||||
|
||||
index = read_uleb128 (&rnglists_buf);
|
||||
if (!resolve_addr_index (dwarf_sections, u->addr_base,
|
||||
@@ -2187,16 +2187,16 @@ add_ranges_from_rnglists (
|
||||
break;
|
||||
|
||||
case DW_RLE_base_address:
|
||||
base = read_address (&rnglists_buf, u->addrsize);
|
||||
base = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
||||
break;
|
||||
|
||||
case DW_RLE_start_end:
|
||||
{
|
||||
uint64_t low;
|
||||
uint64_t high;
|
||||
uintptr_t low;
|
||||
uintptr_t high;
|
||||
|
||||
low = read_address (&rnglists_buf, u->addrsize);
|
||||
high = read_address (&rnglists_buf, u->addrsize);
|
||||
low = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
||||
high = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
||||
if (!add_range (state, rdata, low + base_address,
|
||||
high + base_address, error_callback, data,
|
||||
vec))
|
||||
@@ -2206,11 +2206,11 @@ add_ranges_from_rnglists (
|
||||
|
||||
case DW_RLE_start_length:
|
||||
{
|
||||
uint64_t low;
|
||||
uint64_t length;
|
||||
uintptr_t low;
|
||||
uintptr_t length;
|
||||
|
||||
low = read_address (&rnglists_buf, u->addrsize);
|
||||
length = read_uleb128 (&rnglists_buf);
|
||||
low = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
||||
length = (uintptr_t) read_uleb128 (&rnglists_buf);
|
||||
low += base_address;
|
||||
if (!add_range (state, rdata, low, low + length,
|
||||
error_callback, data, vec))
|
||||
@@ -2240,9 +2240,9 @@ static int
|
||||
add_ranges (struct backtrace_state *state,
|
||||
const struct dwarf_sections *dwarf_sections,
|
||||
uintptr_t base_address, int is_bigendian,
|
||||
struct unit *u, uint64_t base, const struct pcrange *pcrange,
|
||||
struct unit *u, uintptr_t base, const struct pcrange *pcrange,
|
||||
int (*add_range) (struct backtrace_state *state, void *rdata,
|
||||
uint64_t lowpc, uint64_t highpc,
|
||||
uintptr_t lowpc, uintptr_t highpc,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data, void *vec),
|
||||
void *rdata,
|
||||
@@ -3520,7 +3520,7 @@ read_referenced_name (struct dwarf_data *ddata, struct unit *u,
|
||||
|
||||
static int
|
||||
add_function_range (struct backtrace_state *state, void *rdata,
|
||||
uint64_t lowpc, uint64_t highpc,
|
||||
uintptr_t lowpc, uintptr_t highpc,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
void *pvec)
|
||||
{
|
||||
@@ -3560,7 +3560,7 @@ add_function_range (struct backtrace_state *state, void *rdata,
|
||||
|
||||
static int
|
||||
read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
|
||||
struct unit *u, uint64_t base, struct dwarf_buf *unit_buf,
|
||||
struct unit *u, uintptr_t base, struct dwarf_buf *unit_buf,
|
||||
const struct line_header *lhdr,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
struct function_vector *vec_function,
|
||||
@@ -3624,7 +3624,7 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
|
||||
&& abbrev->attrs[i].name == DW_AT_low_pc)
|
||||
{
|
||||
if (val.encoding == ATTR_VAL_ADDRESS)
|
||||
base = val.u.uint;
|
||||
base = (uintptr_t) val.u.uint;
|
||||
else if (val.encoding == ATTR_VAL_ADDRESS_INDEX)
|
||||
{
|
||||
if (!resolve_addr_index (&ddata->dwarf_sections,
|
||||
|
||||
2659
Source/ThirdParty/tracy/libbacktrace/elf.cpp
vendored
2659
Source/ThirdParty/tracy/libbacktrace/elf.cpp
vendored
File diff suppressed because it is too large
Load Diff
@@ -371,6 +371,15 @@ extern int backtrace_uncompress_zdebug (struct backtrace_state *,
|
||||
unsigned char **uncompressed,
|
||||
size_t *uncompressed_size);
|
||||
|
||||
/* A test-only hook for elf_zstd_decompress. */
|
||||
|
||||
extern int backtrace_uncompress_zstd (struct backtrace_state *,
|
||||
const unsigned char *compressed,
|
||||
size_t compressed_size,
|
||||
backtrace_error_callback, void *data,
|
||||
unsigned char *uncompressed,
|
||||
size_t uncompressed_size);
|
||||
|
||||
/* A test-only hook for elf_uncompress_lzma. */
|
||||
|
||||
extern int backtrace_uncompress_lzma (struct backtrace_state *,
|
||||
|
||||
61
Source/ThirdParty/tracy/tracy/Tracy.hpp
vendored
61
Source/ThirdParty/tracy/tracy/Tracy.hpp
vendored
@@ -1,6 +1,18 @@
|
||||
#ifndef __TRACY_HPP__
|
||||
#define __TRACY_HPP__
|
||||
|
||||
#ifndef TracyFunction
|
||||
# define TracyFunction __FUNCTION__
|
||||
#endif
|
||||
|
||||
#ifndef TracyFile
|
||||
# define TracyFile __FILE__
|
||||
#endif
|
||||
|
||||
#ifndef TracyLine
|
||||
# define TracyLine __LINE__
|
||||
#endif
|
||||
|
||||
#ifndef TRACY_ENABLE
|
||||
|
||||
#define ZoneNamed(x,y)
|
||||
@@ -80,6 +92,8 @@
|
||||
#define TracySourceCallbackRegister(x,y)
|
||||
#define TracyParameterRegister(x,y)
|
||||
#define TracyParameterSetup(x,y,z,w)
|
||||
#define TracyIsConnected false
|
||||
#define TracySetProgramName(x)
|
||||
|
||||
#define TracyFiberEnter(x)
|
||||
#define TracyFiberLeave
|
||||
@@ -124,21 +138,21 @@ public:
|
||||
}
|
||||
|
||||
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
|
||||
# define ZoneNamed( varname, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active )
|
||||
# define ZoneNamedN( varname, name, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active )
|
||||
# define ZoneNamedC( varname, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active )
|
||||
# define ZoneNamedNC( varname, name, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active )
|
||||
# define ZoneNamed( varname, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active )
|
||||
# define ZoneNamedN( varname, name, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active )
|
||||
# define ZoneNamedC( varname, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active )
|
||||
# define ZoneNamedNC( varname, name, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active )
|
||||
|
||||
# define ZoneTransient( varname, active ) tracy::ScopedZone varname( __LINE__, __FILE__, strlen( __FILE__ ), __FUNCTION__, strlen( __FUNCTION__ ), nullptr, 0, TRACY_CALLSTACK, active )
|
||||
# define ZoneTransientN( varname, name, active ) tracy::ScopedZone varname( __LINE__, __FILE__, strlen( __FILE__ ), __FUNCTION__, strlen( __FUNCTION__ ), name, strlen( name ), TRACY_CALLSTACK, active )
|
||||
# define ZoneTransient( varname, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), nullptr, 0, TRACY_CALLSTACK, active )
|
||||
# define ZoneTransientN( varname, name, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), TRACY_CALLSTACK, active )
|
||||
#else
|
||||
# define ZoneNamed( varname, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), active )
|
||||
# define ZoneNamedN( varname, name, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), active )
|
||||
# define ZoneNamedC( varname, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), active )
|
||||
# define ZoneNamedNC( varname, name, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), active )
|
||||
# define ZoneNamed( varname, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), active )
|
||||
# define ZoneNamedN( varname, name, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), active )
|
||||
# define ZoneNamedC( varname, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), active )
|
||||
# define ZoneNamedNC( varname, name, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), active )
|
||||
|
||||
# define ZoneTransient( varname, active ) tracy::ScopedZone varname( __LINE__, __FILE__, strlen( __FILE__ ), __FUNCTION__, strlen( __FUNCTION__ ), nullptr, 0, active )
|
||||
# define ZoneTransientN( varname, name, active ) tracy::ScopedZone varname( __LINE__, __FILE__, strlen( __FILE__ ), __FUNCTION__, strlen( __FUNCTION__ ), name, strlen( name ), active )
|
||||
# define ZoneTransient( varname, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), nullptr, 0, active )
|
||||
# define ZoneTransientN( varname, name, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), active )
|
||||
#endif
|
||||
|
||||
#define ZoneScoped ZoneNamed( ___tracy_scoped_zone, true )
|
||||
@@ -164,13 +178,13 @@ public:
|
||||
|
||||
#define FrameImage( image, width, height, offset, flip ) tracy::Profiler::SendFrameImage( image, width, height, offset, flip )
|
||||
|
||||
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() }
|
||||
#define TracyLockableN( type, varname, desc ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() }
|
||||
#define TracySharedLockable( type, varname ) tracy::SharedLockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() }
|
||||
#define TracySharedLockableN( type, varname, desc ) tracy::SharedLockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() }
|
||||
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, #type " " #varname, TracyFile, TracyLine, 0 }; return &srcloc; }() }
|
||||
#define TracyLockableN( type, varname, desc ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, desc, TracyFile, TracyLine, 0 }; return &srcloc; }() }
|
||||
#define TracySharedLockable( type, varname ) tracy::SharedLockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, #type " " #varname, TracyFile, TracyLine, 0 }; return &srcloc; }() }
|
||||
#define TracySharedLockableN( type, varname, desc ) tracy::SharedLockable<type> varname { [] () -> const tracy::SourceLocationData* { static constexpr tracy::SourceLocationData srcloc { nullptr, desc, TracyFile, TracyLine, 0 }; return &srcloc; }() }
|
||||
#define LockableBase( type ) tracy::Lockable<type>
|
||||
#define SharedLockableBase( type ) tracy::SharedLockable<type>
|
||||
#define LockMark( varname ) static constexpr tracy::SourceLocationData __tracy_lock_location_##varname { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname )
|
||||
#define LockMark( varname ) static constexpr tracy::SourceLocationData __tracy_lock_location_##varname { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; varname.Mark( &__tracy_lock_location_##varname )
|
||||
#define LockableName( varname, txt, size ) varname.CustomName( txt, size )
|
||||
|
||||
#define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val )
|
||||
@@ -211,13 +225,13 @@ public:
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
# define ZoneNamedS( varname, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth, active )
|
||||
# define ZoneNamedNS( varname, name, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth, active )
|
||||
# define ZoneNamedCS( varname, color, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth, active )
|
||||
# define ZoneNamedNCS( varname, name, color, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth, active )
|
||||
# define ZoneNamedS( varname, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), depth, active )
|
||||
# define ZoneNamedNS( varname, name, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), depth, active )
|
||||
# define ZoneNamedCS( varname, color, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), depth, active )
|
||||
# define ZoneNamedNCS( varname, name, color, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), depth, active )
|
||||
|
||||
# define ZoneTransientS( varname, depth, active ) tracy::ScopedZone varname( __LINE__, __FILE__, strlen( __FILE__ ), __FUNCTION__, strlen( __FUNCTION__ ), nullptr, 0, depth, active )
|
||||
# define ZoneTransientNS( varname, name, depth, active ) tracy::ScopedZone varname( __LINE__, __FILE__, strlen( __FILE__ ), __FUNCTION__, strlen( __FUNCTION__ ), name, strlen( name ), depth, active )
|
||||
# define ZoneTransientS( varname, depth, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), nullptr, 0, depth, active )
|
||||
# define ZoneTransientNS( varname, name, depth, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), depth, active )
|
||||
|
||||
# define ZoneScopedS( depth ) ZoneNamedS( ___tracy_scoped_zone, depth, true )
|
||||
# define ZoneScopedNS( name, depth ) ZoneNamedNS( ___tracy_scoped_zone, name, depth, true )
|
||||
@@ -272,6 +286,7 @@ public:
|
||||
#define TracyParameterRegister( cb, data ) tracy::Profiler::ParameterRegister( cb, data )
|
||||
#define TracyParameterSetup( idx, name, isBool, val ) tracy::Profiler::ParameterSetup( idx, name, isBool, val )
|
||||
#define TracyIsConnected tracy::GetProfiler().IsConnected()
|
||||
#define TracySetProgramName( name ) tracy::GetProfiler().SetProgramName( name );
|
||||
|
||||
#ifdef TRACY_FIBERS
|
||||
# define TracyFiberEnter( fiber ) tracy::Profiler::EnterFiber( fiber )
|
||||
|
||||
Reference in New Issue
Block a user