1# Perfetto - Performance instrumentation and tracing 2 3Perfetto is an open-source project for performance instrumentation and tracing 4of Linux/Android/Chrome platforms and user-space apps. 5It consists of: 6 7**A portable, high efficiency, user-space tracing library** 8designed for tracing of multi-process systems, based on zero-alloc zero-copy 9zero-syscall (on fast-paths) writing of protobufs over shared memory. 10 11**OS-wide Linux/Android probes for platform debugging** 12* Kernel tracing: a daemon that converts Kernel [Ftrace][ftrace] events into 13 API-stable protobufs, on device, with low overhead. 14* [Heap profiling](heapprofd): low-overhead, out of process unwinding, 15 variable sample rate, attachable to already running processes. 16* Power rails sampling 17* System stat counters 18* Chrome userspace tracing 19* I/O tracing 20* Many new probes coming soon: heap profiling, perf sampling, syscall tracing. 21 22**Processing of traces** 23[A C++ library for efficient processing and extraction of trace-based 24metrics.](trace-processor). The library accepts both protobuf and json-based 25traces as input and exposes an SQL query interface to the data. 26The library is built to be linked by other programs but can also be used 27standalone as a command line tool. 28 29 30**Web-based frontend** 31An open-source UI for inspection and analysis of traces. 32Available at [ui.perfetto.dev](https://ui.perfetto.dev). 33The UI is built on top of C++ trace processor library which is cross-compiled 34to WASM to run locally in the browser. 35 36 37![Perfetto Stack](https://storage.googleapis.com/perfetto/markdown_img/perfetto-stack.png) 38 39Goals 40----- 41Perfetto is building the next-gen unified tracing ecosystem for: 42- Android platform tracing ([Systrace][systrace]) 43- Chrome platform tracing ([chrome://tracing][chrome-tracing]) 44- App-defined user-space tracing (including support for non-Android apps). 45 46The goal is to create an open, portable and developer friendly tracing ecosystem 47for app and platform performance debugging. 48 49Key features 50------------ 51**Designed for production** 52Perfetto's tracing library and daemons are designed for use in production. 53Privilege isolation is a key design goal: 54* The interface for writing trace events are decoupled from the interface for 55 read-back and control and can be subjected to different ACLs. 56* Despite being based on shared memory, Perfetto is designed to prevent 57 cross-talk between data sources, even in case of arbitrary code execution 58 (memory is shared point-to-point, memory is never shared between processes). 59* Perfetto daemons are designed following to the principle of least privilege, 60 in order to allow strong sandboxing (via SELinux on Android). 61 62See [security-model.md](security-model.md) for more details. 63 64**Long traces** 65Pefetto aims at supporting hours-long / O(100GB) traces, both in terms of 66recording backend and UI frontend. 67 68**Interoperability** 69Perfetto traces (output) and configuration (input) consists of protobuf 70messages, in order to allow interoperability with several languages. 71 72See [trace-format.md](trace-format.md) for more details. 73 74**Composability** 75As Perfetto is designed both for OS-level tracing and app-level tracing, its 76design allows to compose several instances of the Perfetto tracing library, 77allowing to nest multiple layers of tracing and drive then with the same 78frontend. This allows powerful blending of app-specific and OS-wide trace 79events. 80See [multi-layer-tracing.md](multi-layer-tracing.md) for more details. 81 82**Portability** 83The only dependencies of Perfetto's tracing libraries are C++11 and [Protobuf lite][protobuf] (plus google-test, google-benchmark, libprotobuf-full for testing). 84 85**Extensibility** 86Perfetto allows third parties to defined their own protobufs for: 87* [(input) Configuration](/protos/perfetto/config/data_source_config.proto#52) 88* [(output) Trace packets](/protos/perfetto/trace/trace_packet.proto#36) 89 90Allowing apps to define their own strongly-typed input and output schema. 91See [trace-format.md](trace-format.md) for more details. 92 93Bugs 94---- 95* For bugs affecting Android or the tracing internals use the internal 96bug tracker ([go/perfetto-bugs](http://goto.google.com/perfetto-bugs)). 97* For bugs affecting Chrome use http://crbug.com, Component:Speed>Tracing 98label:Perfetto. 99 100 101[ftrace]: https://www.kernel.org/doc/Documentation/trace/ftrace.txt 102[systrace]: https://developer.android.com/studio/command-line/systrace.html 103[chrome-tracing]: https://www.chromium.org/developers/how-tos/trace-event-profiling-tool 104[protobuf]: https://developers.google.com/protocol-buffers/ 105