Fix crash in heap profile auto-selection at trace load time (#1435)

https://buganizer.corp.google.com/issues/416190258

When loading a trace with heap profile tracks, we automatically select
the earliest heap profile sample on trace load.
    
We currently assume that this event has id = 0, but this is not
necessarily the case.
    
This change refactors the queries in the heap profile plugin to make
things a lot clearer, as it was getting out of control, and also fixes
the bug so that it works out the necessary event id properly.
    
This change also refactors the selection logic in SelectionManager a
little to make the error message clearer and to ease debugging in the
future.
3 files changed
tree: 85db84f3779378196eb291240d61f2b3c3adeb62
  1. .github/
  2. bazel/
  3. build_overrides/
  4. buildtools/
  5. debian/
  6. docs/
  7. examples/
  8. gn/
  9. include/
  10. infra/
  11. protos/
  12. python/
  13. src/
  14. test/
  15. third_party/
  16. tools/
  17. ui/
  18. .bazelignore
  19. .bazelrc
  20. .bazelversion
  21. .clang-format
  22. .clang-tidy
  23. .git-blame-ignore-revs
  24. .gitallowed
  25. .gitattributes
  26. .gitignore
  27. .gn
  28. .style.yapf
  29. .yapfignore
  30. Android.bp
  31. Android.bp.extras
  32. BUILD
  33. BUILD.extras
  34. BUILD.gn
  35. CHANGELOG
  36. codereview.settings
  37. DIR_METADATA
  38. heapprofd.rc
  39. LICENSE
  40. meson.build
  41. METADATA
  42. MODULE.bazel
  43. MODULE.bazel.lock
  44. MODULE_LICENSE_APACHE2
  45. OWNERS
  46. perfetto.rc
  47. perfetto_flags.aconfig
  48. PerfettoIntegrationTests.xml
  49. persistent_cfg.pbtxt
  50. README.chromium
  51. README.md
  52. TEST_MAPPING
  53. traced_perf.rc
  54. WATCHLISTS
  55. 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.