tp: run every dataframe table query on the executor **Why** The dataframe module ran filters on the executor, but sent any query with an ORDER BY, a DISTINCT or a LIMIT, and any query of a table still being added to, through the interpreter. Keeping both meant two ways to run a query and two cursors in the module. The executor now does all of it at least as well over the stdlib. **Changes** - `BestIndex()` writes every query as an executor plan string: the filters, then DISTINCT, the sort keys, LIMIT and OFFSET. It still asks `Dataframe::PlanQuery()` for the argument order, which constraints SQLite can omit, and the cost. - The plan adds `Distinct`, `OrderBy` and `Limit` nodes for them, through new `AddToPlan()` functions on those operations. - A table still being added to gets a plan built for each run, as a plan reads the table as it is when built. A finalized table's plans are still cached per query string. - The module reads a final sort's rows where they are held. - The interpreted cursor, `FilterExec()` and `ColumnInterpreted()` are gone. - A cell reader is chosen again when a batch stores a column differently from the batch it was chosen for, as a sort can serve some batches where they are held and copy others. **Results** Every include and every table and view of the stdlib, read in full on ten test traces, gives the same results as the interpreter and runs 1% more instructions in total. **Testing** - New `PerfettoSqlConnectionTest.Dataframe_ReadsATableStillBeingAddedTo` and `PerfettoSqlConnectionTest.Dataframe_ReadsSortedBatchesStoredDifferently`. - `perfetto_unittests` and all diff tests pass.
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.