Merge "Remove cycling dependency between ftrace_proto_gen and protos"
diff --git a/src/traced/probes/ftrace/BUILD.gn b/src/traced/probes/ftrace/BUILD.gn
index e576825..e65d709 100644
--- a/src/traced/probes/ftrace/BUILD.gn
+++ b/src/traced/probes/ftrace/BUILD.gn
@@ -44,6 +44,7 @@
source_set("unittests") {
testonly = true
deps = [
+ ":format_parser",
":ftrace",
":test_messages_lite",
":test_messages_zero",
@@ -108,6 +109,7 @@
"../../../tracing",
]
deps = [
+ ":format_parser",
"..:data_source",
"../../../../gn:default_deps",
"../../../../include/perfetto/traced",
@@ -125,8 +127,6 @@
"event_info.h",
"event_info_constants.cc",
"event_info_constants.h",
- "format_parser.cc",
- "format_parser.h",
"ftrace_config.cc",
"ftrace_config.h",
"ftrace_config_muxer.cc",
@@ -146,6 +146,17 @@
]
}
+source_set("format_parser") {
+ deps = [
+ "../../../../gn:default_deps",
+ "../../../base",
+ ]
+ sources = [
+ "format_parser.cc",
+ "format_parser.h",
+ ]
+}
+
if (!build_with_chromium) {
source_set("benchmarks") {
testonly = true
diff --git a/tools/ftrace_proto_gen/BUILD.gn b/tools/ftrace_proto_gen/BUILD.gn
index e36ab44..eedabd2 100644
--- a/tools/ftrace_proto_gen/BUILD.gn
+++ b/tools/ftrace_proto_gen/BUILD.gn
@@ -35,7 +35,7 @@
"../../gn:default_deps",
"../../gn:protobuf_full_deps",
"../../src/base",
- "../../src/traced/probes/ftrace",
+ "../../src/traced/probes/ftrace:format_parser",
]
}
@@ -48,8 +48,7 @@
":ftrace_proto_gen_src",
"../../gn:default_deps",
"../../gn:protobuf_full_deps",
- "../../protos/perfetto/trace:lite",
"../../src/base",
- "../../src/traced/probes/ftrace",
+ "../../src/traced/probes/ftrace:format_parser",
]
}
diff --git a/tools/ftrace_proto_gen/main.cc b/tools/ftrace_proto_gen/main.cc
index 591e3d3..df00c99 100644
--- a/tools/ftrace_proto_gen/main.cc
+++ b/tools/ftrace_proto_gen/main.cc
@@ -31,15 +31,16 @@
#include "src/traced/probes/ftrace/format_parser.h"
#include "tools/ftrace_proto_gen/ftrace_proto_gen.h"
-std::unique_ptr<std::ostream> MakeOFStream(const std::string& filename);
-std::unique_ptr<std::ostream> MakeOFStream(const std::string& filename) {
+namespace {
+inline std::unique_ptr<std::ostream> MakeOFStream(const std::string& filename) {
return std::unique_ptr<std::ostream>(new std::ofstream(filename));
}
-std::unique_ptr<std::ostream> MakeVerifyStream(const std::string& filename);
-std::unique_ptr<std::ostream> MakeVerifyStream(const std::string& filename) {
+inline std::unique_ptr<std::ostream> MakeVerifyStream(
+ const std::string& filename) {
return std::unique_ptr<std::ostream>(new perfetto::VerifyStream(filename));
}
+} // namespace
int main(int argc, char** argv) {
static struct option long_options[] = {
@@ -167,7 +168,6 @@
std::string contents;
if (!perfetto::base::ReadFile(input_path, &contents)) {
- fprintf(stderr, "Failed to open %s\n", input_path.c_str());
continue;
}
diff --git a/tools/run_ftrace_proto_gen b/tools/run_ftrace_proto_gen
index 62a5ebf..3e9141f 100755
--- a/tools/run_ftrace_proto_gen
+++ b/tools/run_ftrace_proto_gen
@@ -16,7 +16,8 @@
fi
fi
-"$DIR/ninja" -C "$BUILDDIR" ftrace_proto_gen
+DESCRIPTOR='gen/protos/perfetto/trace/ftrace.descriptor'
+"$DIR/ninja" -C "$BUILDDIR" ftrace_proto_gen $DESCRIPTOR
# FIXME(fmayer): make ftrace_proto_gen independent of cwd.
cd "$DIR/.."
@@ -24,7 +25,7 @@
"$BUILDDIR/ftrace_proto_gen" \
--whitelist_path "$DIR/ftrace_proto_gen/event_whitelist" \
--output_dir "$DIR/../protos/perfetto/trace/ftrace/" \
- --proto_descriptor "$BUILDDIR/gen/protos/perfetto/trace/ftrace.descriptor" \
+ --proto_descriptor "$BUILDDIR/$DESCRIPTOR" \
--update_build_files \
"$@" \
"$DIR"/../src/traced/probes/ftrace/test/data/*/events/