Clément Grégoire 1c26daa3ac Detect unreliable TSC on Linux via perf timestamp probe.
Linux exposes time_zero/time_mult/time_shift on the perf_event mmap
page for converting sample timestamps back to TSC cycles, gated by
cap_user_time_zero. That flag only states the conversion math is
valid; on Ryzen the kernel can leave it set while TSC silently drifts
between cores, before the clocksource watchdog catches it. We've had
user reports of this surfacing as garbage timestamps in traces.

CheckLinuxPerfTscConsistency() first looks at the current clocksource
in sysfs, then opens a dummy PERF_COUNT_SW_DUMMY event and verifies
that a PR_SET_NAME-triggered PERF_RECORD_COMM timestamp inverts back
into the rdtsc-sandwiched window with ~1 ms of slack. Modeled on
tools/perf/tests/perf-time-to-tsc.c.

Wired into CheckHardwareSupportsInvariantTSC() so a failing probe
calls InitFailure in non-fallback builds and routes GetTime() to
clock_gettime in TRACY_TIMER_FALLBACK builds. Inconclusive cases
(perf blocked, no COMM record, etc) return true to avoid penalising
sandboxed environments. Gated on TRACY_HAS_SYSTEM_TRACING so we only
probe when Tracy would actually open perf events.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 16:11:39 +02:00
2026-05-12 18:03:45 +02:00
2024-05-25 00:16:29 +02:00
2024-05-12 19:23:18 +02:00
2023-10-09 22:38:04 +02:00
2022-04-16 00:13:10 +02:00
2026-05-20 12:07:05 +02:00
2025-07-27 21:18:57 +02:00
2024-09-27 16:56:55 +02:00
2026-01-01 02:12:05 +01:00
2026-05-19 22:50:11 +02:00

Tracy Profiler

Sponsor

A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

Tracy supports profiling CPU (Direct support is provided for C, C++, Lua, Python and Fortran integration. At the same time, third-party bindings to many other languages exist on the internet, such as Rust, Zig, C#, OCaml, Odin, etc.), GPU (All major graphic APIs: OpenGL, Vulkan, Direct3D 11/12, Metal, OpenCL, CUDA.), memory allocations, locks, context switches, automatically attribute screenshots to captured frames, and much more.

An Introduction to Tracy Profiler in C++ - Marcos Slomp - CppCon 2023

Introduction to Tracy Profiler v0.2
New features in Tracy Profiler v0.3
New features in Tracy Profiler v0.4
New features in Tracy Profiler v0.5
New features in Tracy Profiler v0.6
New features in Tracy Profiler v0.7
New features in Tracy Profiler v0.8

Description
No description provided
Readme BSD-3-Clause 83 MiB
Languages
C++ 89.9%
C 5.3%
TeX 2.4%
Python 1.1%
CMake 0.7%
Other 0.4%