tp: make the run's Context own every step's state and its failure Each step made its own state with std::make_unique and handed it to whoever ran it, which then owned it. So every consumer of a source kept a unique_ptr to its state, every state had a virtual destructor, and a pipeline merged its steps' registries of held values to know what to reset when a run ends. A step that failed also kept the reason in a Held<base::Status> of its own and returned it from a status() virtual, so every consumer had to ask the right step at the right moment, before ending its run reset the status to ok. Now the Context makes every state, keeps it for as long as it lives, and ends its runs. A step implements NewState() and makes its state with Context::Make(). MakeState() and MakeSinkState() are no longer virtual and only register the new state with the Context. States reach their Context through OperatorState::context(), and a pipeline ends each of its steps' runs with Context::EndRun(). A run also has one place for its failure. Context::Fail() records the first one and Context::error() reads it back. A step that fails says why there and returns failure, so the status() virtuals and every Held<base::Status> go away, and a consumer only needs to know whether the run failed. Restarting a source clears the failure. What a state holds for a run still goes through Held<T> and RunValue<T> members until the next change. Their registry stays on OperatorState, and the Context destroys the states that are not yet plain data. A few helpers change shape ahead of that, so the next change can give them memory the Context owns: RowLayout::LayOut() and StringRanks::Sort() work on plain arrays, FlexVector's growth rule is GrownCapacity(), and IntervalGaps passes each gap it finds to a callback rather than keeping them itself.
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.