Skip to main content

trace0

A low-overhead tracing profiler for Python, written in Rust.

trace0 hooks PEP 669 sys.monitoring, packs each event into 8 bytes in a thread-local buffer, and hands whole batches to a background thread over lock-free SPSC rings. It emits Perfetto-compatible traces — open them at https://ui.perfetto.dev.

Roughly 13 ns per traced function call at 4 threads on an M-series Mac.

Install

pip install trace0

Requires Python 3.13+. Free-threaded builds (3.13t, 3.14t) are a first-class target — every thread in the interpreter is traced, not just the calling one.

Use

As a context manager:

from trace0 import Tracer

with Tracer("trace.pb", "protobuf"):
    your_workload()

Or from the command line:

trace0 run --output trace.pb --format protobuf your_script.py

Formats are json (Chrome Trace Event, human-readable and diffable) and protobuf (Perfetto, smaller and faster to write).

Status

Early. The tracer works end to end and is covered by tests, but the API is not yet stable and wheels are not yet built for every platform.

Layout

crate role
trace0-core clock, event model, event queue, exporter contract
trace0-json Chrome Trace Event output
trace0-proto Perfetto protobuf output

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trace0-0.1.0.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trace0-0.1.0-cp313-cp313t-macosx_11_0_arm64.whl (565.5 kB view details)

Uploaded CPython 3.13tmacOS 11.0+ ARM64

File details

Details for the file trace0-0.1.0.tar.gz.

File metadata

  • Download URL: trace0-0.1.0.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for trace0-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cce7b989e2ecfefd2556885cc2e9713e94d7068f50dc95a9c11ffe0a4a8b4e33
MD5 0f29be79133b4415ec7a51351fe703bd
BLAKE2b-256 4b2db802fb89ce6d460dc098c4afcce7116dbd353d24eafb56e260106ac83960

See more details on using hashes here.

File details

Details for the file trace0-0.1.0-cp313-cp313t-macosx_11_0_arm64.whl.

File metadata

  • Download URL: trace0-0.1.0-cp313-cp313t-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 565.5 kB
  • Tags: CPython 3.13t, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for trace0-0.1.0-cp313-cp313t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab5509b51bde7af750f2b6eaaaa8ff88c865591d9e61933001af1a779d571e2b
MD5 3b815bbd8bf6fed55c75958c79ccdbc1
BLAKE2b-256 f9d768fa58eebd5df4f2ae672209e13138497d4351abea278ea31ec1c9c56028

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page