perfetto
Python APIs and bindings for Perfetto (perfetto.dev)
What it is and what it does
Perfetto is a Python interface to Perfetto's trace processor, enabling programmatic analysis of system and application performance traces. It lets you load trace files and query them using SQL, making it possible to automate trace analysis, extract custom metrics, and integrate trace inspection into Python workflows. The package is built on top of Perfetto's production-grade tracing infrastructure, which is the default system for Android and Chromium.
The package depends only on protobuf and installs as a pure Python wheel, making it lightweight to add to existing projects. It's designed for developers, performance engineers, and SREs who need to analyze traces captured by Perfetto daemons or other compatible tools—such as Linux perf, Chrome JSON traces, or macOS Instruments—without manually parsing binary formats.
Use it for:
- Automate analysis of Android app performance traces to detect slow startups, dropped frames, or memory issues
- Query Linux kernel traces to analyze scheduling behavior, syscalls, and CPU performance bottlenecks
- Extract custom metrics from Chromium browser traces for performance regression detection
- Batch-process multiple trace files to generate performance reports and SRE dashboards
- Integrate trace analysis into CI/CD pipelines to flag performance regressions automatically
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Perfetto is a Python binding for Perfetto's trace processor, allowing programmatic access to system and application traces via SQL queries and trace analysis APIs.
Yes, if you need to programmatically analyze Perfetto traces or other compatible trace formats. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a safe choice. The alpha status means the API may change, so pin the version in production. Not necessary if you only need the browser-based UI or one-off manual trace inspection.
Install
perfetto on PyPI
pip
pip install perfettouv
uv add perfettopoetry
poetry add perfettoInstalling perfetto
Before you install
Low install friction with a single runtime dependency (protobuf). Active maintenance with recent releases; last commit 2026-08-14 and version 0.57.2 released 2026-07-07. Alpha status indicates the API may still evolve.
License in practice
Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install perfetto
import perfetto
# Load and query a trace file
processor = perfetto.TraceProcessor(trace_file='trace.perfetto-trace')
result = processor.query('SELECT * FROM sched_slice LIMIT 10')
Verify before relying
- Whether the Python package provides direct access to all Perfetto trace processor features or a subset
- Whether traces must be pre-captured by Perfetto daemons or if the package can initiate tracing
- Performance characteristics when querying large multi-GB trace files
- Whether the package works on Windows, macOS, and Linux or has platform-specific limitations
Package facts
| License | apache-2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — protobuf |
| Maintenance | actively maintained — 38 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,341,501/month — #4,027 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: perfetto-0.57.2-py3-none-any.whl
Keywords: trace processor, tracing, perfetto
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
kekeWrites trace events in Perfetto/Chrome trace…
permissive · top 15,000 on PyPI
viztracerVizTracer traces Python code execution and…
permissive · top 5,000 on PyPI
osprofilerOSProfiler generates distributed request traces…
permissive · top 15,000 on PyPI
HolisticTraceAnalysisAnalyzes PyTorch Profiler traces to identify…
permissive · top 15,000 on PyPI
nvidia-nvtxProvides a Python API for annotating events and…
unclear · top 1,000 on PyPI
mlflow-tracingInstrument GenAI applications with distributed…
permissive · top 1,000 on PyPI
cupti-pythonProvides Python bindings to NVIDIA's CUPTI…
unclear · top 15,000 on PyPI
nvidia-nvtx-cu12Provides a C-based API for annotating events,…
permissive · top 1,000 on PyPI
google-cloud-traceSends application trace data to Google Cloud…
permissive · top 5,000 on PyPI
nvidia-nvtx-cu11Provides a C-based API for annotating events,…
unclear · top 5,000 on PyPI