tp: keep the executor's run memory in the Context A state kept what it collects during a run in FlexVectors, vectors, bit vectors, hash maps and batches, each wrapped in Held<T> so that it could be emptied when the run ends. Each of those types brings its own destructor and growth code, Held<T> adds an end-of-run function for every type it wraps, and a state holding any of them needs a destructor of its own. Now a state can keep that memory in the Context, which owns it and takes it back at the end of each run. RunVector is a growable array whose state holds only a pointer to it. It grows through Context::GrowRun(), one out-of-line function for every element type, which follows FlexVector's growth policy. When the run ends, the Context empties it and keeps its memory in place if it is no bigger than kRunKeptBytes, as the containers it replaces did. RunBits and RunMap build a bit vector and a hash table on it. The Context also makes batches and buffer handles that are emptied with a state's run, and scratch spans that live as long as the state. A state that is plain data has its values restored to how they were made when its run ends, unless it resets them in Rewind() and is made with MakeRewound(). The scans, Filter, Compute, Limit, TreeNumberNodes, CombineBatches, the pipeline and the breaker's served source move onto this and become plain data. A pipeline use is now just an id the Context ends with its owner's run, and RowStore::Append() takes the state that owns the store. The sorts, aggregates, tree, graph and interval operators still hold their helpers in Held<T>. The next change moves those helpers onto the Context and removes Held, RunValue and their registry.
Perfetto is an open-source suite of tools for recording, visualizing and analyzing traces: timelines of what software and the system under it were doing. It is the default tracing system for Android and Chromium. System-wide recording works on Android and Linux. The tracing SDK, the UI and Trace Processor also run on macOS and Windows.
perf, Firefox Profiler, macOS Instruments, pprof, systrace, Fuchsia and more.Open an example Android trace without installing anything, or drag your own trace file onto ui.perfetto.dev.
On Android, with a device connected over adb:
curl -O https://raw.githubusercontent.com/google/perfetto/main/tools/record_android_trace python3 record_android_trace -o trace.pftrace -t 10s sched freq gfx view am wm
The trace opens in the Perfetto UI when recording finishes.
On Linux, record scheduling activity with tracebox:
curl -LO https://get.perfetto.dev/tracebox && chmod +x tracebox curl -LO https://raw.githubusercontent.com/google/perfetto/main/test/configs/scheduling.cfg sudo ./tracebox -o trace.pftrace --txt -c scheduling.cfg
For Chrome, use the recording page in the UI. To trace your own app, see in-app tracing.
curl -LO https://get.perfetto.dev/trace_processor && chmod +x trace_processor ./trace_processor query trace.pftrace \ "SELECT name, COUNT(*) AS cnt FROM slice GROUP BY name ORDER BY cnt DESC LIMIT 10"
Or from Python:
pip install perfetto
from perfetto.trace_processor import TraceProcessor tp = TraceProcessor(trace='trace.pftrace') print(tp.query('SELECT ts, dur, name FROM slice LIMIT 10').as_pandas_dataframe())
ftrace. (Linux cookbook)chrome://tracing, for debugging the browser, V8 and Blink. (Chrome tracing)Not sure where to start? How do I start using Perfetto? picks a path based on what you want to do.
Perfetto is a collection of components that work together:
traced, traced_probes) collect data from many processes and the kernel into a single trace file.See the documentation for the full picture.
See Community and getting help for more. We follow Google's Open Source Community Guidelines.
Contributions are welcome. The contributor guide covers building, testing and sending pull requests.
The Debian packaging of Perfetto is maintained in the Debian Perfetto Salsa repository.
Apache 2.0. See LICENSE for details.