perfetto-ui: Fix slices disappearing bug

The last few slices in a track were sometimes disappearing.
The data arrays were set to the length of totalSlices - which correctly
calculated that the data length should be the count(big slices)
+ count(distinct grouping, depth of slices to be summarized).

What went wrong was that the final data was ordered by ts, percent which
meant that the data was ordered without regard for the depth.
(ordering by ts already accounts for the grouping).

For example data looked like this:
grouping | depth | percent
764 | 1 | 0.6
764 | 2 | 0.2
764 | 1 | 0.1

When creating the final slices - line 1 and 3 would end up being
separate slices, but we want them to be one summarized slice.
This pushed the number of slices to be > totalSlices which was
why the final slices were disappearing.
So the solution is to ensure the data is sorted by depth before
percent.

Bug: 158297138
Change-Id: I6a8f1caee1bf388aba986b8d1c3d904018b7c554
1 file changed
tree: 389dacb36442b5200d7f05cf84ec04c38f4c69c7
  1. bazel/
  2. build_overrides/
  3. buildtools/
  4. debian/
  5. docs/
  6. examples/
  7. gn/
  8. include/
  9. infra/
  10. protos/
  11. src/
  12. test/
  13. tools/
  14. ui/
  15. .clang-format
  16. .gitignore
  17. .gn
  18. .style.yapf
  19. Android.bp
  20. Android.bp.extras
  21. BUILD
  22. BUILD.extras
  23. BUILD.gn
  24. codereview.settings
  25. heapprofd.rc
  26. LICENSE
  27. METADATA
  28. MODULE_LICENSE_APACHE2
  29. OWNERS
  30. perfetto.rc
  31. PRESUBMIT.py
  32. README.chromium
  33. README.md
  34. TEST_MAPPING
  35. traced_perf.rc
  36. 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://docs.perfetto.dev or the /docs/ directory for documentation.