| # Copyright 2018 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("//third_party/cobalt/metrics_registry.gni") |
| |
| source_set("lib") { |
| sources = [ |
| "high_water.cc", |
| "high_water.h", |
| "imminent_oom_observer.cc", |
| "imminent_oom_observer.h", |
| "logger.cc", |
| "logger.h", |
| "metrics.cc", |
| "metrics.h", |
| "monitor.cc", |
| "monitor.h", |
| ] |
| public_deps = [ |
| ":memory_monitor_config", |
| "//sdk/fidl/fuchsia.hardware.ram.metrics:fuchsia.hardware.ram.metrics_cpp", |
| "//sdk/fidl/fuchsia.memory.inspection:fuchsia.memory.inspection_cpp", |
| "//sdk/fidl/fuchsia.memorypressure:fuchsia.memorypressure_cpp", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_cpp", |
| "//sdk/lib/inspect/component/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/developer/memory/metrics", |
| "//zircon/system/ulib/inspect", |
| "//zircon/system/ulib/trace", |
| ] |
| deps = [ |
| ":memory_metrics_registry", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_cpp", |
| "//sdk/lib/async-loop:async-loop-cpp", |
| "//sdk/lib/async-loop:async-loop-default", |
| "//sdk/lib/component/incoming/cpp", |
| "//src/developer/memory/pressure_signaler:lib", |
| "//src/devices/lib/amlogic", |
| "//src/lib/fsl", |
| "//zircon/system/ulib/trace-provider", |
| "//zircon/system/ulib/trace-vthread", |
| ] |
| } |
| |
| metrics_registry("memory_metrics_registry") { |
| # This must match the ID of our Cobalt project as specified in: |
| # third_party/cobalt_config/projects.yaml |
| project_id = 3509424520 |
| namespace = "cobalt_registry" |
| generate_cc = true |
| generate_binarypb = false |
| } |
| |
| _common_deps = [ |
| ":lib", |
| "//sdk/lib/async-default", |
| "//sdk/lib/async-loop:async-loop-cpp", |
| "//sdk/lib/async-loop:async-loop-default", |
| "//sdk/lib/scheduler/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fsl", |
| "//src/lib/fxl:fxl_cli", |
| "//zircon/system/ulib/trace-provider", |
| ] |
| |
| executable("bin") { |
| output_name = "memory_monitor" |
| sources = [ "main.cc" ] |
| deps = _common_deps |
| } |
| |
| executable("bin_with_memory_sampler") { |
| output_name = "memory_monitor_with_memory_sampler" |
| sources = [ "main.cc" ] |
| deps = _common_deps + [ "//src/performance/memory/sampler/instrumentation" ] |
| } |
| |
| fuchsia_component_manifest("memory_monitor_manifest") { |
| component_name = "memory_monitor" |
| manifest = "meta/memory_monitor.cml" |
| } |
| |
| fuchsia_component_manifest("memory_monitor_with_memory_sampler_manifest") { |
| component_name = "memory_monitor" |
| manifest = "meta/memory_monitor_with_memory_sampler.cml" |
| } |
| |
| fuchsia_structured_config_cpp_elf_lib("memory_monitor_config") { |
| cm_label = ":memory_monitor_manifest" |
| } |
| |
| fuchsia_structured_config_values("memory_monitor_default_config") { |
| cm_label = ":memory_monitor_manifest" |
| values_source = "config/config_values.json5" |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":memory_monitor_manifest" |
| deps = [ |
| ":bin", |
| ":memory_monitor_default_config", |
| ] |
| } |
| |
| fuchsia_structured_config_values( |
| "memory_monitor_with_memory_sampler_default_config") { |
| cm_label = ":memory_monitor_with_memory_sampler_manifest" |
| values_source = "config/config_values.json5" |
| } |
| |
| fuchsia_component("component_with_memory_sampler") { |
| cm_label = ":memory_monitor_with_memory_sampler_manifest" |
| deps = [ ":bin_with_memory_sampler" ] |
| } |
| |
| fuchsia_package("monitor_without_memory_sampler") { |
| package_name = "memory_monitor" |
| deps = [ |
| ":component", |
| ":memory_monitor_default_config", |
| ] |
| } |
| |
| fuchsia_package("monitor_with_memory_sampler") { |
| package_name = "memory_monitor" |
| deps = [ |
| ":component_with_memory_sampler", |
| ":memory_monitor_with_memory_sampler_default_config", |
| ] |
| } |