traced_perf: support wildcards in /proc/pid/cmdline matching

This changes the semantics of the |target_cmdline| and |exclude_cmdline|
config fields. Normally we should've introduced a separate proto field
for this, but the change is compatible with vast majority of existing
configs, so it's less hassle for both us and users to reuse the field.
See go/perfetto-profiler-globs.

There are two compatibility cases to consider:
(a) old config expecting canonicalization + new profiler binary
(b) new config with a wildcard + old profiler binary

For (a), the primary difference is how a pattern with a fully qualified
path is treated. "/bin/echo" would previously canonicalize to "echo",
and match against anything with that suffix in argv0. Now we'll match
only against that particular fully qualified path. For (b), the old
implementation will try to do exact string comparisons, so patterns with
wildcards will effectively match nothing.

Configs that want to remain compatible with both versions of the
profiler can specify several versions of the same target_cmdline, as the
field is repeated. It'll potentially match more than before, but only in
corner cases.

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