profiler cmdline matching: add parallel implementation that supports globs
There's a demand for more flexible matching when perfetto profilers
select target processes via /proc/pid/cmdline. We've decided that it
makes sense to change the semantics of the existing config fields
instead of adding new ones, as the vast majority of existing configs
won't be affected. This patch introduces the new glob-aware cmdline
matching logic that we'll be migrating to, starting with traced_perf and
perfetto_hprof. Extra context at go/perfetto-profiler-globs.
"normalize.h" is folded into proc_utils since its purpose is outdated.
The logic exists only within perfetto and bionic/malloc_heapprofd,
and the header is referenced only from within perfetto.
I've overdocumented the implementation because while string parsing
often looks innocent, it is at the same time often subtle.
Bug: 201273553
Change-Id: I840bfd2201ab238bc7b16a75de3b037a17556169
diff --git a/Android.bp b/Android.bp
index 3c5e89b..0526976 100644
--- a/Android.bp
+++ b/Android.bp
@@ -23,7 +23,6 @@
":perfetto_include_perfetto_ext_ipc_ipc",
":perfetto_include_perfetto_ext_tracing_core_core",
":perfetto_include_perfetto_ext_tracing_ipc_ipc",
- ":perfetto_include_perfetto_profiling_normalize",
":perfetto_include_perfetto_protozero_protozero",
":perfetto_include_perfetto_tracing_core_core",
":perfetto_include_perfetto_tracing_core_forward_decls",
@@ -277,7 +276,6 @@
":perfetto_include_perfetto_ext_ipc_ipc",
":perfetto_include_perfetto_ext_tracing_core_core",
":perfetto_include_perfetto_ext_tracing_ipc_ipc",
- ":perfetto_include_perfetto_profiling_normalize",
":perfetto_include_perfetto_protozero_protozero",
":perfetto_include_perfetto_tracing_core_core",
":perfetto_include_perfetto_tracing_core_forward_decls",
@@ -1621,11 +1619,6 @@
name: "perfetto_include_perfetto_ext_tracing_ipc_ipc",
}
-// GN: //include/perfetto/profiling:normalize
-filegroup {
- name: "perfetto_include_perfetto_profiling_normalize",
-}
-
// GN: //include/perfetto/profiling:pprof_builder
filegroup {
name: "perfetto_include_perfetto_profiling_pprof_builder",
@@ -1689,7 +1682,6 @@
":perfetto_include_perfetto_ext_traced_traced",
":perfetto_include_perfetto_ext_tracing_core_core",
":perfetto_include_perfetto_ext_tracing_ipc_ipc",
- ":perfetto_include_perfetto_profiling_normalize",
":perfetto_include_perfetto_protozero_protozero",
":perfetto_include_perfetto_trace_processor_basic_types",
":perfetto_include_perfetto_trace_processor_storage",
@@ -7521,6 +7513,14 @@
],
}
+// GN: //src/profiling/common:proc_cmdline
+filegroup {
+ name: "perfetto_src_profiling_common_proc_cmdline",
+ srcs: [
+ "src/profiling/common/proc_cmdline.cc",
+ ],
+}
+
// GN: //src/profiling/common:proc_utils
filegroup {
name: "perfetto_src_profiling_common_proc_utils",
@@ -7550,6 +7550,7 @@
name: "perfetto_src_profiling_common_unittests",
srcs: [
"src/profiling/common/interner_unittest.cc",
+ "src/profiling/common/proc_cmdline_unittest.cc",
"src/profiling/common/proc_utils_unittest.cc",
"src/profiling/common/producer_support_unittest.cc",
"src/profiling/common/profiler_guardrails_unittest.cc",
@@ -9725,7 +9726,6 @@
":perfetto_include_perfetto_ext_traced_traced",
":perfetto_include_perfetto_ext_tracing_core_core",
":perfetto_include_perfetto_ext_tracing_ipc_ipc",
- ":perfetto_include_perfetto_profiling_normalize",
":perfetto_include_perfetto_protozero_protozero",
":perfetto_include_perfetto_test_test_support",
":perfetto_include_perfetto_trace_processor_basic_types",
@@ -9848,6 +9848,7 @@
":perfetto_src_profiling_common_callstack_trie",
":perfetto_src_profiling_common_interner",
":perfetto_src_profiling_common_interning_output",
+ ":perfetto_src_profiling_common_proc_cmdline",
":perfetto_src_profiling_common_proc_utils",
":perfetto_src_profiling_common_producer_support",
":perfetto_src_profiling_common_profiler_guardrails",
@@ -10464,7 +10465,6 @@
":perfetto_include_perfetto_ext_ipc_ipc",
":perfetto_include_perfetto_ext_tracing_core_core",
":perfetto_include_perfetto_ext_tracing_ipc_ipc",
- ":perfetto_include_perfetto_profiling_normalize",
":perfetto_include_perfetto_protozero_protozero",
":perfetto_include_perfetto_tracing_core_core",
":perfetto_include_perfetto_tracing_core_forward_decls",