traceconv: produce less redundant pprofs, at the expense of more work

Additionally, add an option to suffix the frame name with the
annotation, as obtained via experimental_annotated_callstack. This is
primarily relevant to Android profiles. This is enabled by default
when invoking as traceconv||trace_to_text, and suppressed if passed
"--no-annotations" flag.

The primary change for pprof_builder is that it now interns all
callsites and frames, using their contents for the identity (instead of
relying on row ids from SQL tables). This avoids emitting redundant
functions. One reason when it'd happen: stack_profile_frame has rel_pc
as part of the row's identity, whereas in the profile it is part of the
location (and therefore all such frames should be shared). Another cause
of redundancy is incremental state clears.

This does come at a cost of both more work, and a higher memory
footprint, as we're now keeping all of the stack_profile_frame and
stack_profile_callsite derived information alive in the interning
structures. I'm assuming we're not hyper-sensitive to these regressions,
as long as WASM builds don't go oom (and there I'd expect the
trace_processor state to be more significant anyway).

I've tried it on one traced_perf field trace (with ~10 sub-profiles
written, one per pid). Runtime went from ~1s to ~1.5s. Combined pprof
size went from ~600 KB to ~400 KB. Do tell if you want concrete memory
before/after numbers as well (but I assume they're on the order of the
serialized profile's size).

Change-Id: Id7d903003d31427b8b228ec34a123ab15eeb001a
8 files changed
tree: 9bacdef812d50551f9ea6feae8a42e3793326c95
  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. .gitattributes
  19. .gitignore
  20. .gn
  21. .style.yapf
  22. Android.bp
  23. Android.bp.extras
  24. BUILD
  25. BUILD.extras
  26. BUILD.gn
  27. CHANGELOG
  28. codereview.settings
  29. DIR_METADATA
  30. heapprofd.rc
  31. LICENSE
  32. meson.build
  33. METADATA
  34. MODULE_LICENSE_APACHE2
  35. OWNERS
  36. perfetto.rc
  37. PerfettoIntegrationTests.xml
  38. PRESUBMIT.py
  39. README.chromium
  40. README.md
  41. TEST_MAPPING
  42. traced_perf.rc
  43. 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.