trace_processor: overhaul filter and sort system for storage backed tables

This CL introduces a flexible system for filtering and sorting for any
table backed by TraceStorage. This allows for Table sub-classes to be written
with as little as ~80 lines of code. This works through a healthy sprinkling
of abstractions and template magic while hopefully remaining readable.

Several new classes/files are introduced:

* StorageCursor: a class which takes a row iteration strategy
(StorageCursor::RowIterator) (an object which tells it which row index to
return next) and a column reporter (StorageCursor::ColumnReporter) (one for
each column in the table which can inform sqlite through sqlite3_result_*
functions what the data at a row is).

* RangeRowIterator and VectorRowIterator: implement the row iteration
strategies given by iterating through a range of indices (possibly filtering
rows based on a bitvector) and given by returning indices directly from a
vector.

* StorageSchema: a class which defines the schema of a storage backed table
but also how data can be sorted/filtered/reported to SQLite
(StorageSchema::Column).

* StorageSchema::NumericColumn and StorageSchema::StringColumn: These are
implementations of StorageSchema::Column for all numeric data types and string
types. Note that string columns add a layer of indirection which allows
string ids to be passed with a seperate deque defining how this id should be
converted to a string.

* table_utils: extracts the logic in SchedSliceTable about how to choose a
row iteration strategy for a given schema given a set of query constraints.


Overall this allows massive consolidation of code across Sched and Counters
tables and will allow for Slice, thread, process and all future tables to
have efficient filter support without needing to add hundreds of lines of
code. Moreover, performance improvements can now be shared among all the
tables.

Change-Id: Ifeac418d7446daaffeb3c3ce0676c15cb030151c
16 files changed
tree: 63a4f98ab166324481b50897d29ba872499ceab0
  1. build_overrides/
  2. buildtools/
  3. debian/
  4. docs/
  5. gn/
  6. include/
  7. infra/
  8. protos/
  9. src/
  10. test/
  11. tools/
  12. ui/
  13. .clang-format
  14. .gitignore
  15. .gn
  16. .travis.yml
  17. Android.bp
  18. Android.bp.extras
  19. BUILD.gn
  20. codereview.settings
  21. heapprofd.rc
  22. MODULE_LICENSE_APACHE2
  23. NOTICE
  24. OWNERS
  25. perfetto.rc
  26. PRESUBMIT.py
  27. README.chromium
  28. README.md
README.md

Perfetto - Performance instrumentation and tracing

Perfetto is an open-source project for performance instrumentation and tracing of Linux/Android/Chrome platforms and user-space apps.

See www.perfetto.dev for docs.

Bugs

  • For bugs affecting Android or the tracing internals use the internal bug tracker (go/perfetto-bugs).
  • For bugs affecting Chrome use http://crbug.com, Component:Speed>Tracing label:Perfetto.