processor: Expose a C++ API for ExportJson to chrome
Turns out this makes a few things simpler for chrome:
(1) Chrome uses argument/metadata/label filters, which are predicates.
(2) Makes it possible to pass in something other than an FD for output.
(1) is tricky to solve declaratively given the complexity of these
filters and the existing legacy code in chromium. (2) could be solved
by providing a memory-backed FILE* on posix (fmemopen) - but not so
easily on windows.
Thus this new API allows providing the filter predicates (impl TODO)
and a custom writer for output.
Bug: 130786269
Change-Id: I002e67d5160157bd494c85dbe2c159695bd24c25
diff --git a/BUILD b/BUILD
index 0965d30..4e0f8ee 100644
--- a/BUILD
+++ b/BUILD
@@ -273,6 +273,14 @@
],
)
+# GN target: //include/perfetto/ext/trace_processor:export_json
+filegroup(
+ name = "include_perfetto_ext_trace_processor_export_json",
+ srcs = [
+ "include/perfetto/ext/trace_processor/export_json.h",
+ ],
+)
+
# GN target: //include/perfetto/ext/traced:sys_stats_counters
filegroup(
name = "include_perfetto_ext_traced_sys_stats_counters",
@@ -2453,6 +2461,7 @@
hdrs = [
":include_perfetto_base_base",
":include_perfetto_ext_base_base",
+ ":include_perfetto_ext_trace_processor_export_json",
":include_perfetto_ext_traced_sys_stats_counters",
":include_perfetto_protozero_protozero",
":include_perfetto_trace_processor_trace_processor",
@@ -2505,6 +2514,7 @@
"src/trace_processor/trace_processor_shell.cc",
":include_perfetto_base_base",
":include_perfetto_ext_base_base",
+ ":include_perfetto_ext_trace_processor_export_json",
":include_perfetto_ext_traced_sys_stats_counters",
":include_perfetto_protozero_protozero",
":include_perfetto_trace_processor_trace_processor",
@@ -2607,6 +2617,7 @@
hdrs = [
":include_perfetto_base_base",
":include_perfetto_ext_base_base",
+ ":include_perfetto_ext_trace_processor_export_json",
":include_perfetto_ext_traced_sys_stats_counters",
":include_perfetto_profiling_symbolizer",
":include_perfetto_protozero_protozero",
@@ -2682,6 +2693,7 @@
srcs = [
":include_perfetto_base_base",
":include_perfetto_ext_base_base",
+ ":include_perfetto_ext_trace_processor_export_json",
":include_perfetto_ext_traced_sys_stats_counters",
":include_perfetto_profiling_symbolizer",
":include_perfetto_protozero_protozero",