tracing: Add API to shut down Perfetto

This patch adds an API call to shut down the Perfetto SDK and release
any OS-level resources (threads, files, sockets, etc.). Note that it's
not possible to reinitialize Perfetto again in the same process after
shutdown. Instead, this call is meant for ensuring no Perfetto-related
threads are running so that the entire module using Perfetto can be
unloaded with dlclose().

(Cherry-pick of https://android-review.googlesource.com/c/platform/external/perfetto/+/2146891)

Bug: b/237740008
Test: `adb shell cmd gpu vkjson` => check that virgl_render_server doesn't crash
Change-Id: If82163f12c2eb426dae9cc99ccd9eb3b25bae741
5 files changed
tree: 5fa5e98c85915ff1b209138e0904d89ba1a7df2b
  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. sdk/
  14. src/
  15. test/
  16. tools/
  17. ui/
  18. .clang-format
  19. .clang-tidy
  20. .gitattributes
  21. .gitignore
  22. .gn
  23. .style.yapf
  24. Android.bp
  25. Android.bp.extras
  26. BUILD
  27. BUILD.extras
  28. BUILD.gn
  29. CHANGELOG
  30. codereview.settings
  31. DIR_METADATA
  32. heapprofd.rc
  33. LICENSE
  34. meson.build
  35. METADATA
  36. MODULE_LICENSE_APACHE2
  37. OWNERS
  38. perfetto.rc
  39. PerfettoIntegrationTests.xml
  40. PRESUBMIT.py
  41. README.chromium
  42. README.md
  43. TEST_MAPPING
  44. traced_perf.rc
  45. 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.