Merge "Specify implicit deps of a genrule" into main
diff --git a/protos/perfetto/config/chrome/scenario_config.proto b/protos/perfetto/config/chrome/scenario_config.proto
index 5094f82..e90d6db 100644
--- a/protos/perfetto/config/chrome/scenario_config.proto
+++ b/protos/perfetto/config/chrome/scenario_config.proto
@@ -29,9 +29,16 @@
// triggered.
optional float trigger_chance = 2;
- // Additional delay on the trigger below.
+ // Additional delay *after* the trigger below. This is mostly useful
+ // to trace beyond a triggered event in upload rules. Other triggers
+ // can still be serviced during this period.
optional uint64 delay_ms = 3;
+ // Delay *before* which the rule is activated. Trigger events during this
+ // period are ignored by this rule. This is mostly useful to trace for a
+ // minimum duration before watching trigger events.
+ optional uint64 activation_delay_ms = 8;
+
// Triggers when a value within the specified bounds [min_value,
// max_value] is emitted into a Chrome histogram.
message HistogramTrigger {
diff --git a/src/protozero/protoc_plugin/protozero_plugin.cc b/src/protozero/protoc_plugin/protozero_plugin.cc
index 55c3c9d..e4c691f 100644
--- a/src/protozero/protoc_plugin/protozero_plugin.cc
+++ b/src/protozero/protoc_plugin/protozero_plugin.cc
@@ -108,6 +108,8 @@
void SetOption(const std::string& name, const std::string& value) {
if (name == "wrapper_namespace") {
wrapper_namespace_ = value;
+ } else if (name == "sdk") {
+ sdk_mode_ = (value == "true" || value == "1");
} else {
Abort(std::string() + "Unknown plugin option '" + name + "'.");
}
@@ -468,27 +470,37 @@
"#ifndef $guard$\n"
"#define $guard$\n\n"
"#include <stddef.h>\n"
- "#include <stdint.h>\n\n"
- "#include \"perfetto/protozero/field_writer.h\"\n"
- "#include \"perfetto/protozero/message.h\"\n"
- "#include \"perfetto/protozero/packed_repeated_fields.h\"\n"
- "#include \"perfetto/protozero/proto_decoder.h\"\n"
- "#include \"perfetto/protozero/proto_utils.h\"\n",
+ "#include <stdint.h>\n\n",
"greeting", greeting, "guard", guard);
- // Print includes for public imports.
- for (const FileDescriptor* dependency : public_imports_) {
- // Dependency name could contain slashes but importing from upper-level
- // directories is not possible anyway since build system processes each
- // proto file individually. Hence proto lookup path is always equal to the
- // directory where particular proto file is located and protoc does not
- // allow reference to upper directory (aka ..) in import path.
- //
- // Laconically said:
- // - source_->name() may never have slashes,
- // - dependency->name() may have slashes but always refers to inner path.
- stub_h_->Print("#include \"$name$.h\"\n", "name",
- ProtoStubName(dependency));
+ if (sdk_mode_) {
+ stub_h_->Print("#include \"perfetto.h\"\n");
+ } else {
+ stub_h_->Print(
+ "#include \"perfetto/protozero/field_writer.h\"\n"
+ "#include \"perfetto/protozero/message.h\"\n"
+ "#include \"perfetto/protozero/packed_repeated_fields.h\"\n"
+ "#include \"perfetto/protozero/proto_decoder.h\"\n"
+ "#include \"perfetto/protozero/proto_utils.h\"\n");
+ }
+
+ // Print includes for public imports. In sdk mode, all imports are assumed
+ // to be part of the sdk.
+ if (!sdk_mode_) {
+ for (const FileDescriptor* dependency : public_imports_) {
+ // Dependency name could contain slashes but importing from upper-level
+ // directories is not possible anyway since build system processes each
+ // proto file individually. Hence proto lookup path is always equal to
+ // the directory where particular proto file is located and protoc does
+ // not allow reference to upper directory (aka ..) in import path.
+ //
+ // Laconically said:
+ // - source_->name() may never have slashes,
+ // - dependency->name() may have slashes but always refers to inner
+ // path.
+ stub_h_->Print("#include \"$name$.h\"\n", "name",
+ ProtoStubName(dependency));
+ }
}
stub_h_->Print("\n");
@@ -1003,6 +1015,9 @@
std::vector<const EnumDescriptor*> enums_;
std::map<std::string, std::vector<const FieldDescriptor*>> extensions_;
+ // Generate headers that can be used with the Perfetto SDK.
+ bool sdk_mode_ = false;
+
// The custom *Comp comparators are to ensure determinism of the generator.
std::set<const FileDescriptor*, FileDescriptorComp> public_imports_;
std::set<const FileDescriptor*, FileDescriptorComp> private_imports_;
diff --git a/src/trace_processor/metrics/sql/chrome/chrome_slice_names.sql b/src/trace_processor/metrics/sql/chrome/chrome_slice_names.sql
index 95ea995..3aa7167 100644
--- a/src/trace_processor/metrics/sql/chrome/chrome_slice_names.sql
+++ b/src/trace_processor/metrics/sql/chrome/chrome_slice_names.sql
@@ -27,6 +27,7 @@
'slice_name', (
SELECT RepeatedField(DISTINCT(name))
FROM slice
+ WHERE name IS NOT NULL
ORDER BY name
)
);
diff --git a/src/trace_processor/rpc/BUILD.gn b/src/trace_processor/rpc/BUILD.gn
index 8604153..26b7528 100644
--- a/src/trace_processor/rpc/BUILD.gn
+++ b/src/trace_processor/rpc/BUILD.gn
@@ -23,9 +23,9 @@
# interface) and by the :httpd module for the HTTP interface.
source_set("rpc") {
sources = [
+ "query_result_serializer.cc",
"rpc.cc",
"rpc.h",
- "query_result_serializer.cc",
]
deps = [
"..:lib",
@@ -44,8 +44,10 @@
}
# Static library target for RPC code. Needed for BigTrace in Google3.
-static_library("trace_processor_rpc") {
- public_deps = [ ":rpc" ]
+if (is_perfetto_build_generator) {
+ static_library("trace_processor_rpc") {
+ public_deps = [ ":rpc" ]
+ }
}
perfetto_unittest_source_set("unittests") {