viztracer
VizTracer is a Python debugging and profiling tool that traces code execution and visualizes it on an interactive timeline. It requires no source code changes for most features, supports threading/multiprocessing/async, and generates JSON trace files viewable in a browser-based UI powered by Perfetto.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | gaogaotiantian/viztracer |
| Owner | gaogaotiantian |
| Primary language | Python |
| License | Apache-2.0 — OSI-approved |
| Stars | 7.7k |
| Forks | 468 |
| Open issues | 25 |
| Latest release | 1.1.1 (2025-11-10) |
| Last updated | 2026-06-08 |
| Source | https://github.com/gaogaotiantian/viztracer |
What viztracer is
Low-overhead execution tracer using Python's sys.settrace() and native instrumentation; generates Chrome DevTools–compatible JSON; supports concurrency primitives (threading, multiprocessing, subprocess, asyncio) and PyTorch profiling; visualized via Perfetto frontend with flamegraph support.
Get the viztracer source
Clone the repository and explore it locally.
git clone https://github.com/gaogaotiantian/viztracer.gitcd viztracer# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Install via pip; no compilation or platform-specific setup required; works on Linux, macOS, Windows.
- Start tracing via CLI (viztracer script.py), inline API (VizTracer() context manager), or Jupyter magic (%load_ext viztracer); minimal code intrusion.
- Output is a single JSON file; use vizviewer to spawn HTTP server on localhost:9001 or save as HTML with --open flag for direct browser access.
- Apply trace filters (min_duration, max_stack_depth, include/exclude files) to control overhead and output size in high-volume tracing scenarios.
- For remote profiling, ensure viztracer is importable on the target process; refer to remote_attach documentation for setup.
When to avoid it — and what to weigh
- C/C++ extension profiling is primary need — While C function ignoring is supported, VizTracer is optimized for Python-level tracing; deep native code profiling may require specialized tools like py-spy or perf.
- Real-time streaming or live dashboards required — VizTracer produces post-mortem JSON traces; no built-in support for continuous metric streaming or live dashboard integration.
- Offline analysis without visualization UI — Trace export is JSON; viewing requires either vizviewer HTTP server or compatible Perfetto viewer; not suitable if headless log-only analysis is mandatory.
- Memory profiling is the primary goal — VizTracer focuses on execution timing; memory profiling features are limited compared to tools like memory_profiler or tracemalloc.
License & commercial use
Licensed under Apache License 2.0 (Apache-2.0), a permissive OSI-approved open-source license permitting commercial use, modification, and distribution with attribution and explicit liability disclaimer.
Apache-2.0 is a permissive license that explicitly permits commercial use, including in proprietary products, provided the license notice and any changes are disclosed. No copyleft obligations. Suitable for commercial profiling toolchains without legal review, though standard licensing review is always prudent for integration into production systems.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
VizTracer attaches to running Python processes and logs execution details including function arguments, variable values, and exceptions (if --log_exception enabled). Trace files may contain sensitive data (credentials, PII in function args/return values). Store trace JSON securely if profiling production code. Remote attach requires network access to the target process; use firewall rules to restrict attachment. No explicit security audit or vulnerability tracking data provided; review GitHub issues for any reported security concerns.
Alternatives to consider
py-spy
Sampling-based profiler; lower overhead for long-running processes but less precise timing; better for C extension profiling; does not require code changes.
cProfile (stdlib)
Built-in Python profiler; no installation required; statistical output (cumulative, per-call); lacks timeline visualization and concurrency support; suitable for basic CPU profiling.
Pyflame
Lightweight sampling profiler using gdb; minimal overhead; good for continuous monitoring; less interactive visualization compared to VizTracer's Perfetto UI.
Build on viztracer with DEV.co software developers
Install VizTracer via pip and start visualizing code execution in minutes. Identify bottlenecks, trace async workflows, and optimize multi-threaded systems with interactive Perfetto timeline views.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
viztracer FAQ
What is the overhead of VizTracer compared to cProfile or py-spy?
Can I use VizTracer to profile a production service?
Does VizTracer support Python 2 or older Python 3 versions?
How large can trace files get, and how do I handle them?
Software development & web development with DEV.co
Adopting viztracer is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source observability software in production.
Profile Your Python Application Now
Install VizTracer via pip and start visualizing code execution in minutes. Identify bottlenecks, trace async workflows, and optimize multi-threaded systems with interactive Perfetto timeline views.