mirror of
https://github.com/wolfpld/tracy
synced 2026-01-19 04:52:09 +00:00
TracyDebug now uses TracyInternalMessage by default unless TRACY_VERBOSE or TRACY_NO_INTERNAL_MESSAGE is defined
This commit is contained in:
@@ -146,6 +146,8 @@ set_option(TRACY_IGNORE_MEMORY_FAULTS "Ignore instrumentation errors from memory
|
|||||||
# advanced
|
# advanced
|
||||||
set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF)
|
set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF)
|
||||||
mark_as_advanced(TRACY_VERBOSE)
|
mark_as_advanced(TRACY_VERBOSE)
|
||||||
|
set_option(TRACY_NO_INTERNAL_MESSAGE "[advanced] Prevent the profiler from logging messages" OFF)
|
||||||
|
mark_as_advanced(TRACY_NO_INTERNAL_MESSAGE)
|
||||||
set_option(TRACY_DEMANGLE "[advanced] Don't use default demangling function - You'll need to provide your own" OFF)
|
set_option(TRACY_DEMANGLE "[advanced] Don't use default demangling function - You'll need to provide your own" OFF)
|
||||||
mark_as_advanced(TRACY_DEMANGLE)
|
mark_as_advanced(TRACY_DEMANGLE)
|
||||||
if(rocprofiler-sdk_FOUND)
|
if(rocprofiler-sdk_FOUND)
|
||||||
|
|||||||
@@ -646,7 +646,8 @@ Although the basic features will work without them, you'll have to grant elevate
|
|||||||
|
|
||||||
\subsubsection{Troubleshooting}
|
\subsubsection{Troubleshooting}
|
||||||
|
|
||||||
Setting the \texttt{TRACY\_VERBOSE} variable will make the client display advanced information about the detected features. By matching those debug prints to the source code, you might be able to uncover why some of the features are missing on your platform.
|
By default, Tracy's diagnostics will be sent as Message logs (section~\ref{messagelog}) to the server.
|
||||||
|
Setting the \texttt{TRACY\_NO\_INTERNAL\_MESSAGE} define will disable this feature, but setting the \texttt{TRACY\_VERBOSE} will make the client print advanced information about the detected features to the standard error output. By matching those debug prints to the source code, you might be able to uncover why some of the features are missing on your platform.
|
||||||
|
|
||||||
\subsubsection{Changing network port}
|
\subsubsection{Changing network port}
|
||||||
|
|
||||||
@@ -1492,7 +1493,7 @@ Fast navigation in large data sets and correlating zones with what was happening
|
|||||||
If you want to include color coding of the messages (for example to make critical messages easily visible), you can use \texttt{TracyMessageC(text, size, color)} or \texttt{TracyMessageLC(text, color)} macros.
|
If you want to include color coding of the messages (for example to make critical messages easily visible), you can use \texttt{TracyMessageC(text, size, color)} or \texttt{TracyMessageLC(text, color)} macros.
|
||||||
|
|
||||||
Messages can also have different severity levels: \texttt{Trace}, \texttt{Debug}, \texttt{Info}, \texttt{Warning}, \texttt{Error} or \texttt{Fatal}.
|
Messages can also have different severity levels: \texttt{Trace}, \texttt{Debug}, \texttt{Info}, \texttt{Warning}, \texttt{Error} or \texttt{Fatal}.
|
||||||
The previous macros will log messages with the severity "Info". To log a message with a different severity, you may use the \texttt{TracyLogString} macro that regroups all the functionalities from the previous macros. We recommend writing your own macros, wrapping the different severities for easier use. You may provide a color of 0 if you do not want to set a color for this message.
|
The \texttt{TracyMessage} macros will log messages with the severity \texttt{Info}. To log a message with a different severity, you may use the \texttt{TracyLogString} macro that regroups all the functionalities from the previous macros. We recommend writing your own macros, wrapping the different severities for easier use. You may provide a color of 0 if you do not want to set a color for this message.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
|
|||||||
@@ -114,6 +114,10 @@ if get_option('verbose')
|
|||||||
tracy_common_args += ['-DTRACY_VERBOSE']
|
tracy_common_args += ['-DTRACY_VERBOSE']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('no_internal_message')
|
||||||
|
tracy_common_args += ['-DTRACY_NO_INTERNAL_MESSAGE']
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('debuginfod')
|
if get_option('debuginfod')
|
||||||
tracy_common_args += ['-DTRACY_DEBUGINFOD']
|
tracy_common_args += ['-DTRACY_DEBUGINFOD']
|
||||||
tracy_public_deps += dependency('libdebuginfod')
|
tracy_public_deps += dependency('libdebuginfod')
|
||||||
|
|||||||
@@ -24,5 +24,6 @@ option('manual_lifetime', type : 'boolean', value : false, description : 'Enable
|
|||||||
option('fibers', type : 'boolean', value : false, description : 'Enable fibers support')
|
option('fibers', type : 'boolean', value : false, description : 'Enable fibers support')
|
||||||
option('no_crash_handler', type : 'boolean', value : false, description : 'Disable crash handling')
|
option('no_crash_handler', type : 'boolean', value : false, description : 'Disable crash handling')
|
||||||
option('verbose', type : 'boolean', value : false, description : 'Enable verbose logging')
|
option('verbose', type : 'boolean', value : false, description : 'Enable verbose logging')
|
||||||
|
option('no_internal_message', type : 'boolean', value : false, description : 'Prevent the profiler from logging messages')
|
||||||
option('debuginfod', type : 'boolean', value : false, description : 'Enable debuginfod support')
|
option('debuginfod', type : 'boolean', value : false, description : 'Enable debuginfod support')
|
||||||
option('ignore_memory_faults', type : 'boolean', value : false, description : 'Ignore instrumentation errors from memory free events that do not have a matching allocation')
|
option('ignore_memory_faults', type : 'boolean', value : false, description : 'Ignore instrumentation errors from memory free events that do not have a matching allocation')
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ void InitCallstack()
|
|||||||
#endif //#ifndef TRACY_SYMBOL_OFFLINE_RESOLVE
|
#endif //#ifndef TRACY_SYMBOL_OFFLINE_RESOLVE
|
||||||
if( s_shouldResolveSymbolsOffline )
|
if( s_shouldResolveSymbolsOffline )
|
||||||
{
|
{
|
||||||
TracyDebug("TRACY: enabling offline symbol resolving!\n");
|
TracyDebug( "TRACY: enabling offline symbol resolving!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateImageCaches();
|
CreateImageCaches();
|
||||||
@@ -551,7 +551,7 @@ void InitCallstack()
|
|||||||
const bool initTimeModuleLoad = !( noInitLoadEnv && noInitLoadEnv[0] == '1' );
|
const bool initTimeModuleLoad = !( noInitLoadEnv && noInitLoadEnv[0] == '1' );
|
||||||
if ( !initTimeModuleLoad )
|
if ( !initTimeModuleLoad )
|
||||||
{
|
{
|
||||||
TracyDebug("TRACY: skipping init time dbghelper module load\n");
|
TracyDebug( "TRACY: skipping init time dbghelper module load" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -963,7 +963,7 @@ static void InitKernelSymbols()
|
|||||||
}
|
}
|
||||||
assert( dst == s_kernelSym + validCnt );
|
assert( dst == s_kernelSym + validCnt );
|
||||||
|
|
||||||
TracyDebug( "Loaded %zu kernel symbols (%zu code sections)\n", tmpSym.size(), validCnt );
|
TracyDebug( "Loaded %zu kernel symbols (%zu code sections)", tmpSym.size(), validCnt );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1040,7 +1040,7 @@ void InitCallstack()
|
|||||||
if( s_shouldResolveSymbolsOffline )
|
if( s_shouldResolveSymbolsOffline )
|
||||||
{
|
{
|
||||||
cb_bts = nullptr; // disable use of libbacktrace calls
|
cb_bts = nullptr; // disable use of libbacktrace calls
|
||||||
TracyDebug("TRACY: enabling offline symbol resolving!\n");
|
TracyDebug( "TRACY: enabling offline symbol resolving!" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1100,7 +1100,7 @@ int GetDebugInfoDescriptor( const char* buildid_data, size_t buildid_size, const
|
|||||||
it->filename = (char*)tracy_malloc( fnsz );
|
it->filename = (char*)tracy_malloc( fnsz );
|
||||||
memcpy( it->filename, filename, fnsz );
|
memcpy( it->filename, filename, fnsz );
|
||||||
it->fd = fd >= 0 ? fd : -1;
|
it->fd = fd >= 0 ? fd : -1;
|
||||||
TracyDebug( "DebugInfo descriptor query: %i, fn: %s\n", fd, filename );
|
TracyDebug( "DebugInfo descriptor query: %i, fn: %s", fd, filename );
|
||||||
return it->fd;
|
return it->fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
#ifndef __TRACYPRINT_HPP__
|
#ifndef __TRACYPRINT_HPP__
|
||||||
#define __TRACYPRINT_HPP__
|
#define __TRACYPRINT_HPP__
|
||||||
|
|
||||||
|
#ifdef TRACY_ON_DEMAND
|
||||||
|
# define TRACY_VERBOSE_EARLY_OUT_COND if( !GetProfiler().IsConnected() ) break
|
||||||
|
#else
|
||||||
|
# define TRACY_VERBOSE_EARLY_OUT_COND assert( tracy::ProfilerAvailable() )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TracyInternalMessage( severity, ... ) \
|
||||||
|
do { \
|
||||||
|
TRACY_VERBOSE_EARLY_OUT_COND; \
|
||||||
|
char buffer[4096]; \
|
||||||
|
snprintf( buffer, sizeof(buffer), __VA_ARGS__ ); \
|
||||||
|
tracy::Profiler::LogString( tracy::MessageSourceType::Tracy, severity, 0, TRACY_CALLSTACK, strlen( buffer ), buffer ); \
|
||||||
|
} while( 0 )
|
||||||
|
|
||||||
#ifdef TRACY_VERBOSE
|
#ifdef TRACY_VERBOSE
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# define TracyDebug(...) fprintf( stderr, __VA_ARGS__ );
|
# define TracyDebug(...) do { fprintf( stderr, __VA_ARGS__ ); fputc( '\n', stderr ); } while( 0 )
|
||||||
|
#elif !defined(TRACY_NO_INTERNAL_MESSAGE)
|
||||||
|
# define TracyDebug(...) TracyInternalMessage( tracy::MessageSeverity::Debug, __VA_ARGS__ )
|
||||||
#else
|
#else
|
||||||
# define TracyDebug(...)
|
# define TracyDebug(...)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ KCore::KCore()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::sort( m_offsets.begin(), m_offsets.end(), []( const Offset& lhs, const Offset& rhs ) { return lhs.start < rhs.start; } );
|
std::sort( m_offsets.begin(), m_offsets.end(), []( const Offset& lhs, const Offset& rhs ) { return lhs.start < rhs.start; } );
|
||||||
TracyDebug( "KCore: %zu segments found\n", m_offsets.size() );
|
TracyDebug( "KCore: %zu segments found", m_offsets.size() );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ extern "C" int dlclose( void* hnd )
|
|||||||
struct link_map* lm;
|
struct link_map* lm;
|
||||||
if( dlinfo( hnd, RTLD_DI_LINKMAP, &lm ) == 0 )
|
if( dlinfo( hnd, RTLD_DI_LINKMAP, &lm ) == 0 )
|
||||||
{
|
{
|
||||||
TracyDebug( "Overriding dlclose for %s\n", lm->l_name );
|
TracyDebug( "Overriding dlclose for %s", lm->l_name );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TracyDebug( "Overriding dlclose for unknown object (%s)\n", dlerror() );
|
TracyDebug( "Overriding dlclose for unknown object (%s)", dlerror() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1180,7 +1180,7 @@ static void StartSystemTracing( int64_t& samplingPeriod )
|
|||||||
const bool disableSystrace = ( noSysTrace && noSysTrace[0] == '1' );
|
const bool disableSystrace = ( noSysTrace && noSysTrace[0] == '1' );
|
||||||
if( disableSystrace )
|
if( disableSystrace )
|
||||||
{
|
{
|
||||||
TracyDebug( "TRACY: Sys Trace was disabled by 'TRACY_NO_SYS_TRACE=1'\n" );
|
TracyDebug( "TRACY: Sys Trace was disabled by 'TRACY_NO_SYS_TRACE=1'" );
|
||||||
}
|
}
|
||||||
else if( SysTraceStart( samplingPeriod ) )
|
else if( SysTraceStart( samplingPeriod ) )
|
||||||
{
|
{
|
||||||
@@ -4239,7 +4239,7 @@ void Profiler::HandleSourceCodeQuery( char* data, char* image, uint32_t id )
|
|||||||
if( buildid )
|
if( buildid )
|
||||||
{
|
{
|
||||||
auto d = debuginfod_find_source( GetDebuginfodClient(), buildid, size, data, nullptr );
|
auto d = debuginfod_find_source( GetDebuginfodClient(), buildid, size, data, nullptr );
|
||||||
TracyDebug( "DebugInfo source query: %s, fn: %s, image: %s\n", d >= 0 ? " ok " : "fail", data, image );
|
TracyDebug( "DebugInfo source query: %s, fn: %s, image: %s", d >= 0 ? " ok " : "fail", data, image );
|
||||||
if( d >= 0 )
|
if( d >= 0 )
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@@ -4269,7 +4269,7 @@ void Profiler::HandleSourceCodeQuery( char* data, char* image, uint32_t id )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TracyDebug( "DebugInfo invalid query fn: %s, image: %s\n", data, image );
|
TracyDebug( "DebugInfo invalid query fn: %s, image: %s", data, image );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
auto mapAddr = mmap( nullptr, m_mapSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
|
auto mapAddr = mmap( nullptr, m_mapSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
|
||||||
if( mapAddr == MAP_FAILED )
|
if( mapAddr == MAP_FAILED )
|
||||||
{
|
{
|
||||||
TracyDebug( "mmap failed: errno %i (%s)\n", errno, strerror( errno ) );
|
TracyDebug( "mmap failed: errno %i (%s)", errno, strerror( errno ) );
|
||||||
m_fd = 0;
|
m_fd = 0;
|
||||||
m_metadata = nullptr;
|
m_metadata = nullptr;
|
||||||
close( fd );
|
close( fd );
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void SysPower::ScanDirectory( const char* path, int parent )
|
|||||||
domain->overflow = maxRange;
|
domain->overflow = maxRange;
|
||||||
domain->handle = handle;
|
domain->handle = handle;
|
||||||
domain->name = name;
|
domain->name = name;
|
||||||
TracyDebug( "Power domain id %i, %s found at %s\n", parent, name, path );
|
TracyDebug( "Power domain id %i, %s found at %s", parent, name, path );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ static void ProbePreciseIp( perf_event_attr& pe, unsigned long long config0, uns
|
|||||||
}
|
}
|
||||||
pe.precise_ip--;
|
pe.precise_ip--;
|
||||||
}
|
}
|
||||||
TracyDebug( " Probed precise_ip: %i\n", pe.precise_ip );
|
TracyDebug( " Probed precise_ip: %i", pe.precise_ip );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProbePreciseIp( perf_event_attr& pe, pid_t pid )
|
static void ProbePreciseIp( perf_event_attr& pe, pid_t pid )
|
||||||
@@ -509,7 +509,7 @@ static void ProbePreciseIp( perf_event_attr& pe, pid_t pid )
|
|||||||
}
|
}
|
||||||
pe.precise_ip--;
|
pe.precise_ip--;
|
||||||
}
|
}
|
||||||
TracyDebug( " Probed precise_ip: %i\n", pe.precise_ip );
|
TracyDebug( " Probed precise_ip: %i", pe.precise_ip );
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsGenuineIntel()
|
static bool IsGenuineIntel()
|
||||||
@@ -587,12 +587,12 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
#ifdef TRACY_VERBOSE
|
#ifdef TRACY_VERBOSE
|
||||||
int paranoidLevel = 2;
|
int paranoidLevel = 2;
|
||||||
paranoidLevel = atoi( paranoidLevelStr );
|
paranoidLevel = atoi( paranoidLevelStr );
|
||||||
TracyDebug( "perf_event_paranoid: %i\n", paranoidLevel );
|
TracyDebug( "perf_event_paranoid: %i", paranoidLevel );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto traceFsPath = GetTraceFsPath();
|
auto traceFsPath = GetTraceFsPath();
|
||||||
if( !traceFsPath ) return false;
|
if( !traceFsPath ) return false;
|
||||||
TracyDebug( "tracefs path: %s\n", traceFsPath );
|
TracyDebug( "tracefs path: %s", traceFsPath );
|
||||||
|
|
||||||
int switchId = -1, wakingId = -1, vsyncId = -1;
|
int switchId = -1, wakingId = -1, vsyncId = -1;
|
||||||
const auto switchIdStr = ReadFile( traceFsPath, "/events/sched/sched_switch/id" );
|
const auto switchIdStr = ReadFile( traceFsPath, "/events/sched/sched_switch/id" );
|
||||||
@@ -604,9 +604,9 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
|
|
||||||
tracy_free( traceFsPath );
|
tracy_free( traceFsPath );
|
||||||
|
|
||||||
TracyDebug( "sched_switch id: %i\n", switchId );
|
TracyDebug( "sched_switch id: %i", switchId );
|
||||||
TracyDebug( "sched_waking id: %i\n", wakingId );
|
TracyDebug( "sched_waking id: %i", wakingId );
|
||||||
TracyDebug( "drm_vblank_event id: %i\n", vsyncId );
|
TracyDebug( "drm_vblank_event id: %i", vsyncId );
|
||||||
|
|
||||||
#ifdef TRACY_NO_SAMPLING
|
#ifdef TRACY_NO_SAMPLING
|
||||||
const bool noSoftwareSampling = true;
|
const bool noSoftwareSampling = true;
|
||||||
@@ -686,7 +686,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
|
|
||||||
if( !noSoftwareSampling )
|
if( !noSoftwareSampling )
|
||||||
{
|
{
|
||||||
TracyDebug( "Setup software sampling\n" );
|
TracyDebug( "Setup software sampling" );
|
||||||
ProbePreciseIp( pe, currentPid );
|
ProbePreciseIp( pe, currentPid );
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
{
|
{
|
||||||
@@ -698,16 +698,16 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
|
fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
|
||||||
if( fd == -1 )
|
if( fd == -1 )
|
||||||
{
|
{
|
||||||
TracyDebug( " Failed to setup!\n");
|
TracyDebug( " Failed to setup!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TracyDebug( " No access to kernel samples\n" );
|
TracyDebug( " No access to kernel samples" );
|
||||||
}
|
}
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
|
||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -731,7 +731,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
|
|
||||||
if( !noRetirement )
|
if( !noRetirement )
|
||||||
{
|
{
|
||||||
TracyDebug( "Setup sampling cycles + retirement\n" );
|
TracyDebug( "Setup sampling cycles + retirement" );
|
||||||
ProbePreciseIp( pe, PERF_COUNT_HW_CPU_CYCLES, PERF_COUNT_HW_INSTRUCTIONS, currentPid );
|
ProbePreciseIp( pe, PERF_COUNT_HW_CPU_CYCLES, PERF_COUNT_HW_INSTRUCTIONS, currentPid );
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
{
|
{
|
||||||
@@ -742,7 +742,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -757,7 +757,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -766,12 +766,12 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
// cache reference + miss
|
// cache reference + miss
|
||||||
if( !noCache )
|
if( !noCache )
|
||||||
{
|
{
|
||||||
TracyDebug( "Setup sampling CPU cache references + misses\n" );
|
TracyDebug( "Setup sampling CPU cache references + misses" );
|
||||||
ProbePreciseIp( pe, PERF_COUNT_HW_CACHE_REFERENCES, PERF_COUNT_HW_CACHE_MISSES, currentPid );
|
ProbePreciseIp( pe, PERF_COUNT_HW_CACHE_REFERENCES, PERF_COUNT_HW_CACHE_MISSES, currentPid );
|
||||||
if( IsGenuineIntel() )
|
if( IsGenuineIntel() )
|
||||||
{
|
{
|
||||||
pe.precise_ip = 0;
|
pe.precise_ip = 0;
|
||||||
TracyDebug( " CPU is GenuineIntel, forcing precise_ip down to 0\n" );
|
TracyDebug( " CPU is GenuineIntel, forcing precise_ip down to 0" );
|
||||||
}
|
}
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
{
|
{
|
||||||
@@ -782,7 +782,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -797,7 +797,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -806,7 +806,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
// branch retired + miss
|
// branch retired + miss
|
||||||
if( !noBranch )
|
if( !noBranch )
|
||||||
{
|
{
|
||||||
TracyDebug( "Setup sampling CPU branch retirements + misses\n" );
|
TracyDebug( "Setup sampling CPU branch retirements + misses" );
|
||||||
ProbePreciseIp( pe, PERF_COUNT_HW_BRANCH_INSTRUCTIONS, PERF_COUNT_HW_BRANCH_MISSES, currentPid );
|
ProbePreciseIp( pe, PERF_COUNT_HW_BRANCH_INSTRUCTIONS, PERF_COUNT_HW_BRANCH_MISSES, currentPid );
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
{
|
{
|
||||||
@@ -817,7 +817,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -855,7 +855,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
pe.clockid = CLOCK_MONOTONIC_RAW;
|
pe.clockid = CLOCK_MONOTONIC_RAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TracyDebug( "Setup vsync capture\n" );
|
TracyDebug( "Setup vsync capture" );
|
||||||
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 );
|
||||||
@@ -865,7 +865,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -890,7 +890,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
pe.clockid = CLOCK_MONOTONIC_RAW;
|
pe.clockid = CLOCK_MONOTONIC_RAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TracyDebug( "Setup context switch capture\n" );
|
TracyDebug( "Setup context switch capture" );
|
||||||
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 );
|
||||||
@@ -900,7 +900,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -923,7 +923,7 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
pe.clockid = CLOCK_MONOTONIC_RAW;
|
pe.clockid = CLOCK_MONOTONIC_RAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TracyDebug( "Setup waking up capture\n" );
|
TracyDebug( "Setup waking up capture" );
|
||||||
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 );
|
||||||
@@ -933,14 +933,14 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( s_ring[s_numBuffers].IsValid() )
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
{
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TracyDebug( "Ringbuffers in use: %i\n", s_numBuffers );
|
TracyDebug( "Ringbuffers in use: %i", s_numBuffers );
|
||||||
|
|
||||||
traceActive.store( true, std::memory_order_relaxed );
|
traceActive.store( true, std::memory_order_relaxed );
|
||||||
return true;
|
return true;
|
||||||
@@ -994,7 +994,7 @@ void SysTraceWorker( void* ptr )
|
|||||||
SetThreadName( "Tracy Sampling" );
|
SetThreadName( "Tracy Sampling" );
|
||||||
InitRpmalloc();
|
InitRpmalloc();
|
||||||
sched_param sp = { 99 };
|
sched_param sp = { 99 };
|
||||||
if( pthread_setschedparam( pthread_self(), SCHED_FIFO, &sp ) != 0 ) TracyDebug( "Failed to increase SysTraceWorker thread priority!\n" );
|
if( pthread_setschedparam( pthread_self(), SCHED_FIFO, &sp ) != 0 ) TracyDebug( "Failed to increase SysTraceWorker thread priority!" );
|
||||||
auto ctxBufferIdx = s_ctxBufferIdx;
|
auto ctxBufferIdx = s_ctxBufferIdx;
|
||||||
auto ringArray = s_ring;
|
auto ringArray = s_ring;
|
||||||
auto numBuffers = s_numBuffers;
|
auto numBuffers = s_numBuffers;
|
||||||
|
|||||||
@@ -133,12 +133,14 @@ constexpr uint32_t Color_Red4 = 0x8b0000; // TracyColor.hpp
|
|||||||
|
|
||||||
static void ETWErrorAction( ULONG error_code, const char* message, int length )
|
static void ETWErrorAction( ULONG error_code, const char* message, int length )
|
||||||
{
|
{
|
||||||
|
#ifndef TRACY_NO_INTERNAL_MESSAGE
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
#ifdef TRACY_HAS_CALLSTACK
|
||||||
tracy::InitCallstackCritical();
|
tracy::InitCallstackCritical();
|
||||||
tracy::Profiler::MessageColor( MessageSourceType::Tracy, MessageSeverity::Error, message, length, Color_Red4, 60 );
|
tracy::Profiler::MessageColor( MessageSourceType::Tracy, MessageSeverity::Error, message, length, Color_Red4, 60 );
|
||||||
#else
|
#else
|
||||||
tracy::Profiler::MessageColor( MessageSourceType::Tracy, MessageSeverity::Error, message, length, Color_Red4, 0 );
|
tracy::Profiler::MessageColor( MessageSourceType::Tracy, MessageSeverity::Error, message, length, Color_Red4, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef __cpp_exceptions
|
#ifdef __cpp_exceptions
|
||||||
// TODO: should we throw an exception?
|
// TODO: should we throw an exception?
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user