DEV.co
Open-Source Observability · gaogaotiantian

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.

Source: GitHub — github.com/gaogaotiantian/viztracer
7.7k
GitHub stars
468
Forks
Python
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorygaogaotiantian/viztracer
Ownergaogaotiantian
Primary languagePython
LicenseApache-2.0 — OSI-approved
Stars7.7k
Forks468
Open issues25
Latest release1.1.1 (2025-11-10)
Last updated2026-06-08
Sourcehttps://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.

Quickstart

Get the viztracer source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/gaogaotiantian/viztracer.gitcd viztracer# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Production bottleneck diagnosis

Identify slow functions and execution hotspots in live Python applications with minimal overhead; supports filtering to reduce trace size over long observation windows.

Concurrent system profiling

Trace multi-threaded, multi-process, and async code execution in parallel; native support for asyncio, threading, subprocess, and PyTorch workloads with per-thread/process timeline visualization.

Interactive performance analysis

Browse GB-scale trace files in browser with zoom, filtering, and flamegraph generation; no external dependencies required for viewing; VS Code extension integration available.

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.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

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.

Software development agency

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.co

Related 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?
README claims 'probably the fastest tracer in the market' with 'low overhead,' but specific benchmarks or overhead percentages are not provided in the data. Overhead depends on trace filters and concurrency; use min_duration and max_stack_depth to reduce volume in high-frequency scenarios.
Can I use VizTracer to profile a production service?
Yes, with caution. VizTracer is designed for debugging/profiling; apply filters (min_duration, exclude_files) to minimize overhead. However, trace files may contain sensitive data; ensure traces are not exposed. Test in staging before enabling in production.
Does VizTracer support Python 2 or older Python 3 versions?
Not stated in the data. PyPI badges reference pyversions; check https://pypi.org/project/viztracer/ for supported version matrix. Multi-thread support is noted for Python 3.12+; assume Python 3.7+ support but verify before deploying on older runtimes.
How large can trace files get, and how do I handle them?
README states Perfetto UI can 'render GB-level trace smoothly.' For very large files, use --use_external_processor flag in vizviewer. Apply trace filters (min_duration, max_stack_depth, include/exclude files) to keep output manageable.

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.