From d48794024dacfae3e340283d360677e0a5b0246f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Mon, 20 Apr 2026 14:44:11 +0200 Subject: [PATCH 1/5] Log why SysTrace does not start on Linux --- public/client/TracySysTrace.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp index dcb510a3..51dc6744 100644 --- a/public/client/TracySysTrace.cpp +++ b/public/client/TracySysTrace.cpp @@ -583,15 +583,19 @@ bool SysTraceStart( int64_t& samplingPeriod ) #endif const auto paranoidLevelStr = ReadFile( "/proc/sys/kernel/perf_event_paranoid" ); - if( !paranoidLevelStr ) return false; -#ifdef TRACY_VERBOSE - int paranoidLevel = 2; - paranoidLevel = atoi( paranoidLevelStr ); + if( !paranoidLevelStr ) { + TracyDebug( "Failed to read perf_event_paranoid, cannot setup system tracing." ); + return false; + } + + const int paranoidLevel = atoi( paranoidLevelStr ); TracyDebug( "perf_event_paranoid: %i", paranoidLevel ); -#endif auto traceFsPath = GetTraceFsPath(); - if( !traceFsPath ) return false; + if( !traceFsPath ) { + TracyDebug( "Failed to get tracefs path, cannot setup system tracing." ); + return false; + } TracyDebug( "tracefs path: %s", traceFsPath ); int switchId = -1, wakingId = -1, vsyncId = -1; From 0a5647b20f20c8034726b2697658658bd097b544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Mon, 20 Apr 2026 15:00:37 +0200 Subject: [PATCH 2/5] Use mnt_type instead of mnt_fsname for tracefs discovery This is to be consistent with what libtracefs does: https://github.com/rostedt/libtracefs/blob/6fad6a14ba0d4c4b437d9e4eed7098d4bb07b4fc/src/tracefs-utils.c#L104 In theory one may mount tracefs with another name, though unlikely. --- public/client/TracySysTrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp index 51dc6744..5af27532 100644 --- a/public/client/TracySysTrace.cpp +++ b/public/client/TracySysTrace.cpp @@ -563,7 +563,7 @@ static char* GetTraceFsPath() char* ret = nullptr; while( auto ent = getmntent( f ) ) { - if( strcmp( ent->mnt_fsname, "tracefs" ) == 0 ) + if( strcmp( ent->mnt_type, "tracefs" ) == 0 ) { auto len = strlen( ent->mnt_dir ); ret = (char*)tracy_malloc( len + 1 ); From 8816dd0557ba85b02b103d3eff52ff5ae1d95add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Mon, 20 Apr 2026 15:04:33 +0200 Subject: [PATCH 3/5] Allow finding tracefs through debugfs as a fallback for older kernels/systems that only mount debugfs --- public/client/TracySysTrace.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp index 5af27532..b85877c4 100644 --- a/public/client/TracySysTrace.cpp +++ b/public/client/TracySysTrace.cpp @@ -566,11 +566,25 @@ static char* GetTraceFsPath() if( strcmp( ent->mnt_type, "tracefs" ) == 0 ) { auto len = strlen( ent->mnt_dir ); - ret = (char*)tracy_malloc( len + 1 ); + // ret may be != nullptr if we already saw a debugfs entry + ret = (char*)tracy_realloc( ret, len + 1 ); memcpy( ret, ent->mnt_dir, len ); ret[len] = '\0'; break; } + else if( strcmp( ent->mnt_type, "debugfs" ) == 0 ) + { + const char* tracingDirName = "tracing"; + const size_t tracingDirNameLen = strlen( tracingDirName ); + auto debugFsPathLen = strlen( ent->mnt_dir ); + // Typically there should be at most one debugfs, entry, but still possible to have multiple? hence realloc + ret = (char*)tracy_realloc( ret, debugFsPathLen + 1 + tracingDirNameLen + 1 ); + memcpy( ret, ent->mnt_dir, debugFsPathLen ); + ret[debugFsPathLen] = '/'; + memcpy( ret + debugFsPathLen + 1, tracingDirName, tracingDirNameLen ); + ret[debugFsPathLen + 1 + tracingDirNameLen] = '\0'; + // Don't break to allow for tracefs to be found later as it is the preferred path + } } endmntent( f ); return ret; From aba343e429ec2d6672c156787fe9e75b06610034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Tue, 21 Apr 2026 09:48:48 +0200 Subject: [PATCH 4/5] Pick first debugfs entry only --- public/client/TracySysTrace.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp index b85877c4..eb8a8932 100644 --- a/public/client/TracySysTrace.cpp +++ b/public/client/TracySysTrace.cpp @@ -572,13 +572,12 @@ static char* GetTraceFsPath() ret[len] = '\0'; break; } - else if( strcmp( ent->mnt_type, "debugfs" ) == 0 ) + else if( !ret && strcmp( ent->mnt_type, "debugfs" ) == 0 ) { const char* tracingDirName = "tracing"; const size_t tracingDirNameLen = strlen( tracingDirName ); auto debugFsPathLen = strlen( ent->mnt_dir ); - // Typically there should be at most one debugfs, entry, but still possible to have multiple? hence realloc - ret = (char*)tracy_realloc( ret, debugFsPathLen + 1 + tracingDirNameLen + 1 ); + ret = (char*)tracy_malloc( debugFsPathLen + 1 + tracingDirNameLen + 1 ); memcpy( ret, ent->mnt_dir, debugFsPathLen ); ret[debugFsPathLen] = '/'; memcpy( ret + debugFsPathLen + 1, tracingDirName, tracingDirNameLen ); From 4aac9e677d7ae9e23d6ad1377b89dd9fc9d9c3cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Tue, 21 Apr 2026 09:49:56 +0200 Subject: [PATCH 5/5] Fix formating/whitespaces in SysTraceStart --- public/client/TracySysTrace.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp index eb8a8932..7bf9092d 100644 --- a/public/client/TracySysTrace.cpp +++ b/public/client/TracySysTrace.cpp @@ -596,16 +596,18 @@ bool SysTraceStart( int64_t& samplingPeriod ) #endif const auto paranoidLevelStr = ReadFile( "/proc/sys/kernel/perf_event_paranoid" ); - if( !paranoidLevelStr ) { + if( !paranoidLevelStr ) + { TracyDebug( "Failed to read perf_event_paranoid, cannot setup system tracing." ); return false; } - + const int paranoidLevel = atoi( paranoidLevelStr ); TracyDebug( "perf_event_paranoid: %i", paranoidLevel ); auto traceFsPath = GetTraceFsPath(); - if( !traceFsPath ) { + if( !traceFsPath ) + { TracyDebug( "Failed to get tracefs path, cannot setup system tracing." ); return false; }