| # Copyright 2023 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/host.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/test.gni") |
| import("//third_party/protobuf/proto_library.gni") |
| |
| source_set("samples_to_pprof_src") { |
| sources = [ "samples_to_pprof.cc" ] |
| public_deps = [ |
| # TODO(https://fxbug.dev/42066681): Replace with pprof. |
| # "//third_party/github.com/google/pprof:profile_proto", |
| ":profile_proto", |
| "//sdk/lib/fit", |
| "//third_party/protobuf:protobuf_full", |
| ] |
| } |
| |
| if (is_host) { |
| executable("samples_to_pprof") { |
| output_name = "samples_to_pprof" |
| sources = [ "main.cc" ] |
| deps = [ |
| ":profile_proto", |
| ":samples_to_pprof_src", |
| "//sdk/lib/fit", |
| ] |
| } |
| |
| static_library("rust_samples_to_pprof") { |
| visibility = [ ":*" ] |
| deps = [ |
| ":profile_proto", |
| ":samples_to_pprof_src", |
| "//sdk/lib/fit", |
| "//src/zircon/lib/zircon:headers", |
| "//third_party/protobuf:protobuf_full", |
| ] |
| sources = [ "samples_to_pprof_rust.cc" ] |
| } |
| |
| rustc_library("samples_to_pprof_rust") { |
| name = "samples_to_pprof" |
| edition = "2021" |
| source_root = "rust/src/lib.rs" |
| deps = [ ":rust_samples_to_pprof" ] |
| |
| sources = [ "rust/src/lib.rs" ] |
| } |
| } |
| |
| test("samples_to_pprof_test") { |
| sources = [ "samples_to_pprof_test.cc" ] |
| deps = [ |
| ":profile_proto", |
| ":samples_to_pprof_src", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| ] |
| } |
| |
| proto_library("profile_proto") { |
| proto_out_dir = "//src/performance/profiler/profile" |
| sources = [ "//third_party/perfetto/protos/third_party/pprof/profile.proto" ] |
| } |
| |
| install_host_tools("install") { |
| deps = [ ":samples_to_pprof($host_toolchain)" ] |
| outputs = [ "samples_to_pprof" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":samples_to_pprof_test" ] |
| } |