VizTracer is a low-overhead Python profiling and debugging tool that traces code execution and visualizes it interactively.
The tool addresses the need to understand program behavior and identify performance bottlenecks without modifying source code or adding dependencies. It works by instrumenting Python function calls to capture entry and exit events with timing information, then renders this data on a timeline powered by Perfetto, a browser-based visualization engine. The interface supports navigation and zooming to explore execution traces ranging from small programs to gigabyte-scale recordings. VizTracer handles threading, multiprocessing, subprocess calls, async code, and PyTorch profiling, including native calls and GPU events when enabled.
Developers should choose VizTracer if they need fast, detailed execution traces without code instrumentation. It suits projects where understanding call sequences and timing is critical—particularly those involving concurrency or GPU computation. The tool works across Linux, macOS, and Windows. A VS Code extension is available to streamline the workflow. The command-line interface generates JSON trace files viewable through a web server, while inline usage and Jupyter integration support interactive development. Trace filtering options let you reduce overhead by excluding specific files, limiting stack depth, or filtering by minimum duration.
The project shows consistent maintenance with regular updates addressing user-reported issues and feature requests. Development includes responsiveness to bug reports and incorporation of community feedback into new releases. The maintainer actively documents features and maintains comprehensive documentation covering both basic and advanced usage patterns. The codebase receives ongoing refinement to improve performance and expand platform support.