Fix time-in-state annotations.

* Correct duration logic by using a global clock not per-{thread,
  freq} LAG().
* Preserve duration all the way through rather than recalculating it and
  thus losing the first interval for globals. Remove an intermediate
  table this way.
* Add a test. Add support for process stats packets to the Python trace
  generator. Unify add_packet() and add_process_tree_packet() while we
  are there.

Bug: 157216280
Change-Id: Ibff7bdfb6b53b3344d7cbfa5cdd518bf9831f915
33 files changed
tree: 763378befaef512b97bb9e1b164a7fffc5139d42
  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.