ui: improve perf of query for CPU stack samples

This CL essentially rewrites the cpu profiling query from scratch
reducing the amount of nesting and (most importantly) changing WHERE
constraints to ON for joins.

Using WHERE constraints means SQLite does not correctly propogate the
constraints to the nested query which massively impacts performance
wheras ON propogates correctly.

Finally, we remove some extraneous joins and simplify position -> depth.

Performance on trace from b/168056830
Before aosp/1512469: 33.10s
Before this CL:      32.55s
After this CL:        0.24s

Bug: 168056830
Change-Id: I89fd312ec2e21442869348a3205b8f3def792907
1 file changed
tree: 66c6614841e6e4e577226c64b41aa7734766064a
  1. .github/
  2. bazel/
  3. build_overrides/
  4. buildtools/
  5. debian/
  6. docs/
  7. examples/
  8. gn/
  9. include/
  10. infra/
  11. protos/
  12. src/
  13. test/
  14. tools/
  15. ui/
  16. .clang-format
  17. .clang-tidy
  18. .gitignore
  19. .gn
  20. .style.yapf
  21. Android.bp
  22. Android.bp.extras
  23. BUILD
  24. BUILD.extras
  25. BUILD.gn
  26. CHANGELOG
  27. codereview.settings
  28. heapprofd.rc
  29. LICENSE
  30. METADATA
  31. MODULE_LICENSE_APACHE2
  32. OWNERS
  33. perfetto.rc
  34. PRESUBMIT.py
  35. README.chromium
  36. README.md
  37. TEST_MAPPING
  38. traced_perf.rc
  39. WORKSPACE
README.md

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.