Update tracy to 0.12.0
This commit is contained in:
@@ -282,7 +282,12 @@ extern "C"
|
|||||||
t_SymFromInlineContext _SymFromInlineContext = 0;
|
t_SymFromInlineContext _SymFromInlineContext = 0;
|
||||||
t_SymGetLineFromInlineContext _SymGetLineFromInlineContext = 0;
|
t_SymGetLineFromInlineContext _SymGetLineFromInlineContext = 0;
|
||||||
|
|
||||||
TRACY_API ___tracy_t_RtlWalkFrameChain ___tracy_RtlWalkFrameChain = 0;
|
typedef unsigned long (__stdcall *___tracy_t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
|
||||||
|
___tracy_t_RtlWalkFrameChain ___tracy_RtlWalkFrameChainPtr = nullptr;
|
||||||
|
TRACY_API unsigned long ___tracy_RtlWalkFrameChain( void** callers, unsigned long count, unsigned long flags)
|
||||||
|
{
|
||||||
|
return ___tracy_RtlWalkFrameChainPtr(callers, count, flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ModuleCache
|
struct ModuleCache
|
||||||
@@ -307,7 +312,7 @@ size_t s_krnlCacheCnt;
|
|||||||
|
|
||||||
void InitCallstackCritical()
|
void InitCallstackCritical()
|
||||||
{
|
{
|
||||||
___tracy_RtlWalkFrameChain = (___tracy_t_RtlWalkFrameChain)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlWalkFrameChain" );
|
___tracy_RtlWalkFrameChainPtr = (___tracy_t_RtlWalkFrameChain)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlWalkFrameChain" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbgHelpInit()
|
void DbgHelpInit()
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
static tracy_force_inline void* Callstack( int /*depth*/ ) { return nullptr; }
|
static constexpr bool has_callstack() { return false; }
|
||||||
|
static tracy_force_inline void* Callstack( int32_t /*depth*/ ) { return nullptr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -36,6 +37,8 @@ static tracy_force_inline void* Callstack( int /*depth*/ ) { return nullptr; }
|
|||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static constexpr bool has_callstack() { return true; }
|
||||||
|
|
||||||
struct CallstackSymbolData
|
struct CallstackSymbolData
|
||||||
{
|
{
|
||||||
const char* file;
|
const char* file;
|
||||||
@@ -77,11 +80,10 @@ debuginfod_client* GetDebuginfodClient();
|
|||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
typedef unsigned long (__stdcall *___tracy_t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
|
TRACY_API unsigned long ___tracy_RtlWalkFrameChain( void**, unsigned long, unsigned long );
|
||||||
TRACY_API extern ___tracy_t_RtlWalkFrameChain ___tracy_RtlWalkFrameChain;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static tracy_force_inline void* Callstack( int depth )
|
static tracy_force_inline void* Callstack( int32_t depth )
|
||||||
{
|
{
|
||||||
assert( depth >= 1 && depth < 63 );
|
assert( depth >= 1 && depth < 63 );
|
||||||
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
||||||
@@ -110,7 +112,7 @@ static _Unwind_Reason_Code tracy_unwind_callback( struct _Unwind_Context* ctx, v
|
|||||||
return _URC_NO_REASON;
|
return _URC_NO_REASON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static tracy_force_inline void* Callstack( int depth )
|
static tracy_force_inline void* Callstack( int32_t depth )
|
||||||
{
|
{
|
||||||
assert( depth >= 1 && depth < 63 );
|
assert( depth >= 1 && depth < 63 );
|
||||||
|
|
||||||
@@ -125,7 +127,7 @@ static tracy_force_inline void* Callstack( int depth )
|
|||||||
|
|
||||||
#elif TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6
|
#elif TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6
|
||||||
|
|
||||||
static tracy_force_inline void* Callstack( int depth )
|
static tracy_force_inline void* Callstack( int32_t depth )
|
||||||
{
|
{
|
||||||
assert( depth >= 1 );
|
assert( depth >= 1 );
|
||||||
|
|
||||||
|
|||||||
563
Source/ThirdParty/tracy/client/TracyProfiler.cpp
vendored
563
Source/ThirdParty/tracy/client/TracyProfiler.cpp
vendored
@@ -78,6 +78,9 @@
|
|||||||
#include "TracyArmCpuTable.hpp"
|
#include "TracyArmCpuTable.hpp"
|
||||||
#include "TracySysTrace.hpp"
|
#include "TracySysTrace.hpp"
|
||||||
|
|
||||||
|
#if defined TRACY_MANUAL_LIFETIME && !defined(TRACY_DELAYED_INIT)
|
||||||
|
# error "TRACY_MANUAL_LIFETIME requires enabled TRACY_DELAYED_INIT"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TRACY_PORT
|
#ifdef TRACY_PORT
|
||||||
# ifndef TRACY_DATA_PORT
|
# ifndef TRACY_DATA_PORT
|
||||||
@@ -104,9 +107,12 @@
|
|||||||
# include <lmcons.h>
|
# include <lmcons.h>
|
||||||
extern "C" typedef LONG (WINAPI *t_RtlGetVersion)( PRTL_OSVERSIONINFOW );
|
extern "C" typedef LONG (WINAPI *t_RtlGetVersion)( PRTL_OSVERSIONINFOW );
|
||||||
extern "C" typedef BOOL (WINAPI *t_GetLogicalProcessorInformationEx)( LOGICAL_PROCESSOR_RELATIONSHIP, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD );
|
extern "C" typedef BOOL (WINAPI *t_GetLogicalProcessorInformationEx)( LOGICAL_PROCESSOR_RELATIONSHIP, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD );
|
||||||
|
extern "C" typedef char* (WINAPI *t_WineGetVersion)();
|
||||||
|
extern "C" typedef char* (WINAPI *t_WineGetBuildId)();
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined __linux__
|
#if defined __linux__
|
||||||
# include <sys/sysinfo.h>
|
# include <sys/sysinfo.h>
|
||||||
@@ -528,7 +534,16 @@ static const char* GetHostInfo()
|
|||||||
# ifdef __MINGW32__
|
# ifdef __MINGW32__
|
||||||
ptr += sprintf( ptr, "OS: Windows %i.%i.%i (MingW)\n", (int)ver.dwMajorVersion, (int)ver.dwMinorVersion, (int)ver.dwBuildNumber );
|
ptr += sprintf( ptr, "OS: Windows %i.%i.%i (MingW)\n", (int)ver.dwMajorVersion, (int)ver.dwMinorVersion, (int)ver.dwBuildNumber );
|
||||||
# else
|
# else
|
||||||
ptr += sprintf( ptr, "OS: Windows %lu.%lu.%lu\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
auto WineGetVersion = (t_WineGetVersion)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "wine_get_version" );
|
||||||
|
auto WineGetBuildId = (t_WineGetBuildId)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "wine_get_build_id" );
|
||||||
|
if( WineGetVersion && WineGetBuildId )
|
||||||
|
{
|
||||||
|
ptr += sprintf( ptr, "OS: Windows %lu.%lu.%lu (Wine %s [%s])\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber, WineGetVersion(), WineGetBuildId() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptr += sprintf( ptr, "OS: Windows %lu.%lu.%lu\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
@@ -1388,6 +1403,8 @@ TRACY_API LuaZoneState& GetLuaZoneState() { return s_luaZoneState; }
|
|||||||
TRACY_API bool ProfilerAvailable() { return s_instance != nullptr; }
|
TRACY_API bool ProfilerAvailable() { return s_instance != nullptr; }
|
||||||
TRACY_API bool ProfilerAllocatorAvailable() { return !RpThreadShutdown; }
|
TRACY_API bool ProfilerAllocatorAvailable() { return !RpThreadShutdown; }
|
||||||
|
|
||||||
|
constexpr static size_t SafeSendBufferSize = 65536;
|
||||||
|
|
||||||
Profiler::Profiler()
|
Profiler::Profiler()
|
||||||
: m_timeBegin( 0 )
|
: m_timeBegin( 0 )
|
||||||
, m_mainThread( detail::GetThreadHandleImpl() )
|
, m_mainThread( detail::GetThreadHandleImpl() )
|
||||||
@@ -1461,6 +1478,21 @@ Profiler::Profiler()
|
|||||||
m_userPort = atoi( userPort );
|
m_userPort = atoi( userPort );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_safeSendBuffer = (char*)tracy_malloc( SafeSendBufferSize );
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
pipe(m_pipe);
|
||||||
|
# if defined __APPLE__ || defined BSD
|
||||||
|
// FreeBSD/XNU don't have F_SETPIPE_SZ, so use the default
|
||||||
|
m_pipeBufSize = 16384;
|
||||||
|
# else
|
||||||
|
m_pipeBufSize = (int)(ptrdiff_t)SafeSendBufferSize;
|
||||||
|
while( fcntl( m_pipe[0], F_SETPIPE_SZ, m_pipeBufSize ) < 0 && errno == EPERM ) m_pipeBufSize /= 2; // too big; reduce
|
||||||
|
m_pipeBufSize = fcntl( m_pipe[0], F_GETPIPE_SZ );
|
||||||
|
# endif
|
||||||
|
fcntl( m_pipe[1], F_SETFL, O_NONBLOCK );
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME)
|
#if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME)
|
||||||
SpawnWorkerThreads();
|
SpawnWorkerThreads();
|
||||||
#endif
|
#endif
|
||||||
@@ -1486,7 +1518,9 @@ void Profiler::InstallCrashHandler()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
|
#if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
|
||||||
m_exceptionHandler = AddVectoredExceptionHandler( 1, CrashFilter );
|
// We cannot use Vectored Exception handling because it catches application-wide frame-based SEH blocks. We only
|
||||||
|
// want to catch unhandled exceptions.
|
||||||
|
m_prevHandler = SetUnhandledExceptionFilter( CrashFilter );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRACY_NO_CRASH_HANDLER
|
#ifndef TRACY_NO_CRASH_HANDLER
|
||||||
@@ -1497,20 +1531,29 @@ void Profiler::InstallCrashHandler()
|
|||||||
|
|
||||||
void Profiler::RemoveCrashHandler()
|
void Profiler::RemoveCrashHandler()
|
||||||
{
|
{
|
||||||
#if defined _WIN32 && !defined TRACY_UWP
|
#if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
|
||||||
if( m_crashHandlerInstalled ) RemoveVectoredExceptionHandler( m_exceptionHandler );
|
if( m_crashHandlerInstalled )
|
||||||
|
{
|
||||||
|
auto prev = SetUnhandledExceptionFilter( (LPTOP_LEVEL_EXCEPTION_FILTER)m_prevHandler );
|
||||||
|
if( prev != CrashFilter ) SetUnhandledExceptionFilter( prev ); // A different exception filter was installed over ours => put it back
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
|
#if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
|
||||||
if( m_crashHandlerInstalled )
|
if( m_crashHandlerInstalled )
|
||||||
{
|
{
|
||||||
sigaction( TRACY_CRASH_SIGNAL, &m_prevSignal.pwr, nullptr );
|
auto restore = []( int signum, struct sigaction* prev ) {
|
||||||
sigaction( SIGILL, &m_prevSignal.ill, nullptr );
|
struct sigaction old;
|
||||||
sigaction( SIGFPE, &m_prevSignal.fpe, nullptr );
|
sigaction( signum, prev, &old );
|
||||||
sigaction( SIGSEGV, &m_prevSignal.segv, nullptr );
|
if( old.sa_sigaction != CrashHandler ) sigaction( signum, &old, nullptr ); // A different signal handler was installed over ours => put it back
|
||||||
sigaction( SIGPIPE, &m_prevSignal.pipe, nullptr );
|
};
|
||||||
sigaction( SIGBUS, &m_prevSignal.bus, nullptr );
|
restore( TRACY_CRASH_SIGNAL, &m_prevSignal.pwr );
|
||||||
sigaction( SIGABRT, &m_prevSignal.abrt, nullptr );
|
restore( SIGILL, &m_prevSignal.ill );
|
||||||
|
restore( SIGFPE, &m_prevSignal.fpe );
|
||||||
|
restore( SIGSEGV, &m_prevSignal.segv );
|
||||||
|
restore( SIGPIPE, &m_prevSignal.pipe );
|
||||||
|
restore( SIGBUS, &m_prevSignal.bus );
|
||||||
|
restore( SIGABRT, &m_prevSignal.abrt );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_crashHandlerInstalled = false;
|
m_crashHandlerInstalled = false;
|
||||||
@@ -1599,6 +1642,12 @@ Profiler::~Profiler()
|
|||||||
tracy_free( m_kcore );
|
tracy_free( m_kcore );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
close( m_pipe[0] );
|
||||||
|
close( m_pipe[1] );
|
||||||
|
#endif
|
||||||
|
tracy_free( m_safeSendBuffer );
|
||||||
|
|
||||||
tracy_free( m_lz4Buf );
|
tracy_free( m_lz4Buf );
|
||||||
tracy_free( m_buffer );
|
tracy_free( m_buffer );
|
||||||
LZ4_freeStream( (LZ4_stream_t*)m_stream );
|
LZ4_freeStream( (LZ4_stream_t*)m_stream );
|
||||||
@@ -2826,6 +2875,15 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
|
|||||||
MemWrite( &item->memFree.time, dt );
|
MemWrite( &item->memFree.time, dt );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QueueType::MemDiscard:
|
||||||
|
case QueueType::MemDiscardCallstack:
|
||||||
|
{
|
||||||
|
int64_t t = MemRead<int64_t>( &item->memDiscard.time );
|
||||||
|
int64_t dt = t - refSerial;
|
||||||
|
refSerial = t;
|
||||||
|
MemWrite( &item->memDiscard.time, dt );
|
||||||
|
break;
|
||||||
|
}
|
||||||
case QueueType::GpuZoneBeginSerial:
|
case QueueType::GpuZoneBeginSerial:
|
||||||
case QueueType::GpuZoneBeginCallstackSerial:
|
case QueueType::GpuZoneBeginCallstackSerial:
|
||||||
{
|
{
|
||||||
@@ -3062,6 +3120,62 @@ bool Profiler::CommitData()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* Profiler::SafeCopyProlog( const char* data, size_t size )
|
||||||
|
{
|
||||||
|
bool success = true;
|
||||||
|
char* buf = m_safeSendBuffer;
|
||||||
|
#ifndef NDEBUG
|
||||||
|
assert( !m_inUse.exchange(true) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( size > SafeSendBufferSize ) buf = (char*)tracy_malloc( size );
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
memcpy( buf, data, size );
|
||||||
|
}
|
||||||
|
__except( 1 /*EXCEPTION_EXECUTE_HANDLER*/ )
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// Send through the pipe to ensure safe reads
|
||||||
|
for( size_t offset = 0; offset != size; /*in loop*/ )
|
||||||
|
{
|
||||||
|
size_t sendsize = size - offset;
|
||||||
|
ssize_t result1, result2;
|
||||||
|
while( ( result1 = write( m_pipe[1], data + offset, sendsize ) ) < 0 && errno == EINTR ) { /* retry */ }
|
||||||
|
if( result1 < 0 )
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while( ( result2 = read( m_pipe[0], buf + offset, result1 ) ) < 0 && errno == EINTR ) { /* retry */ }
|
||||||
|
if( result2 != result1 )
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
offset += result1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( success ) return buf;
|
||||||
|
|
||||||
|
SafeCopyEpilog( buf );
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Profiler::SafeCopyEpilog( char* buf )
|
||||||
|
{
|
||||||
|
if( buf != m_safeSendBuffer ) tracy_free( buf );
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
m_inUse.store( false );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool Profiler::SendData( const char* data, size_t len )
|
bool Profiler::SendData( const char* data, size_t len )
|
||||||
{
|
{
|
||||||
const lz4sz_t lz4sz = LZ4_compress_fast_continue( (LZ4_stream_t*)m_stream, data, m_lz4Buf + sizeof( lz4sz_t ), (int)len, LZ4Size, 1 );
|
const lz4sz_t lz4sz = LZ4_compress_fast_continue( (LZ4_stream_t*)m_stream, data, m_lz4Buf + sizeof( lz4sz_t ), (int)len, LZ4Size, 1 );
|
||||||
@@ -3750,17 +3864,48 @@ void Profiler::ReportTopology()
|
|||||||
# endif
|
# endif
|
||||||
if( !_GetLogicalProcessorInformationEx ) return;
|
if( !_GetLogicalProcessorInformationEx ) return;
|
||||||
|
|
||||||
|
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* packageInfo = nullptr;
|
||||||
|
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* dieInfo = nullptr;
|
||||||
|
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* coreInfo = nullptr;
|
||||||
|
|
||||||
DWORD psz = 0;
|
DWORD psz = 0;
|
||||||
_GetLogicalProcessorInformationEx( RelationProcessorPackage, nullptr, &psz );
|
_GetLogicalProcessorInformationEx( RelationProcessorPackage, nullptr, &psz );
|
||||||
auto packageInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)tracy_malloc( psz );
|
if( GetLastError() == ERROR_INSUFFICIENT_BUFFER )
|
||||||
auto res = _GetLogicalProcessorInformationEx( RelationProcessorPackage, packageInfo, &psz );
|
{
|
||||||
assert( res );
|
packageInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)tracy_malloc( psz );
|
||||||
|
auto res = _GetLogicalProcessorInformationEx( RelationProcessorPackage, packageInfo, &psz );
|
||||||
|
assert( res );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
psz = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD dsz = 0;
|
||||||
|
_GetLogicalProcessorInformationEx( RelationProcessorDie, nullptr, &dsz );
|
||||||
|
if( GetLastError() == ERROR_INSUFFICIENT_BUFFER )
|
||||||
|
{
|
||||||
|
dieInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)tracy_malloc( dsz );
|
||||||
|
auto res = _GetLogicalProcessorInformationEx( RelationProcessorDie, dieInfo, &dsz );
|
||||||
|
assert( res );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dsz = 0;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD csz = 0;
|
DWORD csz = 0;
|
||||||
_GetLogicalProcessorInformationEx( RelationProcessorCore, nullptr, &csz );
|
_GetLogicalProcessorInformationEx( RelationProcessorCore, nullptr, &csz );
|
||||||
auto coreInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)tracy_malloc( csz );
|
if( GetLastError() == ERROR_INSUFFICIENT_BUFFER )
|
||||||
res = _GetLogicalProcessorInformationEx( RelationProcessorCore, coreInfo, &csz );
|
{
|
||||||
assert( res );
|
coreInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)tracy_malloc( csz );
|
||||||
|
auto res = _GetLogicalProcessorInformationEx( RelationProcessorCore, coreInfo, &csz );
|
||||||
|
assert( res );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
csz = 0;
|
||||||
|
}
|
||||||
|
|
||||||
SYSTEM_INFO sysinfo;
|
SYSTEM_INFO sysinfo;
|
||||||
GetSystemInfo( &sysinfo );
|
GetSystemInfo( &sysinfo );
|
||||||
@@ -3788,6 +3933,24 @@ void Profiler::ReportTopology()
|
|||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idx = 0;
|
||||||
|
ptr = dieInfo;
|
||||||
|
while( (char*)ptr < ((char*)dieInfo) + dsz )
|
||||||
|
{
|
||||||
|
assert( ptr->Relationship == RelationProcessorDie );
|
||||||
|
// FIXME account for GroupCount
|
||||||
|
auto mask = ptr->Processor.GroupMask[0].Mask;
|
||||||
|
int core = 0;
|
||||||
|
while( mask != 0 )
|
||||||
|
{
|
||||||
|
if( mask & 1 ) cpuData[core].die = idx;
|
||||||
|
core++;
|
||||||
|
mask >>= 1;
|
||||||
|
}
|
||||||
|
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((char*)ptr) + ptr->Size);
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
ptr = coreInfo;
|
ptr = coreInfo;
|
||||||
while( (char*)ptr < ((char*)coreInfo) + csz )
|
while( (char*)ptr < ((char*)coreInfo) + csz )
|
||||||
@@ -3848,12 +4011,26 @@ void Profiler::ReportTopology()
|
|||||||
fclose( f );
|
fclose( f );
|
||||||
cpuData[i].package = uint32_t( atoi( buf ) );
|
cpuData[i].package = uint32_t( atoi( buf ) );
|
||||||
cpuData[i].thread = i;
|
cpuData[i].thread = i;
|
||||||
|
|
||||||
sprintf( path, "%s%i/topology/core_id", basePath, i );
|
sprintf( path, "%s%i/topology/core_id", basePath, i );
|
||||||
f = fopen( path, "rb" );
|
f = fopen( path, "rb" );
|
||||||
read = fread( buf, 1, 1024, f );
|
if( f )
|
||||||
buf[read] = '\0';
|
{
|
||||||
fclose( f );
|
read = fread( buf, 1, 1024, f );
|
||||||
cpuData[i].core = uint32_t( atoi( buf ) );
|
buf[read] = '\0';
|
||||||
|
fclose( f );
|
||||||
|
cpuData[i].core = uint32_t( atoi( buf ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf( path, "%s%i/topology/die_id", basePath, i );
|
||||||
|
f = fopen( path, "rb" );
|
||||||
|
if( f )
|
||||||
|
{
|
||||||
|
read = fread( buf, 1, 1024, f );
|
||||||
|
buf[read] = '\0';
|
||||||
|
fclose( f );
|
||||||
|
cpuData[i].die = uint32_t( atoi( buf ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i=0; i<numcpus; i++ )
|
for( int i=0; i<numcpus; i++ )
|
||||||
@@ -3986,58 +4163,58 @@ void Profiler::ConfigurePlot( const char* name, PlotFormatType type, bool step,
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::Message( const char* txt, size_t size, int callstack )
|
void Profiler::Message( const char* txt, size_t size, int32_t callstack_depth )
|
||||||
{
|
{
|
||||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
if( callstack != 0 )
|
if( callstack_depth != 0 && has_callstack() )
|
||||||
{
|
{
|
||||||
tracy::GetProfiler().SendCallstack( callstack );
|
tracy::GetProfiler().SendCallstack( callstack_depth );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ptr = (char*)tracy_malloc( size );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
|
|
||||||
TracyQueuePrepare( callstack == 0 ? QueueType::Message : QueueType::MessageCallstack );
|
TracyQueuePrepare( callstack_depth == 0 ? QueueType::Message : QueueType::MessageCallstack );
|
||||||
MemWrite( &item->messageFat.time, GetTime() );
|
MemWrite( &item->messageFat.time, GetTime() );
|
||||||
MemWrite( &item->messageFat.text, (uint64_t)ptr );
|
MemWrite( &item->messageFat.text, (uint64_t)ptr );
|
||||||
MemWrite( &item->messageFat.size, (uint16_t)size );
|
MemWrite( &item->messageFat.size, (uint16_t)size );
|
||||||
TracyQueueCommit( messageFatThread );
|
TracyQueueCommit( messageFatThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::Message( const char* txt, int callstack )
|
void Profiler::Message( const char* txt, int32_t callstack_depth )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
if( callstack != 0 )
|
if( callstack_depth != 0 && has_callstack() )
|
||||||
{
|
{
|
||||||
tracy::GetProfiler().SendCallstack( callstack );
|
tracy::GetProfiler().SendCallstack( callstack_depth );
|
||||||
}
|
}
|
||||||
|
|
||||||
TracyQueuePrepare( callstack == 0 ? QueueType::MessageLiteral : QueueType::MessageLiteralCallstack );
|
TracyQueuePrepare( callstack_depth == 0 ? QueueType::MessageLiteral : QueueType::MessageLiteralCallstack );
|
||||||
MemWrite( &item->messageLiteral.time, GetTime() );
|
MemWrite( &item->messageLiteral.time, GetTime() );
|
||||||
MemWrite( &item->messageLiteral.text, (uint64_t)txt );
|
MemWrite( &item->messageLiteral.text, (uint64_t)txt );
|
||||||
TracyQueueCommit( messageLiteralThread );
|
TracyQueueCommit( messageLiteralThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::MessageColor( const char* txt, size_t size, uint32_t color, int callstack )
|
void Profiler::MessageColor( const char* txt, size_t size, uint32_t color, int32_t callstack_depth )
|
||||||
{
|
{
|
||||||
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
assert( size < (std::numeric_limits<uint16_t>::max)() );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
if( callstack != 0 )
|
if( callstack_depth != 0 && has_callstack() )
|
||||||
{
|
{
|
||||||
tracy::GetProfiler().SendCallstack( callstack );
|
tracy::GetProfiler().SendCallstack( callstack_depth );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ptr = (char*)tracy_malloc( size );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
|
|
||||||
TracyQueuePrepare( callstack == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack );
|
TracyQueuePrepare( callstack_depth == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack );
|
||||||
MemWrite( &item->messageColorFat.time, GetTime() );
|
MemWrite( &item->messageColorFat.time, GetTime() );
|
||||||
MemWrite( &item->messageColorFat.text, (uint64_t)ptr );
|
MemWrite( &item->messageColorFat.text, (uint64_t)ptr );
|
||||||
MemWrite( &item->messageColorFat.b, uint8_t( ( color ) & 0xFF ) );
|
MemWrite( &item->messageColorFat.b, uint8_t( ( color ) & 0xFF ) );
|
||||||
@@ -4047,17 +4224,17 @@ void Profiler::MessageColor( const char* txt, size_t size, uint32_t color, int c
|
|||||||
TracyQueueCommit( messageColorFatThread );
|
TracyQueueCommit( messageColorFatThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::MessageColor( const char* txt, uint32_t color, int callstack )
|
void Profiler::MessageColor( const char* txt, uint32_t color, int32_t callstack_depth )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
if( callstack != 0 )
|
if( callstack_depth != 0 && has_callstack() )
|
||||||
{
|
{
|
||||||
tracy::GetProfiler().SendCallstack( callstack );
|
tracy::GetProfiler().SendCallstack( callstack_depth );
|
||||||
}
|
}
|
||||||
|
|
||||||
TracyQueuePrepare( callstack == 0 ? QueueType::MessageLiteralColor : QueueType::MessageLiteralColorCallstack );
|
TracyQueuePrepare( callstack_depth == 0 ? QueueType::MessageLiteralColor : QueueType::MessageLiteralColorCallstack );
|
||||||
MemWrite( &item->messageColorLiteral.time, GetTime() );
|
MemWrite( &item->messageColorLiteral.time, GetTime() );
|
||||||
MemWrite( &item->messageColorLiteral.text, (uint64_t)txt );
|
MemWrite( &item->messageColorLiteral.text, (uint64_t)txt );
|
||||||
MemWrite( &item->messageColorLiteral.b, uint8_t( ( color ) & 0xFF ) );
|
MemWrite( &item->messageColorLiteral.b, uint8_t( ( color ) & 0xFF ) );
|
||||||
@@ -4112,23 +4289,25 @@ void Profiler::MemFree( const void* ptr, bool secure )
|
|||||||
void Profiler::MemAllocCallstack( const void* ptr, size_t size, int depth, bool secure )
|
void Profiler::MemAllocCallstack( const void* ptr, size_t size, int depth, bool secure )
|
||||||
{
|
{
|
||||||
if( secure && !ProfilerAvailable() ) return;
|
if( secure && !ProfilerAvailable() ) return;
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
if( depth > 0 && has_callstack() )
|
||||||
auto& profiler = GetProfiler();
|
{
|
||||||
|
auto& profiler = GetProfiler();
|
||||||
# ifdef TRACY_ON_DEMAND
|
# ifdef TRACY_ON_DEMAND
|
||||||
if( !profiler.IsConnected() ) return;
|
if( !profiler.IsConnected() ) return;
|
||||||
# endif
|
# endif
|
||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
|
|
||||||
auto callstack = Callstack( depth );
|
auto callstack = Callstack( depth );
|
||||||
|
|
||||||
profiler.m_serialLock.lock();
|
profiler.m_serialLock.lock();
|
||||||
SendCallstackSerial( callstack );
|
SendCallstackSerial( callstack );
|
||||||
SendMemAlloc( QueueType::MemAllocCallstack, thread, ptr, size );
|
SendMemAlloc( QueueType::MemAllocCallstack, thread, ptr, size );
|
||||||
profiler.m_serialLock.unlock();
|
profiler.m_serialLock.unlock();
|
||||||
#else
|
}
|
||||||
static_cast<void>(depth); // unused
|
else
|
||||||
MemAlloc( ptr, size, secure );
|
{
|
||||||
#endif
|
MemAlloc( ptr, size, secure );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::MemFreeCallstack( const void* ptr, int depth, bool secure )
|
void Profiler::MemFreeCallstack( const void* ptr, int depth, bool secure )
|
||||||
@@ -4139,23 +4318,25 @@ void Profiler::MemFreeCallstack( const void* ptr, int depth, bool secure )
|
|||||||
MemFree( ptr, secure );
|
MemFree( ptr, secure );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
if( depth > 0 && has_callstack() )
|
||||||
auto& profiler = GetProfiler();
|
{
|
||||||
|
auto& profiler = GetProfiler();
|
||||||
# ifdef TRACY_ON_DEMAND
|
# ifdef TRACY_ON_DEMAND
|
||||||
if( !profiler.IsConnected() ) return;
|
if( !profiler.IsConnected() ) return;
|
||||||
# endif
|
# endif
|
||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
|
|
||||||
auto callstack = Callstack( depth );
|
auto callstack = Callstack( depth );
|
||||||
|
|
||||||
profiler.m_serialLock.lock();
|
profiler.m_serialLock.lock();
|
||||||
SendCallstackSerial( callstack );
|
SendCallstackSerial( callstack );
|
||||||
SendMemFree( QueueType::MemFreeCallstack, thread, ptr );
|
SendMemFree( QueueType::MemFreeCallstack, thread, ptr );
|
||||||
profiler.m_serialLock.unlock();
|
profiler.m_serialLock.unlock();
|
||||||
#else
|
}
|
||||||
static_cast<void>(depth); // unused
|
else
|
||||||
MemFree( ptr, secure );
|
{
|
||||||
#endif
|
MemFree( ptr, secure );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::MemAllocNamed( const void* ptr, size_t size, bool secure, const char* name )
|
void Profiler::MemAllocNamed( const void* ptr, size_t size, bool secure, const char* name )
|
||||||
@@ -4189,59 +4370,98 @@ void Profiler::MemFreeNamed( const void* ptr, bool secure, const char* name )
|
|||||||
void Profiler::MemAllocCallstackNamed( const void* ptr, size_t size, int depth, bool secure, const char* name )
|
void Profiler::MemAllocCallstackNamed( const void* ptr, size_t size, int depth, bool secure, const char* name )
|
||||||
{
|
{
|
||||||
if( secure && !ProfilerAvailable() ) return;
|
if( secure && !ProfilerAvailable() ) return;
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
if( depth > 0 && has_callstack() )
|
||||||
auto& profiler = GetProfiler();
|
{
|
||||||
|
auto& profiler = GetProfiler();
|
||||||
# ifdef TRACY_ON_DEMAND
|
# ifdef TRACY_ON_DEMAND
|
||||||
if( !profiler.IsConnected() ) return;
|
if( !profiler.IsConnected() ) return;
|
||||||
# endif
|
# endif
|
||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
|
|
||||||
auto callstack = Callstack( depth );
|
auto callstack = Callstack( depth );
|
||||||
|
|
||||||
profiler.m_serialLock.lock();
|
profiler.m_serialLock.lock();
|
||||||
SendCallstackSerial( callstack );
|
SendCallstackSerial( callstack );
|
||||||
SendMemName( name );
|
SendMemName( name );
|
||||||
SendMemAlloc( QueueType::MemAllocCallstackNamed, thread, ptr, size );
|
SendMemAlloc( QueueType::MemAllocCallstackNamed, thread, ptr, size );
|
||||||
profiler.m_serialLock.unlock();
|
profiler.m_serialLock.unlock();
|
||||||
#else
|
}
|
||||||
static_cast<void>(depth); // unused
|
else
|
||||||
MemAllocNamed( ptr, size, secure, name );
|
{
|
||||||
#endif
|
MemAllocNamed( ptr, size, secure, name );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::MemFreeCallstackNamed( const void* ptr, int depth, bool secure, const char* name )
|
void Profiler::MemFreeCallstackNamed( const void* ptr, int depth, bool secure, const char* name )
|
||||||
{
|
{
|
||||||
if( secure && !ProfilerAvailable() ) return;
|
if( secure && !ProfilerAvailable() ) return;
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
if( depth > 0 && has_callstack() )
|
||||||
auto& profiler = GetProfiler();
|
{
|
||||||
|
auto& profiler = GetProfiler();
|
||||||
# ifdef TRACY_ON_DEMAND
|
# ifdef TRACY_ON_DEMAND
|
||||||
if( !profiler.IsConnected() ) return;
|
if( !profiler.IsConnected() ) return;
|
||||||
# endif
|
# endif
|
||||||
|
const auto thread = GetThreadHandle();
|
||||||
|
|
||||||
|
auto callstack = Callstack( depth );
|
||||||
|
|
||||||
|
profiler.m_serialLock.lock();
|
||||||
|
SendCallstackSerial( callstack );
|
||||||
|
SendMemName( name );
|
||||||
|
SendMemFree( QueueType::MemFreeCallstackNamed, thread, ptr );
|
||||||
|
profiler.m_serialLock.unlock();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MemFreeNamed( ptr, secure, name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Profiler::MemDiscard( const char* name, bool secure )
|
||||||
|
{
|
||||||
|
if( secure && !ProfilerAvailable() ) return;
|
||||||
|
#ifdef TRACY_ON_DEMAND
|
||||||
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
|
#endif
|
||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
|
|
||||||
auto callstack = Callstack( depth );
|
GetProfiler().m_serialLock.lock();
|
||||||
|
SendMemDiscard( QueueType::MemDiscard, thread, name );
|
||||||
|
GetProfiler().m_serialLock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
profiler.m_serialLock.lock();
|
void Profiler::MemDiscardCallstack( const char* name, bool secure, int32_t depth )
|
||||||
SendCallstackSerial( callstack );
|
{
|
||||||
SendMemName( name );
|
if( secure && !ProfilerAvailable() ) return;
|
||||||
SendMemFree( QueueType::MemFreeCallstackNamed, thread, ptr );
|
if( depth > 0 && has_callstack() )
|
||||||
profiler.m_serialLock.unlock();
|
{
|
||||||
#else
|
# ifdef TRACY_ON_DEMAND
|
||||||
static_cast<void>(depth); // unused
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
MemFreeNamed( ptr, secure, name );
|
# endif
|
||||||
#endif
|
const auto thread = GetThreadHandle();
|
||||||
|
|
||||||
|
auto callstack = Callstack( depth );
|
||||||
|
|
||||||
|
GetProfiler().m_serialLock.lock();
|
||||||
|
SendCallstackSerial( callstack );
|
||||||
|
SendMemDiscard( QueueType::MemDiscard, thread, name );
|
||||||
|
GetProfiler().m_serialLock.unlock();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MemDiscard( name, secure );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::SendCallstack( int depth )
|
void Profiler::SendCallstack( int depth )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
if( depth > 0 && has_callstack() )
|
||||||
auto ptr = Callstack( depth );
|
{
|
||||||
TracyQueuePrepare( QueueType::Callstack );
|
auto ptr = Callstack( depth );
|
||||||
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );
|
TracyQueuePrepare( QueueType::Callstack );
|
||||||
TracyQueueCommit( callstackFatThread );
|
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );
|
||||||
#else
|
TracyQueueCommit( callstackFatThread );
|
||||||
static_cast<void>(depth); // unused
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::ParameterRegister( ParameterCallback cb, void* data )
|
void Profiler::ParameterRegister( ParameterCallback cb, void* data )
|
||||||
@@ -4266,7 +4486,7 @@ void Profiler::ParameterSetup( uint32_t idx, const char* name, bool isBool, int3
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profiler::SendCallstack( int depth, const char* skipBefore )
|
void Profiler::SendCallstack( int32_t depth, const char* skipBefore )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
#ifdef TRACY_HAS_CALLSTACK
|
||||||
auto ptr = Callstack( depth );
|
auto ptr = Callstack( depth );
|
||||||
@@ -4341,13 +4561,12 @@ void Profiler::HandleSymbolCodeQuery( uint64_t symbol, uint32_t size )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !EnsureReadable( symbol ) )
|
auto&& lambda = [ this, symbol ]( const char* buf, size_t size ) {
|
||||||
{
|
SendLongString( symbol, buf, size, QueueType::SymbolCode );
|
||||||
AckSymbolCodeNotAvailable();
|
};
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SendLongString( symbol, (const char*)symbol, size, QueueType::SymbolCode );
|
// 'symbol' may have come from a module that has since unloaded, perform a safe copy before sending
|
||||||
|
if( !WithSafeCopy( (const char*)symbol, size, lambda ) ) AckSymbolCodeNotAvailable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4471,7 +4690,7 @@ int64_t Profiler::GetTimeQpc()
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin( const struct ___tracy_source_location_data* srcloc, int active )
|
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin( const struct ___tracy_source_location_data* srcloc, int32_t active )
|
||||||
{
|
{
|
||||||
___tracy_c_zone_context ctx;
|
___tracy_c_zone_context ctx;
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
@@ -4499,7 +4718,7 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin( const struct ___tracy_source_l
|
|||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___tracy_source_location_data* srcloc, int depth, int active )
|
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___tracy_source_location_data* srcloc, int32_t depth, int32_t active )
|
||||||
{
|
{
|
||||||
___tracy_c_zone_context ctx;
|
___tracy_c_zone_context ctx;
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
@@ -4518,17 +4737,21 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___trac
|
|||||||
TracyQueueCommitC( zoneValidationThread );
|
TracyQueueCommitC( zoneValidationThread );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tracy::GetProfiler().SendCallstack( depth );
|
auto zoneQueue = tracy::QueueType::ZoneBegin;
|
||||||
|
if( depth > 0 && tracy::has_callstack() )
|
||||||
{
|
{
|
||||||
TracyQueuePrepareC( tracy::QueueType::ZoneBeginCallstack );
|
tracy::GetProfiler().SendCallstack( depth );
|
||||||
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
zoneQueue = tracy::QueueType::ZoneBeginCallstack;
|
||||||
tracy::MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
|
||||||
TracyQueueCommitC( zoneBeginThread );
|
|
||||||
}
|
}
|
||||||
|
TracyQueuePrepareC( zoneQueue );
|
||||||
|
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
||||||
|
tracy::MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
||||||
|
TracyQueueCommitC( zoneBeginThread );
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc( uint64_t srcloc, int active )
|
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc( uint64_t srcloc, int32_t active )
|
||||||
{
|
{
|
||||||
___tracy_c_zone_context ctx;
|
___tracy_c_zone_context ctx;
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
@@ -4560,7 +4783,7 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc( uint64_t srcloc, int act
|
|||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srcloc, int depth, int active )
|
TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srcloc, int32_t depth, int32_t active )
|
||||||
{
|
{
|
||||||
___tracy_c_zone_context ctx;
|
___tracy_c_zone_context ctx;
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
@@ -4583,13 +4806,17 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srclo
|
|||||||
TracyQueueCommitC( zoneValidationThread );
|
TracyQueueCommitC( zoneValidationThread );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tracy::GetProfiler().SendCallstack( depth );
|
auto zoneQueue = tracy::QueueType::ZoneBeginAllocSrcLoc;
|
||||||
|
if( depth > 0 && tracy::has_callstack() )
|
||||||
{
|
{
|
||||||
TracyQueuePrepareC( tracy::QueueType::ZoneBeginAllocSrcLocCallstack );
|
tracy::GetProfiler().SendCallstack( depth );
|
||||||
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
zoneQueue = tracy::QueueType::ZoneBeginAllocSrcLocCallstack;
|
||||||
tracy::MemWrite( &item->zoneBegin.srcloc, srcloc );
|
|
||||||
TracyQueueCommitC( zoneBeginThread );
|
|
||||||
}
|
}
|
||||||
|
TracyQueuePrepareC( zoneQueue );
|
||||||
|
tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() );
|
||||||
|
tracy::MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||||
|
TracyQueueCommitC( zoneBeginThread );
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4687,26 +4914,78 @@ TRACY_API void ___tracy_emit_zone_value( TracyCZoneCtx ctx, uint64_t value )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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( const void* ptr, size_t size, int32_t 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_alloc_callstack( const void* ptr, size_t size, int32_t depth, int32_t secure )
|
||||||
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 ); }
|
if( depth > 0 && tracy::has_callstack() )
|
||||||
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::Profiler::MemAllocCallstack( ptr, size, depth, secure != 0 );
|
||||||
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 ); }
|
else
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemAlloc( ptr, size, secure != 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TRACY_API void ___tracy_emit_memory_free( const void* ptr, int32_t secure ) { tracy::Profiler::MemFree( ptr, secure != 0 ); }
|
||||||
|
TRACY_API void ___tracy_emit_memory_free_callstack( const void* ptr, int32_t depth, int32_t secure )
|
||||||
|
{
|
||||||
|
if( depth > 0 && tracy::has_callstack() )
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemFreeCallstack( ptr, depth, secure != 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemFree( ptr, secure != 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TRACY_API void ___tracy_emit_memory_discard( const char* name, int32_t secure ) { tracy::Profiler::MemDiscard( name, secure != 0 ); }
|
||||||
|
TRACY_API void ___tracy_emit_memory_discard_callstack( const char* name, int32_t secure, int32_t depth )
|
||||||
|
{
|
||||||
|
if( depth > 0 && tracy::has_callstack() )
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemDiscardCallstack( name, secure != 0, depth );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemDiscard( name, secure != 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TRACY_API void ___tracy_emit_memory_alloc_named( const void* ptr, size_t size, int32_t 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, int32_t depth, int32_t secure, const char* name )
|
||||||
|
{
|
||||||
|
if( depth > 0 && tracy::has_callstack() )
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemAllocCallstackNamed( ptr, size, depth, secure != 0, name );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemAllocNamed( ptr, size, secure != 0, name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TRACY_API void ___tracy_emit_memory_free_named( const void* ptr, int32_t secure, const char* name ) { tracy::Profiler::MemFreeNamed( ptr, secure != 0, name ); }
|
||||||
|
TRACY_API void ___tracy_emit_memory_free_callstack_named( const void* ptr, int32_t depth, int32_t secure, const char* name )
|
||||||
|
{
|
||||||
|
if( depth > 0 && tracy::has_callstack() )
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemFreeCallstackNamed( ptr, depth, secure != 0, name );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tracy::Profiler::MemFreeNamed( ptr, secure != 0, name );
|
||||||
|
}
|
||||||
|
}
|
||||||
TRACY_API void ___tracy_emit_frame_mark( const char* name ) { tracy::Profiler::SendFrameMark( 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_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_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_frame_image( const void* image, uint16_t w, uint16_t h, uint8_t offset, int32_t flip ) { tracy::Profiler::SendFrameImage( image, w, h, offset, flip != 0 ); }
|
||||||
TRACY_API void ___tracy_emit_plot( const char* name, double val ) { tracy::Profiler::PlotData( name, val ); }
|
TRACY_API void ___tracy_emit_plot( const char* name, double val ) { tracy::Profiler::PlotData( name, val ); }
|
||||||
TRACY_API void ___tracy_emit_plot_float( const char* name, float val ) { tracy::Profiler::PlotData( name, val ); }
|
TRACY_API void ___tracy_emit_plot_float( const char* name, float val ) { tracy::Profiler::PlotData( name, val ); }
|
||||||
TRACY_API void ___tracy_emit_plot_int( const char* name, int64_t val ) { tracy::Profiler::PlotData( name, val ); }
|
TRACY_API void ___tracy_emit_plot_int( const char* name, int64_t val ) { tracy::Profiler::PlotData( name, val ); }
|
||||||
TRACY_API void ___tracy_emit_plot_config( const char* name, int type, int step, int fill, uint32_t color ) { tracy::Profiler::ConfigurePlot( name, tracy::PlotFormatType(type), step, fill, color ); }
|
TRACY_API void ___tracy_emit_plot_config( const char* name, int32_t type, int32_t step, int32_t fill, uint32_t color ) { tracy::Profiler::ConfigurePlot( name, tracy::PlotFormatType(type), step != 0, fill != 0, color ); }
|
||||||
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_message( const char* txt, size_t size, int32_t callstack_depth ) { tracy::Profiler::Message( txt, size, callstack_depth ); }
|
||||||
TRACY_API void ___tracy_emit_messageL( const char* txt, int callstack ) { tracy::Profiler::Message( txt, callstack ); }
|
TRACY_API void ___tracy_emit_messageL( const char* txt, int32_t callstack_depth ) { tracy::Profiler::Message( txt, callstack_depth ); }
|
||||||
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_messageC( const char* txt, size_t size, uint32_t color, int32_t callstack_depth ) { tracy::Profiler::MessageColor( txt, size, color, callstack_depth ); }
|
||||||
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_messageLC( const char* txt, uint32_t color, int32_t callstack_depth ) { tracy::Profiler::MessageColor( txt, color, callstack_depth ); }
|
||||||
TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size ) { tracy::Profiler::MessageAppInfo( txt, size ); }
|
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, uint32_t color ) {
|
TRACY_API uint64_t ___tracy_alloc_srcloc( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, uint32_t color ) {
|
||||||
@@ -5004,7 +5283,7 @@ TRACY_API void ___tracy_terminate_lockable_ctx( struct __tracy_lockable_context_
|
|||||||
tracy::tracy_free((void*)lockdata);
|
tracy::tracy_free((void*)lockdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API int ___tracy_before_lock_lockable_ctx( struct __tracy_lockable_context_data* lockdata )
|
TRACY_API int32_t ___tracy_before_lock_lockable_ctx( struct __tracy_lockable_context_data* lockdata )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
bool queue = false;
|
bool queue = false;
|
||||||
@@ -5016,7 +5295,7 @@ TRACY_API int ___tracy_before_lock_lockable_ctx( struct __tracy_lockable_context
|
|||||||
if( active != connected ) lockdata->m_active.store( connected, std::memory_order_relaxed );
|
if( active != connected ) lockdata->m_active.store( connected, std::memory_order_relaxed );
|
||||||
if( connected ) queue = true;
|
if( connected ) queue = true;
|
||||||
}
|
}
|
||||||
if( !queue ) return false;
|
if( !queue ) return static_cast<int32_t>(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto item = tracy::Profiler::QueueSerial();
|
auto item = tracy::Profiler::QueueSerial();
|
||||||
@@ -5025,7 +5304,7 @@ TRACY_API int ___tracy_before_lock_lockable_ctx( struct __tracy_lockable_context
|
|||||||
tracy::MemWrite( &item->lockWait.id, lockdata->m_id );
|
tracy::MemWrite( &item->lockWait.id, lockdata->m_id );
|
||||||
tracy::MemWrite( &item->lockWait.time, tracy::Profiler::GetTime() );
|
tracy::MemWrite( &item->lockWait.time, tracy::Profiler::GetTime() );
|
||||||
tracy::Profiler::QueueSerialFinish();
|
tracy::Profiler::QueueSerialFinish();
|
||||||
return true;
|
return static_cast<int32_t>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API void ___tracy_after_lock_lockable_ctx( struct __tracy_lockable_context_data* lockdata )
|
TRACY_API void ___tracy_after_lock_lockable_ctx( struct __tracy_lockable_context_data* lockdata )
|
||||||
@@ -5057,7 +5336,7 @@ TRACY_API void ___tracy_after_unlock_lockable_ctx( struct __tracy_lockable_conte
|
|||||||
tracy::Profiler::QueueSerialFinish();
|
tracy::Profiler::QueueSerialFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API void ___tracy_after_try_lock_lockable_ctx( struct __tracy_lockable_context_data* lockdata, int acquired )
|
TRACY_API void ___tracy_after_try_lock_lockable_ctx( struct __tracy_lockable_context_data* lockdata, int32_t acquired )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !acquired ) return;
|
if( !acquired ) return;
|
||||||
@@ -5122,9 +5401,9 @@ TRACY_API void ___tracy_custom_name_lockable_ctx( struct __tracy_lockable_contex
|
|||||||
tracy::Profiler::QueueSerialFinish();
|
tracy::Profiler::QueueSerialFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API int ___tracy_connected( void )
|
TRACY_API int32_t ___tracy_connected( void )
|
||||||
{
|
{
|
||||||
return tracy::GetProfiler().IsConnected();
|
return static_cast<int32_t>( tracy::GetProfiler().IsConnected() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRACY_FIBERS
|
#ifdef TRACY_FIBERS
|
||||||
@@ -5132,7 +5411,7 @@ TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::Enter
|
|||||||
TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); }
|
TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# ifdef TRACY_MANUAL_LIFETIME
|
# if defined TRACY_MANUAL_LIFETIME && defined TRACY_DELAYED_INIT
|
||||||
TRACY_API void ___tracy_startup_profiler( void )
|
TRACY_API void ___tracy_startup_profiler( void )
|
||||||
{
|
{
|
||||||
tracy::StartupProfiler();
|
tracy::StartupProfiler();
|
||||||
@@ -5143,9 +5422,9 @@ TRACY_API void ___tracy_shutdown_profiler( void )
|
|||||||
tracy::ShutdownProfiler();
|
tracy::ShutdownProfiler();
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACY_API int ___tracy_profiler_started( void )
|
TRACY_API int32_t ___tracy_profiler_started( void )
|
||||||
{
|
{
|
||||||
return tracy::s_isProfilerStarted.load( std::memory_order_seq_cst );
|
return static_cast<int32_t>( tracy::s_isProfilerStarted.load( std::memory_order_seq_cst ) );
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|||||||
76
Source/ThirdParty/tracy/client/TracyProfiler.hpp
vendored
76
Source/ThirdParty/tracy/client/TracyProfiler.hpp
vendored
@@ -97,11 +97,11 @@ struct LuaZoneState
|
|||||||
|
|
||||||
|
|
||||||
#define TracyLfqPrepare( _type ) \
|
#define TracyLfqPrepare( _type ) \
|
||||||
moodycamel::ConcurrentQueueDefaultTraits::index_t __magic; \
|
tracy::moodycamel::ConcurrentQueueDefaultTraits::index_t __magic; \
|
||||||
auto __token = GetToken(); \
|
auto __token = tracy::GetToken(); \
|
||||||
auto& __tail = __token->get_tail_index(); \
|
auto& __tail = __token->get_tail_index(); \
|
||||||
auto item = __token->enqueue_begin( __magic ); \
|
auto item = __token->enqueue_begin( __magic ); \
|
||||||
MemWrite( &item->hdr.type, _type );
|
tracy::MemWrite( &item->hdr.type, _type );
|
||||||
|
|
||||||
#define TracyLfqCommit \
|
#define TracyLfqCommit \
|
||||||
__tail.store( __magic + 1, std::memory_order_release );
|
__tail.store( __magic + 1, std::memory_order_release );
|
||||||
@@ -119,11 +119,11 @@ struct LuaZoneState
|
|||||||
|
|
||||||
#ifdef TRACY_FIBERS
|
#ifdef TRACY_FIBERS
|
||||||
# define TracyQueuePrepare( _type ) \
|
# define TracyQueuePrepare( _type ) \
|
||||||
auto item = Profiler::QueueSerial(); \
|
auto item = tracy::Profiler::QueueSerial(); \
|
||||||
MemWrite( &item->hdr.type, _type );
|
tracy::MemWrite( &item->hdr.type, _type );
|
||||||
# define TracyQueueCommit( _name ) \
|
# define TracyQueueCommit( _name ) \
|
||||||
MemWrite( &item->_name.thread, GetThreadHandle() ); \
|
tracy::MemWrite( &item->_name.thread, tracy::GetThreadHandle() ); \
|
||||||
Profiler::QueueSerialFinish();
|
tracy::Profiler::QueueSerialFinish();
|
||||||
# define TracyQueuePrepareC( _type ) \
|
# define TracyQueuePrepareC( _type ) \
|
||||||
auto item = tracy::Profiler::QueueSerial(); \
|
auto item = tracy::Profiler::QueueSerial(); \
|
||||||
tracy::MemWrite( &item->hdr.type, _type );
|
tracy::MemWrite( &item->hdr.type, _type );
|
||||||
@@ -283,6 +283,8 @@ public:
|
|||||||
static void MemFreeNamed( const void* ptr, 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 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 MemFreeCallstackNamed( const void* ptr, int depth, bool secure, const char* name );
|
||||||
|
static void MemDiscard( const char* name, bool secure );
|
||||||
|
static void MemDiscardCallstack( const char* name, bool secure, int32_t depth );
|
||||||
static void SendCallstack( int depth );
|
static void SendCallstack( int depth );
|
||||||
static void ParameterRegister( ParameterCallback cb, void* data );
|
static void ParameterRegister( ParameterCallback cb, void* data );
|
||||||
static void ParameterSetup( uint32_t idx, const char* name, bool isBool, int32_t val );
|
static void ParameterSetup( uint32_t idx, const char* name, bool isBool, int32_t val );
|
||||||
@@ -312,7 +314,7 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SendCallstack( int depth, const char* skipBefore );
|
void SendCallstack( int32_t depth, const char* skipBefore );
|
||||||
static void CutCallstack( void* callstack, const char* skipBefore );
|
static void CutCallstack( void* callstack, const char* skipBefore );
|
||||||
|
|
||||||
static bool ShouldExit();
|
static bool ShouldExit();
|
||||||
@@ -420,7 +422,7 @@ private:
|
|||||||
|
|
||||||
void InstallCrashHandler();
|
void InstallCrashHandler();
|
||||||
void RemoveCrashHandler();
|
void RemoveCrashHandler();
|
||||||
|
|
||||||
void ClearQueues( tracy::moodycamel::ConsumerToken& token );
|
void ClearQueues( tracy::moodycamel::ConsumerToken& token );
|
||||||
void ClearSerial();
|
void ClearSerial();
|
||||||
DequeueStatus Dequeue( tracy::moodycamel::ConsumerToken& token );
|
DequeueStatus Dequeue( tracy::moodycamel::ConsumerToken& token );
|
||||||
@@ -453,6 +455,21 @@ private:
|
|||||||
m_bufferOffset += int( len );
|
m_bufferOffset += int( len );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* SafeCopyProlog( const char* p, size_t size );
|
||||||
|
void SafeCopyEpilog( char* buf );
|
||||||
|
|
||||||
|
template<class Callable> // must be void( const char* buf, size_t size )
|
||||||
|
bool WithSafeCopy( const char* p, size_t size, Callable&& callable )
|
||||||
|
{
|
||||||
|
if( char* buf = SafeCopyProlog( p, size ) )
|
||||||
|
{
|
||||||
|
callable( buf, size );
|
||||||
|
SafeCopyEpilog( buf );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool SendData( const char* data, size_t len );
|
bool SendData( const char* data, size_t len );
|
||||||
void SendLongString( uint64_t ptr, const char* str, size_t len, QueueType type );
|
void SendLongString( uint64_t ptr, const char* str, size_t len, QueueType type );
|
||||||
void SendSourceLocation( uint64_t ptr );
|
void SendSourceLocation( uint64_t ptr );
|
||||||
@@ -482,14 +499,13 @@ private:
|
|||||||
|
|
||||||
static tracy_force_inline void SendCallstackSerial( void* ptr )
|
static tracy_force_inline void SendCallstackSerial( void* ptr )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
if( has_callstack() )
|
||||||
auto item = GetProfiler().m_serialQueue.prepare_next();
|
{
|
||||||
MemWrite( &item->hdr.type, QueueType::CallstackSerial );
|
auto item = GetProfiler().m_serialQueue.prepare_next();
|
||||||
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );
|
MemWrite( &item->hdr.type, QueueType::CallstackSerial );
|
||||||
GetProfiler().m_serialQueue.commit_next();
|
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );
|
||||||
#else
|
GetProfiler().m_serialQueue.commit_next();
|
||||||
static_cast<void>(ptr); // unused
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static tracy_force_inline void SendMemAlloc( QueueType type, const uint32_t thread, const void* ptr, size_t size )
|
static tracy_force_inline void SendMemAlloc( QueueType type, const uint32_t thread, const void* ptr, size_t size )
|
||||||
@@ -527,6 +543,18 @@ private:
|
|||||||
GetProfiler().m_serialQueue.commit_next();
|
GetProfiler().m_serialQueue.commit_next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static tracy_force_inline void SendMemDiscard( QueueType type, const uint32_t thread, const char* name )
|
||||||
|
{
|
||||||
|
assert( type == QueueType::MemDiscard || type == QueueType::MemDiscardCallstack );
|
||||||
|
|
||||||
|
auto item = GetProfiler().m_serialQueue.prepare_next();
|
||||||
|
MemWrite( &item->hdr.type, type );
|
||||||
|
MemWrite( &item->memDiscard.time, GetTime() );
|
||||||
|
MemWrite( &item->memDiscard.thread, thread );
|
||||||
|
MemWrite( &item->memDiscard.name, (uint64_t)name );
|
||||||
|
GetProfiler().m_serialQueue.commit_next();
|
||||||
|
}
|
||||||
|
|
||||||
static tracy_force_inline void SendMemName( const char* name )
|
static tracy_force_inline void SendMemName( const char* name )
|
||||||
{
|
{
|
||||||
assert( name );
|
assert( name );
|
||||||
@@ -610,9 +638,19 @@ private:
|
|||||||
char* m_queryData;
|
char* m_queryData;
|
||||||
char* m_queryDataPtr;
|
char* m_queryDataPtr;
|
||||||
|
|
||||||
#if defined _WIN32
|
#ifndef NDEBUG
|
||||||
void* m_exceptionHandler;
|
// m_safeSendBuffer and m_pipe should only be used by the Tracy Profiler thread; this ensures that in debug builds.
|
||||||
|
std::atomic_bool m_inUse{ false };
|
||||||
#endif
|
#endif
|
||||||
|
char* m_safeSendBuffer;
|
||||||
|
|
||||||
|
#if defined _WIN32
|
||||||
|
void* m_prevHandler;
|
||||||
|
#else
|
||||||
|
int m_pipe[2];
|
||||||
|
int m_pipeBufSize;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
struct {
|
struct {
|
||||||
struct sigaction pwr, ill, fpe, segv, pipe, bus, abrt;
|
struct sigaction pwr, ill, fpe, segv, pipe, bus, abrt;
|
||||||
|
|||||||
84
Source/ThirdParty/tracy/client/TracyScoped.hpp
vendored
84
Source/ThirdParty/tracy/client/TracyScoped.hpp
vendored
@@ -10,6 +10,8 @@
|
|||||||
#include "../common/TracyAlign.hpp"
|
#include "../common/TracyAlign.hpp"
|
||||||
#include "../common/TracyAlloc.hpp"
|
#include "../common/TracyAlloc.hpp"
|
||||||
#include "../client/TracyLock.hpp"
|
#include "../client/TracyLock.hpp"
|
||||||
|
#include "TracyProfiler.hpp"
|
||||||
|
#include "TracyCallstack.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
@@ -35,7 +37,7 @@ void ScopedZone::End()
|
|||||||
TracyQueueCommit( zoneEndThread );
|
TracyQueueCommit( zoneEndThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedZone::ScopedZone( const SourceLocationData* srcloc, bool is_active )
|
ScopedZone::ScopedZone( const SourceLocationData* srcloc, int32_t depth, bool is_active )
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@@ -46,13 +48,19 @@ ScopedZone::ScopedZone( const SourceLocationData* srcloc, bool is_active )
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
m_connectionId = GetProfiler().ConnectionId();
|
||||||
#endif
|
#endif
|
||||||
TracyQueuePrepare( QueueType::ZoneBegin );
|
auto zoneQueue = QueueType::ZoneBegin;
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
if( depth > 0 && has_callstack() )
|
||||||
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
{
|
||||||
TracyQueueCommit( zoneBeginThread );
|
GetProfiler().SendCallstack( depth );
|
||||||
}
|
zoneQueue = QueueType::ZoneBeginCallstack;
|
||||||
|
}
|
||||||
|
TracyQueuePrepare( zoneQueue );
|
||||||
|
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||||
|
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
||||||
|
TracyQueueCommit( zoneBeginThread );
|
||||||
|
}
|
||||||
|
|
||||||
ScopedZone::ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active )
|
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, int32_t depth, bool is_active )
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@@ -63,55 +71,21 @@ ScopedZone::ScopedZone( const SourceLocationData* srcloc, int depth, bool is_act
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
m_connectionId = GetProfiler().ConnectionId();
|
||||||
#endif
|
#endif
|
||||||
GetProfiler().SendCallstack( depth );
|
auto zoneQueue = QueueType::ZoneBeginAllocSrcLoc;
|
||||||
|
if( depth > 0 && has_callstack() )
|
||||||
|
{
|
||||||
|
GetProfiler().SendCallstack( depth );
|
||||||
|
zoneQueue = QueueType::ZoneBeginAllocSrcLocCallstack;
|
||||||
|
}
|
||||||
|
TracyQueuePrepare( zoneQueue );
|
||||||
|
const auto srcloc =
|
||||||
|
Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz, color );
|
||||||
|
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
||||||
|
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
||||||
|
TracyQueueCommit( zoneBeginThread );
|
||||||
|
}
|
||||||
|
|
||||||
TracyQueuePrepare( QueueType::ZoneBeginCallstack );
|
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int32_t depth, bool is_active ) : ScopedZone( line, source, sourceSz, function, functionSz, name, nameSz, 0, depth, is_active ) {}
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
|
||||||
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
|
|
||||||
TracyQueueCommit( zoneBeginThread );
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, bool is_active )
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
|
||||||
#else
|
|
||||||
: m_active( is_active )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if( !m_active ) return;
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
|
||||||
#endif
|
|
||||||
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLoc );
|
|
||||||
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz, color );
|
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
|
||||||
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
|
||||||
TracyQueueCommit( zoneBeginThread );
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, bool is_active ) : ScopedZone( line, source, sourceSz, function, functionSz, name, nameSz, static_cast<uint32_t>(0), is_active ) {}
|
|
||||||
|
|
||||||
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, int depth, bool is_active )
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
|
||||||
#else
|
|
||||||
: m_active( is_active )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if( !m_active ) return;
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
|
||||||
m_connectionId = GetProfiler().ConnectionId();
|
|
||||||
#endif
|
|
||||||
GetProfiler().SendCallstack( depth );
|
|
||||||
|
|
||||||
TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLocCallstack );
|
|
||||||
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz, color );
|
|
||||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
|
|
||||||
MemWrite( &item->zoneBegin.srcloc, srcloc );
|
|
||||||
TracyQueueCommit( zoneBeginThread );
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int depth, bool is_active ) : ScopedZone( line, source, sourceSz, function, functionSz, name, nameSz, 0, depth, is_active ) {}
|
|
||||||
|
|
||||||
ScopedZone::~ScopedZone()
|
ScopedZone::~ScopedZone()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void SysPower::ScanDirectory( const char* path, int parent )
|
|||||||
FILE* f = fopen( tmp, "r" );
|
FILE* f = fopen( tmp, "r" );
|
||||||
if( f )
|
if( f )
|
||||||
{
|
{
|
||||||
fscanf( f, "%" PRIu64, &maxRange );
|
(void)fscanf( f, "%" PRIu64, &maxRange );
|
||||||
fclose( f );
|
fclose( f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
121
Source/ThirdParty/tracy/client/TracySysTrace.cpp
vendored
121
Source/ThirdParty/tracy/client/TracySysTrace.cpp
vendored
@@ -173,8 +173,11 @@ void WINAPI EventRecordCallback( PEVENT_RECORD record )
|
|||||||
MemWrite( &item->contextSwitch.oldThread, cswitch->oldThreadId );
|
MemWrite( &item->contextSwitch.oldThread, cswitch->oldThreadId );
|
||||||
MemWrite( &item->contextSwitch.newThread, cswitch->newThreadId );
|
MemWrite( &item->contextSwitch.newThread, cswitch->newThreadId );
|
||||||
MemWrite( &item->contextSwitch.cpu, record->BufferContext.ProcessorNumber );
|
MemWrite( &item->contextSwitch.cpu, record->BufferContext.ProcessorNumber );
|
||||||
MemWrite( &item->contextSwitch.reason, cswitch->oldThreadWaitReason );
|
MemWrite( &item->contextSwitch.oldThreadWaitReason, cswitch->oldThreadWaitReason );
|
||||||
MemWrite( &item->contextSwitch.state, cswitch->oldThreadState );
|
MemWrite( &item->contextSwitch.oldThreadState, cswitch->oldThreadState );
|
||||||
|
MemWrite( &item->contextSwitch.newThreadPriority, cswitch->newThreadPriority );
|
||||||
|
MemWrite( &item->contextSwitch.oldThreadPriority, cswitch->oldThreadPriority );
|
||||||
|
MemWrite( &item->contextSwitch.previousCState, cswitch->previousCState );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
else if( hdr.EventDescriptor.Opcode == 50 )
|
else if( hdr.EventDescriptor.Opcode == 50 )
|
||||||
@@ -183,7 +186,10 @@ void WINAPI EventRecordCallback( PEVENT_RECORD record )
|
|||||||
|
|
||||||
TracyLfqPrepare( QueueType::ThreadWakeup );
|
TracyLfqPrepare( QueueType::ThreadWakeup );
|
||||||
MemWrite( &item->threadWakeup.time, hdr.TimeStamp.QuadPart );
|
MemWrite( &item->threadWakeup.time, hdr.TimeStamp.QuadPart );
|
||||||
|
MemWrite( &item->threadWakeup.cpu, record->BufferContext.ProcessorNumber );
|
||||||
MemWrite( &item->threadWakeup.thread, rt->threadId );
|
MemWrite( &item->threadWakeup.thread, rt->threadId );
|
||||||
|
MemWrite( &item->threadWakeup.adjustReason, rt->adjustReason );
|
||||||
|
MemWrite( &item->threadWakeup.adjustIncrement, rt->adjustIncrement );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
else if( hdr.EventDescriptor.Opcode == 1 || hdr.EventDescriptor.Opcode == 3 )
|
else if( hdr.EventDescriptor.Opcode == 1 || hdr.EventDescriptor.Opcode == 3 )
|
||||||
@@ -498,11 +504,11 @@ void SysTraceGetExternalName( uint64_t thread, const char*& threadName, const ch
|
|||||||
if( _GetThreadDescription )
|
if( _GetThreadDescription )
|
||||||
{
|
{
|
||||||
PWSTR tmp;
|
PWSTR tmp;
|
||||||
_GetThreadDescription( hnd, &tmp );
|
if ( SUCCEEDED( _GetThreadDescription( hnd, &tmp ) ) )
|
||||||
char buf[256];
|
|
||||||
if( tmp )
|
|
||||||
{
|
{
|
||||||
|
char buf[256];
|
||||||
auto ret = wcstombs( buf, tmp, 256 );
|
auto ret = wcstombs( buf, tmp, 256 );
|
||||||
|
LocalFree(tmp);
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
{
|
{
|
||||||
threadName = CopyString( buf, ret );
|
threadName = CopyString( buf, ret );
|
||||||
@@ -678,7 +684,7 @@ enum TraceEventId
|
|||||||
EventBranchMiss,
|
EventBranchMiss,
|
||||||
EventVsync,
|
EventVsync,
|
||||||
EventContextSwitch,
|
EventContextSwitch,
|
||||||
EventWakeup,
|
EventWaking,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ProbePreciseIp( perf_event_attr& pe, unsigned long long config0, unsigned long long config1, pid_t pid )
|
static void ProbePreciseIp( perf_event_attr& pe, unsigned long long config0, unsigned long long config1, pid_t pid )
|
||||||
@@ -767,16 +773,16 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
TracyDebug( "perf_event_paranoid: %i\n", paranoidLevel );
|
TracyDebug( "perf_event_paranoid: %i\n", paranoidLevel );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int switchId = -1, wakeupId = -1, vsyncId = -1;
|
int switchId = -1, wakingId = -1, vsyncId = -1;
|
||||||
const auto switchIdStr = ReadFile( "/sys/kernel/debug/tracing/events/sched/sched_switch/id" );
|
const auto switchIdStr = ReadFile( "/sys/kernel/debug/tracing/events/sched/sched_switch/id" );
|
||||||
if( switchIdStr ) switchId = atoi( switchIdStr );
|
if( switchIdStr ) switchId = atoi( switchIdStr );
|
||||||
const auto wakeupIdStr = ReadFile( "/sys/kernel/debug/tracing/events/sched/sched_wakeup/id" );
|
const auto wakingIdStr = ReadFile( "/sys/kernel/debug/tracing/events/sched/sched_waking/id" );
|
||||||
if( wakeupIdStr ) wakeupId = atoi( wakeupIdStr );
|
if( wakingIdStr ) wakingId = atoi( wakingIdStr );
|
||||||
const auto vsyncIdStr = ReadFile( "/sys/kernel/debug/tracing/events/drm/drm_vblank_event/id" );
|
const auto vsyncIdStr = ReadFile( "/sys/kernel/debug/tracing/events/drm/drm_vblank_event/id" );
|
||||||
if( vsyncIdStr ) vsyncId = atoi( vsyncIdStr );
|
if( vsyncIdStr ) vsyncId = atoi( vsyncIdStr );
|
||||||
|
|
||||||
TracyDebug( "sched_switch id: %i\n", switchId );
|
TracyDebug( "sched_switch id: %i\n", switchId );
|
||||||
TracyDebug( "sched_wakeup id: %i\n", wakeupId );
|
TracyDebug( "sched_waking id: %i\n", wakingId );
|
||||||
TracyDebug( "drm_vblank_event id: %i\n", vsyncId );
|
TracyDebug( "drm_vblank_event id: %i\n", vsyncId );
|
||||||
|
|
||||||
#ifdef TRACY_NO_SAMPLING
|
#ifdef TRACY_NO_SAMPLING
|
||||||
@@ -831,7 +837,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
2 + // CPU cycles + instructions retired
|
2 + // CPU cycles + instructions retired
|
||||||
2 + // cache reference + miss
|
2 + // cache reference + miss
|
||||||
2 + // branch retired + miss
|
2 + // branch retired + miss
|
||||||
2 + // context switches + wakeups
|
2 + // context switches + waking ups
|
||||||
1 // vsync
|
1 // vsync
|
||||||
);
|
);
|
||||||
s_ring = (RingBuffer*)tracy_malloc( sizeof( RingBuffer ) * maxNumBuffers );
|
s_ring = (RingBuffer*)tracy_malloc( sizeof( RingBuffer ) * maxNumBuffers );
|
||||||
@@ -1076,18 +1082,31 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( wakeupId != -1 )
|
if( wakingId != -1 )
|
||||||
{
|
{
|
||||||
pe.config = wakeupId;
|
pe = {};
|
||||||
pe.config &= ~PERF_SAMPLE_CALLCHAIN;
|
pe.type = PERF_TYPE_TRACEPOINT;
|
||||||
|
pe.size = sizeof( perf_event_attr );
|
||||||
|
pe.sample_period = 1;
|
||||||
|
pe.sample_type = PERF_SAMPLE_TIME | PERF_SAMPLE_RAW;
|
||||||
|
// Coult ask for callstack here
|
||||||
|
//pe.sample_type |= PERF_SAMPLE_CALLCHAIN;
|
||||||
|
pe.disabled = 1;
|
||||||
|
pe.inherit = 1;
|
||||||
|
pe.config = wakingId;
|
||||||
|
pe.read_format = 0;
|
||||||
|
#if !defined TRACY_HW_TIMER || !( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
|
||||||
|
pe.use_clockid = 1;
|
||||||
|
pe.clockid = CLOCK_MONOTONIC_RAW;
|
||||||
|
#endif
|
||||||
|
|
||||||
TracyDebug( "Setup wakeup capture\n" );
|
TracyDebug( "Setup waking up capture\n" );
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
{
|
{
|
||||||
const int fd = perf_event_open( &pe, -1, i, -1, PERF_FLAG_FD_CLOEXEC );
|
const int fd = perf_event_open( &pe, -1, i, -1, PERF_FLAG_FD_CLOEXEC );
|
||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventWakeup, i );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventWaking, i );
|
||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
@@ -1332,6 +1351,7 @@ void SysTraceWorker( void* ptr )
|
|||||||
hadData = true;
|
hadData = true;
|
||||||
while( activeNum > 0 )
|
while( activeNum > 0 )
|
||||||
{
|
{
|
||||||
|
// Find the earliest event from the active buffers
|
||||||
int sel = -1;
|
int sel = -1;
|
||||||
int selPos;
|
int selPos;
|
||||||
int64_t t0 = std::numeric_limits<int64_t>::max();
|
int64_t t0 = std::numeric_limits<int64_t>::max();
|
||||||
@@ -1369,6 +1389,7 @@ void SysTraceWorker( void* ptr )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Found any event
|
||||||
if( sel >= 0 )
|
if( sel >= 0 )
|
||||||
{
|
{
|
||||||
auto& ring = ringArray[ctxBufferIdx + sel];
|
auto& ring = ringArray[ctxBufferIdx + sel];
|
||||||
@@ -1384,10 +1405,10 @@ void SysTraceWorker( void* ptr )
|
|||||||
const auto rid = ring.GetId();
|
const auto rid = ring.GetId();
|
||||||
if( rid == EventContextSwitch )
|
if( rid == EventContextSwitch )
|
||||||
{
|
{
|
||||||
// Layout:
|
// Layout: See /sys/kernel/debug/tracing/events/sched/sched_switch/format
|
||||||
// u64 time
|
// u64 time // PERF_SAMPLE_TIME
|
||||||
// u64 cnt
|
// u64 cnt // PERF_SAMPLE_CALLCHAIN
|
||||||
// u64 ip[cnt]
|
// u64 ip[cnt] // PERF_SAMPLE_CALLCHAIN
|
||||||
// u32 size
|
// u32 size
|
||||||
// u8 data[size]
|
// u8 data[size]
|
||||||
// Data (not ABI stable, but has not changed since it was added, in 2009):
|
// Data (not ABI stable, but has not changed since it was added, in 2009):
|
||||||
@@ -1408,35 +1429,43 @@ void SysTraceWorker( void* ptr )
|
|||||||
const auto traceOffset = offset;
|
const auto traceOffset = offset;
|
||||||
offset += sizeof( uint64_t ) * cnt + sizeof( uint32_t ) + 8 + 16;
|
offset += sizeof( uint64_t ) * cnt + sizeof( uint32_t ) + 8 + 16;
|
||||||
|
|
||||||
uint32_t prev_pid, next_pid;
|
uint32_t prev_pid, prev_prio;
|
||||||
|
uint32_t next_pid, next_prio;
|
||||||
long prev_state;
|
long prev_state;
|
||||||
|
|
||||||
ring.Read( &prev_pid, offset, sizeof( uint32_t ) );
|
ring.Read( &prev_pid, offset, sizeof( uint32_t ) );
|
||||||
offset += sizeof( uint32_t ) + sizeof( uint32_t );
|
offset += sizeof( uint32_t );
|
||||||
|
ring.Read( &prev_prio, offset, sizeof( uint32_t ) );
|
||||||
|
offset += sizeof( uint32_t );
|
||||||
ring.Read( &prev_state, offset, sizeof( long ) );
|
ring.Read( &prev_state, offset, sizeof( long ) );
|
||||||
offset += sizeof( long ) + 16;
|
offset += sizeof( long ) + 16;
|
||||||
ring.Read( &next_pid, offset, sizeof( uint32_t ) );
|
ring.Read( &next_pid, offset, sizeof( uint32_t ) );
|
||||||
|
offset += sizeof( uint32_t );
|
||||||
|
ring.Read( &next_prio, offset, sizeof( uint32_t ) );
|
||||||
|
|
||||||
uint8_t reason = 100;
|
uint8_t oldThreadWaitReason = 100;
|
||||||
uint8_t state;
|
uint8_t oldThreadState;
|
||||||
|
|
||||||
if( prev_state & 0x0001 ) state = 104;
|
if( prev_state & 0x0001 ) oldThreadState = 104;
|
||||||
else if( prev_state & 0x0002 ) state = 101;
|
else if( prev_state & 0x0002 ) oldThreadState = 101;
|
||||||
else if( prev_state & 0x0004 ) state = 105;
|
else if( prev_state & 0x0004 ) oldThreadState = 105;
|
||||||
else if( prev_state & 0x0008 ) state = 106;
|
else if( prev_state & 0x0008 ) oldThreadState = 106;
|
||||||
else if( prev_state & 0x0010 ) state = 108;
|
else if( prev_state & 0x0010 ) oldThreadState = 108;
|
||||||
else if( prev_state & 0x0020 ) state = 109;
|
else if( prev_state & 0x0020 ) oldThreadState = 109;
|
||||||
else if( prev_state & 0x0040 ) state = 110;
|
else if( prev_state & 0x0040 ) oldThreadState = 110;
|
||||||
else if( prev_state & 0x0080 ) state = 102;
|
else if( prev_state & 0x0080 ) oldThreadState = 102;
|
||||||
else state = 103;
|
else oldThreadState = 103;
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::ContextSwitch );
|
TracyLfqPrepare( QueueType::ContextSwitch );
|
||||||
MemWrite( &item->contextSwitch.time, t0 );
|
MemWrite( &item->contextSwitch.time, t0 );
|
||||||
MemWrite( &item->contextSwitch.oldThread, prev_pid );
|
MemWrite( &item->contextSwitch.oldThread, prev_pid );
|
||||||
MemWrite( &item->contextSwitch.newThread, next_pid );
|
MemWrite( &item->contextSwitch.newThread, next_pid );
|
||||||
MemWrite( &item->contextSwitch.cpu, uint8_t( ring.GetCpu() ) );
|
MemWrite( &item->contextSwitch.cpu, uint8_t( ring.GetCpu() ) );
|
||||||
MemWrite( &item->contextSwitch.reason, reason );
|
MemWrite( &item->contextSwitch.oldThreadWaitReason, oldThreadWaitReason );
|
||||||
MemWrite( &item->contextSwitch.state, state );
|
MemWrite( &item->contextSwitch.oldThreadState, oldThreadState );
|
||||||
|
MemWrite( &item->contextSwitch.previousCState, uint8_t( 0 ) );
|
||||||
|
MemWrite( &item->contextSwitch.newThreadPriority, int8_t( next_prio ) );
|
||||||
|
MemWrite( &item->contextSwitch.oldThreadPriority, int8_t( prev_prio ) );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
|
|
||||||
if( cnt > 0 && prev_pid != 0 && CurrentProcOwnsThread( prev_pid ) )
|
if( cnt > 0 && prev_pid != 0 && CurrentProcOwnsThread( prev_pid ) )
|
||||||
@@ -1450,27 +1479,33 @@ void SysTraceWorker( void* ptr )
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( rid == EventWakeup )
|
else if( rid == EventWaking)
|
||||||
{
|
{
|
||||||
|
// See /sys/kernel/debug/tracing/events/sched/sched_waking/format
|
||||||
// Layout:
|
// Layout:
|
||||||
// u64 time
|
// u64 time // PERF_SAMPLE_TIME
|
||||||
// u32 size
|
// u32 size
|
||||||
// u8 data[size]
|
// u8 data[size]
|
||||||
// Data:
|
// Data:
|
||||||
// u8 hdr[8]
|
// u8 hdr[8]
|
||||||
// u8 comm[16]
|
// u8 comm[16]
|
||||||
// u32 pid
|
// u32 pid
|
||||||
// u32 prio
|
// i32 prio
|
||||||
// u64 target_cpu
|
// i32 target_cpu
|
||||||
|
const uint32_t dataOffset = sizeof( perf_event_header ) + sizeof( uint64_t ) + sizeof( uint32_t );
|
||||||
offset += sizeof( perf_event_header ) + sizeof( uint64_t ) + sizeof( uint32_t ) + 8 + 16;
|
offset += dataOffset + 8 + 16;
|
||||||
|
|
||||||
uint32_t pid;
|
uint32_t pid;
|
||||||
ring.Read( &pid, offset, sizeof( uint32_t ) );
|
ring.Read( &pid, offset, sizeof( uint32_t ) );
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::ThreadWakeup );
|
TracyLfqPrepare( QueueType::ThreadWakeup );
|
||||||
MemWrite( &item->threadWakeup.time, t0 );
|
MemWrite( &item->threadWakeup.time, t0 );
|
||||||
MemWrite( &item->threadWakeup.thread, pid );
|
MemWrite( &item->threadWakeup.thread, pid );
|
||||||
|
MemWrite( &item->threadWakeup.cpu, (uint8_t)ring.GetCpu() );
|
||||||
|
|
||||||
|
int8_t adjustReason = -1; // Does not exist on Linux
|
||||||
|
int8_t adjustIncrement = 0; // Should perhaps store the new prio?
|
||||||
|
MemWrite( &item->threadWakeup.adjustReason, adjustReason );
|
||||||
|
MemWrite( &item->threadWakeup.adjustIncrement, adjustIncrement );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -690,7 +690,9 @@ static pthread_key_t _memory_thread_heap;
|
|||||||
# define _Thread_local __declspec(thread)
|
# define _Thread_local __declspec(thread)
|
||||||
# define TLS_MODEL
|
# define TLS_MODEL
|
||||||
# else
|
# else
|
||||||
# ifndef __HAIKU__
|
# if defined(__ANDROID__) && __ANDROID_API__ >= 29 && defined(__NDK_MAJOR__) && __NDK_MAJOR__ >= 26
|
||||||
|
# define TLS_MODEL __attribute__((tls_model("local-dynamic")))
|
||||||
|
# elif !defined(__HAIKU__)
|
||||||
# define TLS_MODEL __attribute__((tls_model("initial-exec")))
|
# define TLS_MODEL __attribute__((tls_model("initial-exec")))
|
||||||
# else
|
# else
|
||||||
# define TLS_MODEL
|
# define TLS_MODEL
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace tracy
|
|||||||
|
|
||||||
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
||||||
|
|
||||||
enum : uint32_t { ProtocolVersion = 69 };
|
enum : uint32_t { ProtocolVersion = 74 };
|
||||||
enum : uint16_t { BroadcastVersion = 3 };
|
enum : uint16_t { BroadcastVersion = 3 };
|
||||||
|
|
||||||
using lz4sz_t = uint32_t;
|
using lz4sz_t = uint32_t;
|
||||||
|
|||||||
27
Source/ThirdParty/tracy/common/TracyQueue.hpp
vendored
27
Source/ThirdParty/tracy/common/TracyQueue.hpp
vendored
@@ -42,6 +42,8 @@ enum class QueueType : uint8_t
|
|||||||
MemAllocCallstackNamed,
|
MemAllocCallstackNamed,
|
||||||
MemFreeCallstack,
|
MemFreeCallstack,
|
||||||
MemFreeCallstackNamed,
|
MemFreeCallstackNamed,
|
||||||
|
MemDiscard,
|
||||||
|
MemDiscardCallstack,
|
||||||
GpuZoneBegin,
|
GpuZoneBegin,
|
||||||
GpuZoneBeginCallstack,
|
GpuZoneBeginCallstack,
|
||||||
GpuZoneBeginAllocSrcLoc,
|
GpuZoneBeginAllocSrcLoc,
|
||||||
@@ -401,7 +403,10 @@ enum class GpuContextType : uint8_t
|
|||||||
Vulkan,
|
Vulkan,
|
||||||
OpenCL,
|
OpenCL,
|
||||||
Direct3D12,
|
Direct3D12,
|
||||||
Direct3D11
|
Direct3D11,
|
||||||
|
Metal,
|
||||||
|
Custom,
|
||||||
|
CUDA
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GpuContextFlags : uint8_t
|
enum GpuContextFlags : uint8_t
|
||||||
@@ -500,6 +505,13 @@ struct QueueMemFree
|
|||||||
uint64_t ptr;
|
uint64_t ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueMemDiscard
|
||||||
|
{
|
||||||
|
int64_t time;
|
||||||
|
uint32_t thread;
|
||||||
|
uint64_t name;
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueCallstackFat
|
struct QueueCallstackFat
|
||||||
{
|
{
|
||||||
uint64_t ptr;
|
uint64_t ptr;
|
||||||
@@ -593,14 +605,20 @@ struct QueueContextSwitch
|
|||||||
uint32_t oldThread;
|
uint32_t oldThread;
|
||||||
uint32_t newThread;
|
uint32_t newThread;
|
||||||
uint8_t cpu;
|
uint8_t cpu;
|
||||||
uint8_t reason;
|
uint8_t oldThreadWaitReason;
|
||||||
uint8_t state;
|
uint8_t oldThreadState;
|
||||||
|
uint8_t previousCState;
|
||||||
|
int8_t newThreadPriority;
|
||||||
|
int8_t oldThreadPriority;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QueueThreadWakeup
|
struct QueueThreadWakeup
|
||||||
{
|
{
|
||||||
int64_t time;
|
int64_t time;
|
||||||
uint32_t thread;
|
uint32_t thread;
|
||||||
|
uint8_t cpu;
|
||||||
|
int8_t adjustReason;
|
||||||
|
int8_t adjustIncrement;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QueueTidToPid
|
struct QueueTidToPid
|
||||||
@@ -740,6 +758,7 @@ struct QueueItem
|
|||||||
QueueGpuContextNameFat gpuContextNameFat;
|
QueueGpuContextNameFat gpuContextNameFat;
|
||||||
QueueMemAlloc memAlloc;
|
QueueMemAlloc memAlloc;
|
||||||
QueueMemFree memFree;
|
QueueMemFree memFree;
|
||||||
|
QueueMemDiscard memDiscard;
|
||||||
QueueMemNamePayload memName;
|
QueueMemNamePayload memName;
|
||||||
QueueThreadGroupHint threadGroupHint;
|
QueueThreadGroupHint threadGroupHint;
|
||||||
QueueCallstackFat callstackFat;
|
QueueCallstackFat callstackFat;
|
||||||
@@ -811,6 +830,8 @@ static constexpr size_t QueueDataSize[] = {
|
|||||||
sizeof( QueueHeader ) + sizeof( QueueMemAlloc ), // callstack, named
|
sizeof( QueueHeader ) + sizeof( QueueMemAlloc ), // callstack, named
|
||||||
sizeof( QueueHeader ) + sizeof( QueueMemFree ), // callstack
|
sizeof( QueueHeader ) + sizeof( QueueMemFree ), // callstack
|
||||||
sizeof( QueueHeader ) + sizeof( QueueMemFree ), // callstack, named
|
sizeof( QueueHeader ) + sizeof( QueueMemFree ), // callstack, named
|
||||||
|
sizeof( QueueHeader ) + sizeof( QueueMemDiscard ),
|
||||||
|
sizeof( QueueHeader ) + sizeof( QueueMemDiscard ), // callstack
|
||||||
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBegin ),
|
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBegin ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBegin ), // callstack
|
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBegin ), // callstack
|
||||||
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBeginLean ),// allocated source location
|
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBeginLean ),// allocated source location
|
||||||
|
|||||||
@@ -26,7 +26,9 @@
|
|||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#elif defined __FreeBSD__
|
#elif defined __FreeBSD__
|
||||||
# include <sys/thr.h>
|
# include <sys/thr.h>
|
||||||
#elif defined __NetBSD__ || defined __DragonFly__
|
#elif defined __NetBSD__
|
||||||
|
# include <lwp.h>
|
||||||
|
#elif defined __DragonFly__
|
||||||
# include <sys/lwp.h>
|
# include <sys/lwp.h>
|
||||||
#elif defined __QNX__
|
#elif defined __QNX__
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
|
|||||||
@@ -47,12 +47,9 @@ public:
|
|||||||
ScopedZone& operator=( const ScopedZone& ) = delete;
|
ScopedZone& operator=( const ScopedZone& ) = delete;
|
||||||
ScopedZone& operator=( ScopedZone&& ) = delete;
|
ScopedZone& operator=( ScopedZone&& ) = delete;
|
||||||
|
|
||||||
ScopedZone( const SourceLocationData* srcloc, bool is_active = true );
|
ScopedZone( const SourceLocationData* srcloc, int32_t depth = -1, bool is_active = true );
|
||||||
ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active = true );
|
ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, int32_t depth = -1, bool is_active = true );
|
||||||
ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, bool is_active );
|
ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int32_t depth, bool is_active = true );
|
||||||
ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, bool is_active = true );
|
|
||||||
ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, uint32_t color, int depth, bool is_active );
|
|
||||||
ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int depth, bool is_active = true );
|
|
||||||
|
|
||||||
~ScopedZone();
|
~ScopedZone();
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ namespace tracy
|
|||||||
namespace Version
|
namespace Version
|
||||||
{
|
{
|
||||||
enum { Major = 0 };
|
enum { Major = 0 };
|
||||||
enum { Minor = 11 };
|
enum { Minor = 12 };
|
||||||
enum { Patch = 1 };
|
enum { Patch = 0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
63
Source/ThirdParty/tracy/libbacktrace/dwarf.cpp
vendored
63
Source/ThirdParty/tracy/libbacktrace/dwarf.cpp
vendored
@@ -725,8 +725,8 @@ struct dwarf_data
|
|||||||
struct dwarf_data *next;
|
struct dwarf_data *next;
|
||||||
/* The data for .gnu_debugaltlink. */
|
/* The data for .gnu_debugaltlink. */
|
||||||
struct dwarf_data *altlink;
|
struct dwarf_data *altlink;
|
||||||
/* The base address for this file. */
|
/* The base address mapping for this file. */
|
||||||
uintptr_t base_address;
|
struct libbacktrace_base_address base_address;
|
||||||
/* A sorted list of address ranges. */
|
/* A sorted list of address ranges. */
|
||||||
struct unit_addrs *addrs;
|
struct unit_addrs *addrs;
|
||||||
/* Number of address ranges in list. */
|
/* Number of address ranges in list. */
|
||||||
@@ -1947,8 +1947,9 @@ update_pcrange (const struct attr* attr, const struct attr_val* val,
|
|||||||
static int
|
static int
|
||||||
add_low_high_range (struct backtrace_state *state,
|
add_low_high_range (struct backtrace_state *state,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
uintptr_t base_address, int is_bigendian,
|
struct libbacktrace_base_address base_address,
|
||||||
struct unit *u, const struct pcrange *pcrange,
|
int is_bigendian, struct unit *u,
|
||||||
|
const struct pcrange *pcrange,
|
||||||
int (*add_range) (struct backtrace_state *state,
|
int (*add_range) (struct backtrace_state *state,
|
||||||
void *rdata, uintptr_t lowpc,
|
void *rdata, uintptr_t lowpc,
|
||||||
uintptr_t highpc,
|
uintptr_t highpc,
|
||||||
@@ -1983,8 +1984,8 @@ add_low_high_range (struct backtrace_state *state,
|
|||||||
|
|
||||||
/* Add in the base address of the module when recording PC values,
|
/* Add in the base address of the module when recording PC values,
|
||||||
so that we can look up the PC directly. */
|
so that we can look up the PC directly. */
|
||||||
lowpc += base_address;
|
lowpc = libbacktrace_add_base (lowpc, base_address);
|
||||||
highpc += base_address;
|
highpc = libbacktrace_add_base (highpc, base_address);
|
||||||
|
|
||||||
return add_range (state, rdata, lowpc, highpc, error_callback, data, vec);
|
return add_range (state, rdata, lowpc, highpc, error_callback, data, vec);
|
||||||
}
|
}
|
||||||
@@ -1996,7 +1997,7 @@ static int
|
|||||||
add_ranges_from_ranges (
|
add_ranges_from_ranges (
|
||||||
struct backtrace_state *state,
|
struct backtrace_state *state,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
uintptr_t base_address, int is_bigendian,
|
struct libbacktrace_base_address base_address, int is_bigendian,
|
||||||
struct unit *u, uintptr_t base,
|
struct unit *u, uintptr_t base,
|
||||||
const struct pcrange *pcrange,
|
const struct pcrange *pcrange,
|
||||||
int (*add_range) (struct backtrace_state *state, void *rdata,
|
int (*add_range) (struct backtrace_state *state, void *rdata,
|
||||||
@@ -2042,10 +2043,11 @@ add_ranges_from_ranges (
|
|||||||
base = (uintptr_t) high;
|
base = (uintptr_t) high;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!add_range (state, rdata,
|
uintptr_t rl, rh;
|
||||||
(uintptr_t) low + base + base_address,
|
|
||||||
(uintptr_t) high + base + base_address,
|
rl = libbacktrace_add_base ((uintptr_t) low + base, base_address);
|
||||||
error_callback, data, vec))
|
rh = libbacktrace_add_base ((uintptr_t) high + base, base_address);
|
||||||
|
if (!add_range (state, rdata, rl, rh, error_callback, data, vec))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2063,7 +2065,7 @@ static int
|
|||||||
add_ranges_from_rnglists (
|
add_ranges_from_rnglists (
|
||||||
struct backtrace_state *state,
|
struct backtrace_state *state,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
uintptr_t base_address, int is_bigendian,
|
struct libbacktrace_base_address base_address, int is_bigendian,
|
||||||
struct unit *u, uintptr_t base,
|
struct unit *u, uintptr_t base,
|
||||||
const struct pcrange *pcrange,
|
const struct pcrange *pcrange,
|
||||||
int (*add_range) (struct backtrace_state *state, void *rdata,
|
int (*add_range) (struct backtrace_state *state, void *rdata,
|
||||||
@@ -2146,9 +2148,10 @@ add_ranges_from_rnglists (
|
|||||||
u->addrsize, is_bigendian, index,
|
u->addrsize, is_bigendian, index,
|
||||||
error_callback, data, &high))
|
error_callback, data, &high))
|
||||||
return 0;
|
return 0;
|
||||||
if (!add_range (state, rdata, low + base_address,
|
if (!add_range (state, rdata,
|
||||||
high + base_address, error_callback, data,
|
libbacktrace_add_base (low, base_address),
|
||||||
vec))
|
libbacktrace_add_base (high, base_address),
|
||||||
|
error_callback, data, vec))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2165,7 +2168,7 @@ add_ranges_from_rnglists (
|
|||||||
error_callback, data, &low))
|
error_callback, data, &low))
|
||||||
return 0;
|
return 0;
|
||||||
length = read_uleb128 (&rnglists_buf);
|
length = read_uleb128 (&rnglists_buf);
|
||||||
low += base_address;
|
low = libbacktrace_add_base (low, base_address);
|
||||||
if (!add_range (state, rdata, low, low + length,
|
if (!add_range (state, rdata, low, low + length,
|
||||||
error_callback, data, vec))
|
error_callback, data, vec))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2179,8 +2182,9 @@ add_ranges_from_rnglists (
|
|||||||
|
|
||||||
low = read_uleb128 (&rnglists_buf);
|
low = read_uleb128 (&rnglists_buf);
|
||||||
high = read_uleb128 (&rnglists_buf);
|
high = read_uleb128 (&rnglists_buf);
|
||||||
if (!add_range (state, rdata, low + base + base_address,
|
if (!add_range (state, rdata,
|
||||||
high + base + base_address,
|
libbacktrace_add_base (low + base, base_address),
|
||||||
|
libbacktrace_add_base (high + base, base_address),
|
||||||
error_callback, data, vec))
|
error_callback, data, vec))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2197,9 +2201,10 @@ add_ranges_from_rnglists (
|
|||||||
|
|
||||||
low = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
low = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
||||||
high = (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,
|
if (!add_range (state, rdata,
|
||||||
high + base_address, error_callback, data,
|
libbacktrace_add_base (low, base_address),
|
||||||
vec))
|
libbacktrace_add_base (high, base_address),
|
||||||
|
error_callback, data, vec))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2211,7 +2216,7 @@ add_ranges_from_rnglists (
|
|||||||
|
|
||||||
low = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
low = (uintptr_t) read_address (&rnglists_buf, u->addrsize);
|
||||||
length = (uintptr_t) read_uleb128 (&rnglists_buf);
|
length = (uintptr_t) read_uleb128 (&rnglists_buf);
|
||||||
low += base_address;
|
low = libbacktrace_add_base (low, base_address);
|
||||||
if (!add_range (state, rdata, low, low + length,
|
if (!add_range (state, rdata, low, low + length,
|
||||||
error_callback, data, vec))
|
error_callback, data, vec))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2239,7 +2244,7 @@ add_ranges_from_rnglists (
|
|||||||
static int
|
static int
|
||||||
add_ranges (struct backtrace_state *state,
|
add_ranges (struct backtrace_state *state,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
uintptr_t base_address, int is_bigendian,
|
struct libbacktrace_base_address base_address, int is_bigendian,
|
||||||
struct unit *u, uintptr_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,
|
int (*add_range) (struct backtrace_state *state, void *rdata,
|
||||||
uintptr_t lowpc, uintptr_t highpc,
|
uintptr_t lowpc, uintptr_t highpc,
|
||||||
@@ -2275,7 +2280,8 @@ add_ranges (struct backtrace_state *state,
|
|||||||
read, 0 if there is some error. */
|
read, 0 if there is some error. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
|
find_address_ranges (struct backtrace_state *state,
|
||||||
|
struct libbacktrace_base_address base_address,
|
||||||
struct dwarf_buf *unit_buf,
|
struct dwarf_buf *unit_buf,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
int is_bigendian, struct dwarf_data *altlink,
|
int is_bigendian, struct dwarf_data *altlink,
|
||||||
@@ -2430,7 +2436,8 @@ find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
|
|||||||
on success, 0 on failure. */
|
on success, 0 on failure. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
build_address_map (struct backtrace_state *state, uintptr_t base_address,
|
build_address_map (struct backtrace_state *state,
|
||||||
|
struct libbacktrace_base_address base_address,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
int is_bigendian, struct dwarf_data *altlink,
|
int is_bigendian, struct dwarf_data *altlink,
|
||||||
backtrace_error_callback error_callback, void *data,
|
backtrace_error_callback error_callback, void *data,
|
||||||
@@ -2649,7 +2656,7 @@ add_line (struct backtrace_state *state, struct dwarf_data *ddata,
|
|||||||
|
|
||||||
/* Add in the base address here, so that we can look up the PC
|
/* Add in the base address here, so that we can look up the PC
|
||||||
directly. */
|
directly. */
|
||||||
ln->pc = pc + ddata->base_address;
|
ln->pc = libbacktrace_add_base (pc, ddata->base_address);
|
||||||
|
|
||||||
ln->filename = filename;
|
ln->filename = filename;
|
||||||
ln->lineno = lineno;
|
ln->lineno = lineno;
|
||||||
@@ -4329,7 +4336,7 @@ dwarf_fileline (struct backtrace_state *state, uintptr_t pc,
|
|||||||
|
|
||||||
static struct dwarf_data *
|
static struct dwarf_data *
|
||||||
build_dwarf_data (struct backtrace_state *state,
|
build_dwarf_data (struct backtrace_state *state,
|
||||||
uintptr_t base_address,
|
struct libbacktrace_base_address base_address,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
int is_bigendian,
|
int is_bigendian,
|
||||||
struct dwarf_data *altlink,
|
struct dwarf_data *altlink,
|
||||||
@@ -4387,7 +4394,7 @@ build_dwarf_data (struct backtrace_state *state,
|
|||||||
|
|
||||||
int
|
int
|
||||||
backtrace_dwarf_add (struct backtrace_state *state,
|
backtrace_dwarf_add (struct backtrace_state *state,
|
||||||
uintptr_t base_address,
|
struct libbacktrace_base_address base_address,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
int is_bigendian,
|
int is_bigendian,
|
||||||
struct dwarf_data *fileline_altlink,
|
struct dwarf_data *fileline_altlink,
|
||||||
|
|||||||
84
Source/ThirdParty/tracy/libbacktrace/elf.cpp
vendored
84
Source/ThirdParty/tracy/libbacktrace/elf.cpp
vendored
@@ -643,7 +643,7 @@ elf_symbol_search (const void *vkey, const void *ventry)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
elf_initialize_syminfo (struct backtrace_state *state,
|
elf_initialize_syminfo (struct backtrace_state *state,
|
||||||
uintptr_t base_address,
|
struct libbacktrace_base_address base_address,
|
||||||
const unsigned char *symtab_data, size_t symtab_size,
|
const unsigned char *symtab_data, size_t symtab_size,
|
||||||
const unsigned char *strtab, size_t strtab_size,
|
const unsigned char *strtab, size_t strtab_size,
|
||||||
backtrace_error_callback error_callback,
|
backtrace_error_callback error_callback,
|
||||||
@@ -709,7 +709,8 @@ elf_initialize_syminfo (struct backtrace_state *state,
|
|||||||
= *(const b_elf_addr *) (opd->data + (sym->st_value - opd->addr));
|
= *(const b_elf_addr *) (opd->data + (sym->st_value - opd->addr));
|
||||||
else
|
else
|
||||||
elf_symbols[j].address = sym->st_value;
|
elf_symbols[j].address = sym->st_value;
|
||||||
elf_symbols[j].address += base_address;
|
elf_symbols[j].address =
|
||||||
|
libbacktrace_add_base (elf_symbols[j].address, base_address);
|
||||||
elf_symbols[j].size = sym->st_size;
|
elf_symbols[j].size = sym->st_size;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
@@ -1200,14 +1201,7 @@ elf_fetch_bits_backward (const unsigned char **ppin,
|
|||||||
val = *pval;
|
val = *pval;
|
||||||
|
|
||||||
if (unlikely (pin <= pinend))
|
if (unlikely (pin <= pinend))
|
||||||
{
|
return 1;
|
||||||
if (bits == 0)
|
|
||||||
{
|
|
||||||
elf_uncompress_failed ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pin -= 4;
|
pin -= 4;
|
||||||
|
|
||||||
@@ -5712,10 +5706,10 @@ elf_uncompress_lzma_block (const unsigned char *compressed,
|
|||||||
/* Block header CRC. */
|
/* Block header CRC. */
|
||||||
computed_crc = elf_crc32 (0, compressed + block_header_offset,
|
computed_crc = elf_crc32 (0, compressed + block_header_offset,
|
||||||
block_header_size - 4);
|
block_header_size - 4);
|
||||||
stream_crc = (compressed[off]
|
stream_crc = ((uint32_t)compressed[off]
|
||||||
| (compressed[off + 1] << 8)
|
| ((uint32_t)compressed[off + 1] << 8)
|
||||||
| (compressed[off + 2] << 16)
|
| ((uint32_t)compressed[off + 2] << 16)
|
||||||
| (compressed[off + 3] << 24));
|
| ((uint32_t)compressed[off + 3] << 24));
|
||||||
if (unlikely (computed_crc != stream_crc))
|
if (unlikely (computed_crc != stream_crc))
|
||||||
{
|
{
|
||||||
elf_uncompress_failed ();
|
elf_uncompress_failed ();
|
||||||
@@ -6222,10 +6216,10 @@ elf_uncompress_lzma_block (const unsigned char *compressed,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
computed_crc = elf_crc32 (0, uncompressed, uncompressed_offset);
|
computed_crc = elf_crc32 (0, uncompressed, uncompressed_offset);
|
||||||
stream_crc = (compressed[off]
|
stream_crc = ((uint32_t)compressed[off]
|
||||||
| (compressed[off + 1] << 8)
|
| ((uint32_t)compressed[off + 1] << 8)
|
||||||
| (compressed[off + 2] << 16)
|
| ((uint32_t)compressed[off + 2] << 16)
|
||||||
| (compressed[off + 3] << 24));
|
| ((uint32_t)compressed[off + 3] << 24));
|
||||||
if (computed_crc != stream_crc)
|
if (computed_crc != stream_crc)
|
||||||
{
|
{
|
||||||
elf_uncompress_failed ();
|
elf_uncompress_failed ();
|
||||||
@@ -6325,10 +6319,10 @@ elf_uncompress_lzma (struct backtrace_state *state,
|
|||||||
|
|
||||||
/* Next comes a CRC of the stream flags. */
|
/* Next comes a CRC of the stream flags. */
|
||||||
computed_crc = elf_crc32 (0, compressed + 6, 2);
|
computed_crc = elf_crc32 (0, compressed + 6, 2);
|
||||||
stream_crc = (compressed[8]
|
stream_crc = ((uint32_t)compressed[8]
|
||||||
| (compressed[9] << 8)
|
| ((uint32_t)compressed[9] << 8)
|
||||||
| (compressed[10] << 16)
|
| ((uint32_t)compressed[10] << 16)
|
||||||
| (compressed[11] << 24));
|
| ((uint32_t)compressed[11] << 24));
|
||||||
if (unlikely (computed_crc != stream_crc))
|
if (unlikely (computed_crc != stream_crc))
|
||||||
{
|
{
|
||||||
elf_uncompress_failed ();
|
elf_uncompress_failed ();
|
||||||
@@ -6369,10 +6363,10 @@ elf_uncompress_lzma (struct backtrace_state *state,
|
|||||||
|
|
||||||
/* Before that is a footer CRC. */
|
/* Before that is a footer CRC. */
|
||||||
computed_crc = elf_crc32 (0, compressed + offset, 6);
|
computed_crc = elf_crc32 (0, compressed + offset, 6);
|
||||||
stream_crc = (compressed[offset - 4]
|
stream_crc = ((uint32_t)compressed[offset - 4]
|
||||||
| (compressed[offset - 3] << 8)
|
| ((uint32_t)compressed[offset - 3] << 8)
|
||||||
| (compressed[offset - 2] << 16)
|
| ((uint32_t)compressed[offset - 2] << 16)
|
||||||
| (compressed[offset - 1] << 24));
|
| ((uint32_t)compressed[offset - 1] << 24));
|
||||||
if (unlikely (computed_crc != stream_crc))
|
if (unlikely (computed_crc != stream_crc))
|
||||||
{
|
{
|
||||||
elf_uncompress_failed ();
|
elf_uncompress_failed ();
|
||||||
@@ -6428,10 +6422,10 @@ elf_uncompress_lzma (struct backtrace_state *state,
|
|||||||
/* Next is a CRC of the index. */
|
/* Next is a CRC of the index. */
|
||||||
computed_crc = elf_crc32 (0, compressed + index_offset,
|
computed_crc = elf_crc32 (0, compressed + index_offset,
|
||||||
offset - index_offset);
|
offset - index_offset);
|
||||||
stream_crc = (compressed[offset]
|
stream_crc = ((uint32_t)compressed[offset]
|
||||||
| (compressed[offset + 1] << 8)
|
| ((uint32_t)compressed[offset + 1] << 8)
|
||||||
| (compressed[offset + 2] << 16)
|
| ((uint32_t)compressed[offset + 2] << 16)
|
||||||
| (compressed[offset + 3] << 24));
|
| ((uint32_t)compressed[offset + 3] << 24));
|
||||||
if (unlikely (computed_crc != stream_crc))
|
if (unlikely (computed_crc != stream_crc))
|
||||||
{
|
{
|
||||||
elf_uncompress_failed ();
|
elf_uncompress_failed ();
|
||||||
@@ -6524,7 +6518,8 @@ backtrace_uncompress_lzma (struct backtrace_state *state,
|
|||||||
static int
|
static int
|
||||||
elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||||
const unsigned char *memory, size_t memory_size,
|
const unsigned char *memory, size_t memory_size,
|
||||||
uintptr_t base_address, struct elf_ppc64_opd_data *caller_opd,
|
struct libbacktrace_base_address base_address,
|
||||||
|
struct elf_ppc64_opd_data *caller_opd,
|
||||||
backtrace_error_callback error_callback, void *data,
|
backtrace_error_callback error_callback, void *data,
|
||||||
fileline *fileline_fn, int *found_sym, int *found_dwarf,
|
fileline *fileline_fn, int *found_sym, int *found_dwarf,
|
||||||
struct dwarf_data **fileline_entry, int exe, int debuginfo,
|
struct dwarf_data **fileline_entry, int exe, int debuginfo,
|
||||||
@@ -6867,7 +6862,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gnu_debugdata_view_valid
|
if (!debuginfo
|
||||||
|
&& !gnu_debugdata_view_valid
|
||||||
&& strcmp (name, ".gnu_debugdata") == 0)
|
&& strcmp (name, ".gnu_debugdata") == 0)
|
||||||
{
|
{
|
||||||
if (!elf_get_view (state, descriptor, memory, memory_size,
|
if (!elf_get_view (state, descriptor, memory, memory_size,
|
||||||
@@ -7425,6 +7421,7 @@ phdr_callback (struct PhdrIterate *info, void *pdata)
|
|||||||
const char *filename;
|
const char *filename;
|
||||||
int descriptor;
|
int descriptor;
|
||||||
int does_not_exist;
|
int does_not_exist;
|
||||||
|
struct libbacktrace_base_address base_address;
|
||||||
fileline elf_fileline_fn;
|
fileline elf_fileline_fn;
|
||||||
int found_dwarf;
|
int found_dwarf;
|
||||||
|
|
||||||
@@ -7454,7 +7451,8 @@ phdr_callback (struct PhdrIterate *info, void *pdata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elf_add (pd->state, filename, descriptor, NULL, 0, info->dlpi_addr, NULL,
|
base_address.m = info->dlpi_addr;
|
||||||
|
if (elf_add (pd->state, filename, descriptor, NULL, 0, base_address, NULL,
|
||||||
pd->error_callback, pd->data, &elf_fileline_fn, pd->found_sym,
|
pd->error_callback, pd->data, &elf_fileline_fn, pd->found_sym,
|
||||||
&found_dwarf, NULL, 0, 0, NULL, 0))
|
&found_dwarf, NULL, 0, 0, NULL, 0))
|
||||||
{
|
{
|
||||||
@@ -7543,11 +7541,21 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
|||||||
fileline elf_fileline_fn = elf_nodebug;
|
fileline elf_fileline_fn = elf_nodebug;
|
||||||
struct phdr_data pd;
|
struct phdr_data pd;
|
||||||
|
|
||||||
ret = elf_add (state, filename, descriptor, NULL, 0, 0, NULL, error_callback,
|
|
||||||
data, &elf_fileline_fn, &found_sym, &found_dwarf, NULL, 1, 0,
|
/* When using fdpic we must use dl_iterate_phdr for all modules, including
|
||||||
NULL, 0);
|
the main executable, so that we can get the right base address
|
||||||
if (!ret)
|
mapping. */
|
||||||
return 0;
|
if (!libbacktrace_using_fdpic ())
|
||||||
|
{
|
||||||
|
struct libbacktrace_base_address zero_base_address;
|
||||||
|
|
||||||
|
memset (&zero_base_address, 0, sizeof zero_base_address);
|
||||||
|
ret = elf_add (state, filename, descriptor, NULL, 0, zero_base_address,
|
||||||
|
NULL, error_callback, data, &elf_fileline_fn, &found_sym,
|
||||||
|
&found_dwarf, NULL, 1, 0, NULL, 0);
|
||||||
|
if (!ret)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
pd.state = state;
|
pd.state = state;
|
||||||
pd.error_callback = error_callback;
|
pd.error_callback = error_callback;
|
||||||
|
|||||||
@@ -333,10 +333,44 @@ struct dwarf_sections
|
|||||||
|
|
||||||
struct dwarf_data;
|
struct dwarf_data;
|
||||||
|
|
||||||
|
/* The load address mapping. */
|
||||||
|
|
||||||
|
#if defined(__FDPIC__) && defined(HAVE_DL_ITERATE_PHDR) && (defined(HAVE_LINK_H) || defined(HAVE_SYS_LINK_H))
|
||||||
|
|
||||||
|
#ifdef HAVE_LINK_H
|
||||||
|
#include <link.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_LINK_H
|
||||||
|
#include <sys/link.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define libbacktrace_using_fdpic() (1)
|
||||||
|
|
||||||
|
struct libbacktrace_base_address
|
||||||
|
{
|
||||||
|
struct elf32_fdpic_loadaddr m;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define libbacktrace_add_base(pc, base) \
|
||||||
|
((uintptr_t) (__RELOC_POINTER ((pc), (base).m)))
|
||||||
|
|
||||||
|
#else /* not _FDPIC__ */
|
||||||
|
|
||||||
|
#define libbacktrace_using_fdpic() (0)
|
||||||
|
|
||||||
|
struct libbacktrace_base_address
|
||||||
|
{
|
||||||
|
uintptr_t m;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define libbacktrace_add_base(pc, base) ((pc) + (base).m)
|
||||||
|
|
||||||
|
#endif /* not _FDPIC__ */
|
||||||
|
|
||||||
/* Add file/line information for a DWARF module. */
|
/* Add file/line information for a DWARF module. */
|
||||||
|
|
||||||
extern int backtrace_dwarf_add (struct backtrace_state *state,
|
extern int backtrace_dwarf_add (struct backtrace_state *state,
|
||||||
uintptr_t base_address,
|
struct libbacktrace_base_address base_address,
|
||||||
const struct dwarf_sections *dwarf_sections,
|
const struct dwarf_sections *dwarf_sections,
|
||||||
int is_bigendian,
|
int is_bigendian,
|
||||||
struct dwarf_data *fileline_altlink,
|
struct dwarf_data *fileline_altlink,
|
||||||
|
|||||||
41
Source/ThirdParty/tracy/libbacktrace/macho.cpp
vendored
41
Source/ThirdParty/tracy/libbacktrace/macho.cpp
vendored
@@ -274,12 +274,14 @@ struct macho_nlist_64
|
|||||||
|
|
||||||
/* Value found in nlist n_type field. */
|
/* Value found in nlist n_type field. */
|
||||||
|
|
||||||
#define MACH_O_N_EXT 0x01 /* Extern symbol */
|
|
||||||
#define MACH_O_N_ABS 0x02 /* Absolute symbol */
|
|
||||||
#define MACH_O_N_SECT 0x0e /* Defined in section */
|
|
||||||
|
|
||||||
#define MACH_O_N_TYPE 0x0e /* Mask for type bits */
|
|
||||||
#define MACH_O_N_STAB 0xe0 /* Stabs debugging symbol */
|
#define MACH_O_N_STAB 0xe0 /* Stabs debugging symbol */
|
||||||
|
#define MACH_O_N_TYPE 0x0e /* Mask for type bits */
|
||||||
|
|
||||||
|
/* Values found after masking with MACH_O_N_TYPE. */
|
||||||
|
#define MACH_O_N_UNDF 0x00 /* Undefined symbol */
|
||||||
|
#define MACH_O_N_ABS 0x02 /* Absolute symbol */
|
||||||
|
#define MACH_O_N_SECT 0x0e /* Defined in section from n_sect field */
|
||||||
|
|
||||||
|
|
||||||
/* Information we keep for a Mach-O symbol. */
|
/* Information we keep for a Mach-O symbol. */
|
||||||
|
|
||||||
@@ -316,8 +318,9 @@ static const char * const dwarf_section_names[DEBUG_MAX] =
|
|||||||
/* Forward declaration. */
|
/* Forward declaration. */
|
||||||
|
|
||||||
static int macho_add (struct backtrace_state *, const char *, int, off_t,
|
static int macho_add (struct backtrace_state *, const char *, int, off_t,
|
||||||
const unsigned char *, uintptr_t, int,
|
const unsigned char *, struct libbacktrace_base_address,
|
||||||
backtrace_error_callback, void *, fileline *, int *);
|
int, backtrace_error_callback, void *, fileline *,
|
||||||
|
int *);
|
||||||
|
|
||||||
/* A dummy callback function used when we can't find any debug info. */
|
/* A dummy callback function used when we can't find any debug info. */
|
||||||
|
|
||||||
@@ -495,10 +498,10 @@ macho_defined_symbol (uint8_t type)
|
|||||||
{
|
{
|
||||||
if ((type & MACH_O_N_STAB) != 0)
|
if ((type & MACH_O_N_STAB) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
if ((type & MACH_O_N_EXT) != 0)
|
|
||||||
return 0;
|
|
||||||
switch (type & MACH_O_N_TYPE)
|
switch (type & MACH_O_N_TYPE)
|
||||||
{
|
{
|
||||||
|
case MACH_O_N_UNDF:
|
||||||
|
return 0;
|
||||||
case MACH_O_N_ABS:
|
case MACH_O_N_ABS:
|
||||||
return 1;
|
return 1;
|
||||||
case MACH_O_N_SECT:
|
case MACH_O_N_SECT:
|
||||||
@@ -512,7 +515,7 @@ macho_defined_symbol (uint8_t type)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
macho_add_symtab (struct backtrace_state *state, int descriptor,
|
macho_add_symtab (struct backtrace_state *state, int descriptor,
|
||||||
uintptr_t base_address, int is_64,
|
struct libbacktrace_base_address base_address, int is_64,
|
||||||
off_t symoff, unsigned int nsyms, off_t stroff,
|
off_t symoff, unsigned int nsyms, off_t stroff,
|
||||||
unsigned int strsize,
|
unsigned int strsize,
|
||||||
backtrace_error_callback error_callback, void *data)
|
backtrace_error_callback error_callback, void *data)
|
||||||
@@ -627,7 +630,7 @@ macho_add_symtab (struct backtrace_state *state, int descriptor,
|
|||||||
if (name[0] == '_')
|
if (name[0] == '_')
|
||||||
++name;
|
++name;
|
||||||
macho_symbols[j].name = name;
|
macho_symbols[j].name = name;
|
||||||
macho_symbols[j].address = value + base_address;
|
macho_symbols[j].address = libbacktrace_add_base (value, base_address);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -760,7 +763,8 @@ macho_syminfo (struct backtrace_state *state, uintptr_t addr,
|
|||||||
static int
|
static int
|
||||||
macho_add_fat (struct backtrace_state *state, const char *filename,
|
macho_add_fat (struct backtrace_state *state, const char *filename,
|
||||||
int descriptor, int swapped, off_t offset,
|
int descriptor, int swapped, off_t offset,
|
||||||
const unsigned char *match_uuid, uintptr_t base_address,
|
const unsigned char *match_uuid,
|
||||||
|
struct libbacktrace_base_address base_address,
|
||||||
int skip_symtab, uint32_t nfat_arch, int is_64,
|
int skip_symtab, uint32_t nfat_arch, int is_64,
|
||||||
backtrace_error_callback error_callback, void *data,
|
backtrace_error_callback error_callback, void *data,
|
||||||
fileline *fileline_fn, int *found_sym)
|
fileline *fileline_fn, int *found_sym)
|
||||||
@@ -862,7 +866,8 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
macho_add_dsym (struct backtrace_state *state, const char *filename,
|
macho_add_dsym (struct backtrace_state *state, const char *filename,
|
||||||
uintptr_t base_address, const unsigned char *uuid,
|
struct libbacktrace_base_address base_address,
|
||||||
|
const unsigned char *uuid,
|
||||||
backtrace_error_callback error_callback, void *data,
|
backtrace_error_callback error_callback, void *data,
|
||||||
fileline* fileline_fn)
|
fileline* fileline_fn)
|
||||||
{
|
{
|
||||||
@@ -980,7 +985,7 @@ macho_add_dsym (struct backtrace_state *state, const char *filename,
|
|||||||
static int
|
static int
|
||||||
macho_add (struct backtrace_state *state, const char *filename, int descriptor,
|
macho_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||||
off_t offset, const unsigned char *match_uuid,
|
off_t offset, const unsigned char *match_uuid,
|
||||||
uintptr_t base_address, int skip_symtab,
|
struct libbacktrace_base_address base_address, int skip_symtab,
|
||||||
backtrace_error_callback error_callback, void *data,
|
backtrace_error_callback error_callback, void *data,
|
||||||
fileline *fileline_fn, int *found_sym)
|
fileline *fileline_fn, int *found_sym)
|
||||||
{
|
{
|
||||||
@@ -1242,7 +1247,7 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
|||||||
c = _dyld_image_count ();
|
c = _dyld_image_count ();
|
||||||
for (i = 0; i < c; ++i)
|
for (i = 0; i < c; ++i)
|
||||||
{
|
{
|
||||||
uintptr_t base_address;
|
struct libbacktrace_base_address base_address;
|
||||||
const char *name;
|
const char *name;
|
||||||
int d;
|
int d;
|
||||||
fileline mff;
|
fileline mff;
|
||||||
@@ -1266,7 +1271,7 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
base_address = _dyld_get_image_vmaddr_slide (i);
|
base_address.m = _dyld_get_image_vmaddr_slide (i);
|
||||||
|
|
||||||
mff = macho_nodebug;
|
mff = macho_nodebug;
|
||||||
if (!macho_add (state, name, d, 0, NULL, base_address, 0,
|
if (!macho_add (state, name, d, 0, NULL, base_address, 0,
|
||||||
@@ -1321,10 +1326,12 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
|||||||
void *data, fileline *fileline_fn)
|
void *data, fileline *fileline_fn)
|
||||||
{
|
{
|
||||||
fileline macho_fileline_fn;
|
fileline macho_fileline_fn;
|
||||||
|
struct libbacktrace_base_address zero_base_address;
|
||||||
int found_sym;
|
int found_sym;
|
||||||
|
|
||||||
macho_fileline_fn = macho_nodebug;
|
macho_fileline_fn = macho_nodebug;
|
||||||
if (!macho_add (state, filename, descriptor, 0, NULL, 0, 0,
|
memset (&zero_base_address, 0, sizeof zero_base_address);
|
||||||
|
if (!macho_add (state, filename, descriptor, 0, NULL, zero_base_address, 0,
|
||||||
error_callback, data, &macho_fileline_fn, &found_sym))
|
error_callback, data, &macho_fileline_fn, &found_sym))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
156
Source/ThirdParty/tracy/tracy/Tracy.hpp
vendored
156
Source/ThirdParty/tracy/tracy/Tracy.hpp
vendored
@@ -10,7 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TracyLine
|
#ifndef TracyLine
|
||||||
# define TracyLine __LINE__
|
# define TracyLine TracyConcat(__LINE__,U) // MSVC Edit and continue __LINE__ is non-constant. See https://developercommunity.visualstudio.com/t/-line-cannot-be-used-as-an-argument-for-constexpr/195665
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRACY_ENABLE
|
#ifndef TRACY_ENABLE
|
||||||
@@ -59,8 +59,10 @@
|
|||||||
|
|
||||||
#define TracyAlloc(x,y)
|
#define TracyAlloc(x,y)
|
||||||
#define TracyFree(x)
|
#define TracyFree(x)
|
||||||
|
#define TracyMemoryDiscard(x)
|
||||||
#define TracySecureAlloc(x,y)
|
#define TracySecureAlloc(x,y)
|
||||||
#define TracySecureFree(x)
|
#define TracySecureFree(x)
|
||||||
|
#define TracySecureMemoryDiscard(x)
|
||||||
|
|
||||||
#define TracyAllocN(x,y,z)
|
#define TracyAllocN(x,y,z)
|
||||||
#define TracyFreeN(x,y)
|
#define TracyFreeN(x,y)
|
||||||
@@ -82,8 +84,10 @@
|
|||||||
|
|
||||||
#define TracyAllocS(x,y,z)
|
#define TracyAllocS(x,y,z)
|
||||||
#define TracyFreeS(x,y)
|
#define TracyFreeS(x,y)
|
||||||
|
#define TracyMemoryDiscardS(x,y)
|
||||||
#define TracySecureAllocS(x,y,z)
|
#define TracySecureAllocS(x,y,z)
|
||||||
#define TracySecureFreeS(x,y)
|
#define TracySecureFreeS(x,y)
|
||||||
|
#define TracySecureMemoryDiscardS(x,y)
|
||||||
|
|
||||||
#define TracyAllocNS(x,y,z,w)
|
#define TracyAllocNS(x,y,z,w)
|
||||||
#define TracyFreeNS(x,y,z)
|
#define TracyFreeNS(x,y,z)
|
||||||
@@ -145,27 +149,20 @@ public:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TRACY_CALLSTACK
|
||||||
|
#define TRACY_CALLSTACK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TracyNoop tracy::ProfilerAvailable()
|
#define TracyNoop tracy::ProfilerAvailable()
|
||||||
|
|
||||||
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
|
#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 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 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 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 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( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), nullptr, 0, 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 )
|
#define ZoneTransientN( varname, name, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), TRACY_CALLSTACK, active )
|
||||||
# define ZoneTransientNC( varname, name, color, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), color, TRACY_CALLSTACK, active )
|
#define ZoneTransientNC( varname, name, color, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), color, TRACY_CALLSTACK, active )
|
||||||
#else
|
|
||||||
# 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( 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 )
|
|
||||||
# define ZoneTransientNC( varname, name, color, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), color, active )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ZoneScoped ZoneNamed( ___tracy_scoped_zone, true )
|
#define ZoneScoped ZoneNamed( ___tracy_scoped_zone, true )
|
||||||
#define ZoneScopedN( name ) ZoneNamedN( ___tracy_scoped_zone, name, true )
|
#define ZoneScopedN( name ) ZoneNamedN( ___tracy_scoped_zone, name, true )
|
||||||
@@ -200,7 +197,7 @@ public:
|
|||||||
#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 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 LockableBase( type ) tracy::Lockable<type>
|
||||||
#define SharedLockableBase( type ) tracy::SharedLockable<type>
|
#define SharedLockableBase( type ) tracy::SharedLockable<type>
|
||||||
#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 LockMark( varname ) static constexpr tracy::SourceLocationData __tracy_lock_location_##__LINE__ { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; varname.Mark( &__tracy_lock_location_##__LINE__ )
|
||||||
#define LockableName( varname, txt, size ) varname.CustomName( txt, size )
|
#define LockableName( varname, txt, size ) varname.CustomName( txt, size )
|
||||||
|
|
||||||
#define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val )
|
#define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val )
|
||||||
@@ -208,95 +205,52 @@ public:
|
|||||||
|
|
||||||
#define TracyAppInfo( txt, size ) tracy::Profiler::MessageAppInfo( txt, size )
|
#define TracyAppInfo( txt, size ) tracy::Profiler::MessageAppInfo( txt, size )
|
||||||
|
|
||||||
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
|
#define TracyMessage( txt, size ) tracy::Profiler::Message( txt, size, TRACY_CALLSTACK )
|
||||||
# define TracyMessage( txt, size ) tracy::Profiler::Message( txt, size, TRACY_CALLSTACK )
|
#define TracyMessageL( txt ) tracy::Profiler::Message( txt, TRACY_CALLSTACK )
|
||||||
# define TracyMessageL( txt ) tracy::Profiler::Message( txt, TRACY_CALLSTACK )
|
#define TracyMessageC( txt, size, color ) tracy::Profiler::MessageColor( txt, size, color, TRACY_CALLSTACK )
|
||||||
# define TracyMessageC( txt, size, color ) tracy::Profiler::MessageColor( txt, size, color, TRACY_CALLSTACK )
|
#define TracyMessageLC( txt, color ) tracy::Profiler::MessageColor( txt, color, TRACY_CALLSTACK )
|
||||||
# define TracyMessageLC( txt, color ) tracy::Profiler::MessageColor( txt, color, TRACY_CALLSTACK )
|
|
||||||
|
|
||||||
# define TracyAlloc( ptr, size ) tracy::Profiler::MemAllocCallstack( ptr, size, TRACY_CALLSTACK, false )
|
#define TracyAlloc( ptr, size ) tracy::Profiler::MemAllocCallstack( ptr, size, TRACY_CALLSTACK, false )
|
||||||
# define TracyFree( ptr ) tracy::Profiler::MemFreeCallstack( ptr, TRACY_CALLSTACK, false )
|
#define TracyFree( ptr ) tracy::Profiler::MemFreeCallstack( ptr, TRACY_CALLSTACK, false )
|
||||||
# define TracySecureAlloc( ptr, size ) tracy::Profiler::MemAllocCallstack( ptr, size, TRACY_CALLSTACK, true )
|
#define TracySecureAlloc( ptr, size ) tracy::Profiler::MemAllocCallstack( ptr, size, TRACY_CALLSTACK, true )
|
||||||
# define TracySecureFree( ptr ) tracy::Profiler::MemFreeCallstack( ptr, TRACY_CALLSTACK, true )
|
#define TracySecureFree( ptr ) tracy::Profiler::MemFreeCallstack( ptr, TRACY_CALLSTACK, true )
|
||||||
|
|
||||||
# define TracyAllocN( ptr, size, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, TRACY_CALLSTACK, false, name )
|
#define TracyAllocN( ptr, size, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, TRACY_CALLSTACK, false, name )
|
||||||
# define TracyFreeN( ptr, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, TRACY_CALLSTACK, false, name )
|
#define TracyFreeN( ptr, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, TRACY_CALLSTACK, false, name )
|
||||||
# define TracySecureAllocN( ptr, size, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, TRACY_CALLSTACK, true, name )
|
#define TracyMemoryDiscard( name ) tracy::Profiler::MemDiscardCallstack( name, false, TRACY_CALLSTACK )
|
||||||
# define TracySecureFreeN( ptr, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, TRACY_CALLSTACK, true, name )
|
#define TracySecureAllocN( ptr, size, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, TRACY_CALLSTACK, true, name )
|
||||||
#else
|
#define TracySecureFreeN( ptr, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, TRACY_CALLSTACK, true, name )
|
||||||
# define TracyMessage( txt, size ) tracy::Profiler::Message( txt, size, 0 )
|
#define TracySecureMemoryDiscard( name ) tracy::Profiler::MemDiscardCallstack( name, true, TRACY_CALLSTACK )
|
||||||
# define TracyMessageL( txt ) tracy::Profiler::Message( txt, 0 )
|
|
||||||
# define TracyMessageC( txt, size, color ) tracy::Profiler::MessageColor( txt, size, color, 0 )
|
|
||||||
# define TracyMessageLC( txt, color ) tracy::Profiler::MessageColor( txt, color, 0 )
|
|
||||||
|
|
||||||
# define TracyAlloc( ptr, size ) tracy::Profiler::MemAlloc( ptr, size, false )
|
#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 TracyFree( ptr ) tracy::Profiler::MemFree( ptr, false )
|
#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 TracySecureAlloc( ptr, size ) tracy::Profiler::MemAlloc( ptr, size, true )
|
#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 TracySecureFree( ptr ) tracy::Profiler::MemFree( ptr, true )
|
#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 TracyAllocN( ptr, size, name ) tracy::Profiler::MemAllocNamed( ptr, size, false, name )
|
#define ZoneTransientS( varname, depth, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), nullptr, 0, depth, active )
|
||||||
# define TracyFreeN( ptr, name ) tracy::Profiler::MemFreeNamed( ptr, false, name )
|
#define ZoneTransientNS( varname, name, depth, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), depth, active )
|
||||||
# define TracySecureAllocN( ptr, size, name ) tracy::Profiler::MemAllocNamed( ptr, size, true, name )
|
|
||||||
# define TracySecureFreeN( ptr, name ) tracy::Profiler::MemFreeNamed( ptr, true, name )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
#define ZoneScopedS( depth ) ZoneNamedS( ___tracy_scoped_zone, depth, true )
|
||||||
# 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 ZoneScopedNS( name, depth ) ZoneNamedNS( ___tracy_scoped_zone, name, depth, true )
|
||||||
# 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 ZoneScopedCS( color, depth ) ZoneNamedCS( ___tracy_scoped_zone, color, depth, true )
|
||||||
# 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 ZoneScopedNCS( name, color, depth ) ZoneNamedNCS( ___tracy_scoped_zone, name, color, depth, true )
|
||||||
# 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( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), nullptr, 0, depth, active )
|
#define TracyAllocS( ptr, size, depth ) tracy::Profiler::MemAllocCallstack( ptr, size, depth, false )
|
||||||
# define ZoneTransientNS( varname, name, depth, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), depth, active )
|
#define TracyFreeS( ptr, depth ) tracy::Profiler::MemFreeCallstack( ptr, depth, false )
|
||||||
|
#define TracySecureAllocS( ptr, size, depth ) tracy::Profiler::MemAllocCallstack( ptr, size, depth, true )
|
||||||
|
#define TracySecureFreeS( ptr, depth ) tracy::Profiler::MemFreeCallstack( ptr, depth, true )
|
||||||
|
|
||||||
# define ZoneScopedS( depth ) ZoneNamedS( ___tracy_scoped_zone, depth, true )
|
#define TracyAllocNS( ptr, size, depth, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, depth, false, name )
|
||||||
# define ZoneScopedNS( name, depth ) ZoneNamedNS( ___tracy_scoped_zone, name, depth, true )
|
#define TracyFreeNS( ptr, depth, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, depth, false, name )
|
||||||
# define ZoneScopedCS( color, depth ) ZoneNamedCS( ___tracy_scoped_zone, color, depth, true )
|
#define TracyMemoryDiscardS( name, depth ) tracy::Profiler::MemDiscardCallstack( name, false, depth )
|
||||||
# define ZoneScopedNCS( name, color, depth ) ZoneNamedNCS( ___tracy_scoped_zone, name, color, depth, true )
|
#define TracySecureAllocNS( ptr, size, depth, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, depth, true, name )
|
||||||
|
#define TracySecureFreeNS( ptr, depth, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, depth, true, name )
|
||||||
|
#define TracySecureMemoryDiscardS( name, depth ) tracy::Profiler::MemDiscardCallstack( name, true, depth )
|
||||||
|
|
||||||
# define TracyAllocS( ptr, size, depth ) tracy::Profiler::MemAllocCallstack( ptr, size, depth, false )
|
#define TracyMessageS( txt, size, depth ) tracy::Profiler::Message( txt, size, depth )
|
||||||
# define TracyFreeS( ptr, depth ) tracy::Profiler::MemFreeCallstack( ptr, depth, false )
|
#define TracyMessageLS( txt, depth ) tracy::Profiler::Message( txt, depth )
|
||||||
# define TracySecureAllocS( ptr, size, depth ) tracy::Profiler::MemAllocCallstack( ptr, size, depth, true )
|
#define TracyMessageCS( txt, size, color, depth ) tracy::Profiler::MessageColor( txt, size, color, depth )
|
||||||
# define TracySecureFreeS( ptr, depth ) tracy::Profiler::MemFreeCallstack( ptr, depth, true )
|
#define TracyMessageLCS( txt, color, depth ) tracy::Profiler::MessageColor( txt, color, depth )
|
||||||
|
|
||||||
# define TracyAllocNS( ptr, size, depth, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, depth, false, name )
|
|
||||||
# define TracyFreeNS( ptr, depth, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, depth, false, name )
|
|
||||||
# define TracySecureAllocNS( ptr, size, depth, name ) tracy::Profiler::MemAllocCallstackNamed( ptr, size, depth, true, name )
|
|
||||||
# define TracySecureFreeNS( ptr, depth, name ) tracy::Profiler::MemFreeCallstackNamed( ptr, depth, true, name )
|
|
||||||
|
|
||||||
# define TracyMessageS( txt, size, depth ) tracy::Profiler::Message( txt, size, depth )
|
|
||||||
# define TracyMessageLS( txt, depth ) tracy::Profiler::Message( txt, depth )
|
|
||||||
# define TracyMessageCS( txt, size, color, depth ) tracy::Profiler::MessageColor( txt, size, color, depth )
|
|
||||||
# define TracyMessageLCS( txt, color, depth ) tracy::Profiler::MessageColor( txt, color, depth )
|
|
||||||
#else
|
|
||||||
# define ZoneNamedS( varname, depth, active ) ZoneNamed( varname, active )
|
|
||||||
# define ZoneNamedNS( varname, name, depth, active ) ZoneNamedN( varname, name, active )
|
|
||||||
# define ZoneNamedCS( varname, color, depth, active ) ZoneNamedC( varname, color, active )
|
|
||||||
# define ZoneNamedNCS( varname, name, color, depth, active ) ZoneNamedNC( varname, name, color, active )
|
|
||||||
|
|
||||||
# define ZoneTransientS( varname, depth, active ) ZoneTransient( varname, active )
|
|
||||||
# define ZoneTransientNS( varname, name, depth, active ) ZoneTransientN( varname, name, active )
|
|
||||||
|
|
||||||
# define ZoneScopedS( depth ) ZoneScoped
|
|
||||||
# define ZoneScopedNS( name, depth ) ZoneScopedN( name )
|
|
||||||
# define ZoneScopedCS( color, depth ) ZoneScopedC( color )
|
|
||||||
# define ZoneScopedNCS( name, color, depth ) ZoneScopedNC( name, color )
|
|
||||||
|
|
||||||
# define TracyAllocS( ptr, size, depth ) TracyAlloc( ptr, size )
|
|
||||||
# define TracyFreeS( ptr, depth ) TracyFree( ptr )
|
|
||||||
# define TracySecureAllocS( ptr, size, depth ) TracySecureAlloc( ptr, size )
|
|
||||||
# define TracySecureFreeS( ptr, depth ) TracySecureFree( ptr )
|
|
||||||
|
|
||||||
# define TracyAllocNS( ptr, size, depth, name ) TracyAllocN( ptr, size, name )
|
|
||||||
# define TracyFreeNS( ptr, depth, name ) TracyFreeN( ptr, name )
|
|
||||||
# define TracySecureAllocNS( ptr, size, depth, name ) TracySecureAllocN( ptr, size, name )
|
|
||||||
# define TracySecureFreeNS( ptr, depth, name ) TracySecureFreeN( ptr, name )
|
|
||||||
|
|
||||||
# define TracyMessageS( txt, size, depth ) TracyMessage( txt, size )
|
|
||||||
# define TracyMessageLS( txt, depth ) TracyMessageL( txt )
|
|
||||||
# define TracyMessageCS( txt, size, color, depth ) TracyMessageC( txt, size, color )
|
|
||||||
# define TracyMessageLCS( txt, color, depth ) TracyMessageLC( txt, color )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TracySourceCallbackRegister( cb, data ) tracy::Profiler::SourceCallbackRegister( cb, data )
|
#define TracySourceCallbackRegister( cb, data ) tracy::Profiler::SourceCallbackRegister( cb, data )
|
||||||
#define TracyParameterRegister( cb, data ) tracy::Profiler::ParameterRegister( cb, data )
|
#define TracyParameterRegister( cb, data ) tracy::Profiler::ParameterRegister( cb, data )
|
||||||
|
|||||||
Reference in New Issue
Block a user