| # 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/components.gni") | |
| import("//build/rust/rustc_binary.gni") | |
| import("//tools/protobuf/rust_proto_library.gni") | |
| rust_proto_library("profile_rust_proto") { | |
| sources = [ "//third_party/perfetto/protos/third_party/pprof/profile.proto" ] | |
| packages = [ "perfetto.third_party.perftools.profiles" ] | |
| } | |
| rustc_binary("bin") { | |
| edition = "2024" | |
| output_name = "memory_sampler" | |
| with_unit_tests = true | |
| sources = [ | |
| "src/crash_reporter.rs", | |
| "src/main.rs", | |
| "src/pprof.rs", | |
| "src/profile_builder.rs", | |
| "src/sampler_service.rs", | |
| ] | |
| deps = [ | |
| ":profile_rust_proto", | |
| "//sdk/fidl/fuchsia.feedback:fuchsia.feedback_rust", | |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem_rust", | |
| "//sdk/fidl/fuchsia.memory.sampler:fuchsia.memory.sampler_rust", | |
| "//sdk/rust/zx", | |
| "//src/lib/fidl/rust/fidl", | |
| "//src/lib/fuchsia", | |
| "//src/lib/fuchsia-async", | |
| "//src/lib/fuchsia-component", | |
| "//third_party/rust_crates:anyhow", | |
| "//third_party/rust_crates:flate2", | |
| "//third_party/rust_crates:futures", | |
| "//third_party/rust_crates:hex", | |
| "//third_party/rust_crates:log", | |
| "//third_party/rust_crates:prost", | |
| "//third_party/rust_crates:tar", | |
| ] | |
| test_deps = [ "//third_party/rust_crates:itertools" ] | |
| } | |
| fuchsia_component("component") { | |
| component_name = "memory_sampler" | |
| manifest = "meta/memory_sampler.cml" | |
| deps = [ ":bin" ] | |
| } | |
| fuchsia_package("memory_sampler") { | |
| deps = [ ":component" ] | |
| } | |
| fuchsia_unittest_package("memory_sampler_tests") { | |
| deps = [ ":bin_test" ] | |
| } | |
| group("tests") { | |
| testonly = true | |
| deps = [ | |
| ":memory_sampler_tests", | |
| "instrumentation/tests:memory_sampler_instrumentation_tests", | |
| ] | |
| } |