| # Copyright 2017 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/config.gni") |
| import("//build/package.gni") |
| import("//third_party/cobalt/metrics_registry.gni") |
| import("//third_party/protobuf/proto_library.gni") |
| |
| metrics_registry("metrics_registry") { |
| # This must match the ID of our Cobalt project as specified in: |
| # third_party/cobalt_config/projects.yaml |
| project_id = 1334068210 |
| namespace = "fuchsia_system_metrics" |
| generate_cc = true |
| generate_binarypb = false |
| } |
| |
| metrics_registry("diagnostics_metrics_registry") { |
| # This must match the ID of our Cobalt project as specified in: |
| # third_party/cobalt_config/projects.yaml |
| project_id = 5 |
| namespace = "fuchsia_component_diagnostics" |
| generate_cc = true |
| generate_binarypb = false |
| } |
| |
| source_set("system_metrics_daemon_lib") { |
| sources = [ |
| "activity_listener.cc", |
| "activity_listener.h", |
| "cpu_stats_fetcher.h", |
| "cpu_stats_fetcher_impl.cc", |
| "cpu_stats_fetcher_impl.h", |
| "log_stats_fetcher.h", |
| "log_stats_fetcher_impl.cc", |
| "log_stats_fetcher_impl.h", |
| "system_metrics_daemon.cc", |
| "system_metrics_daemon.h", |
| ] |
| |
| public_deps = [ |
| ":diagnostics_metrics_registry_cc", |
| ":metrics_registry_cc", |
| "//sdk/fidl/fuchsia.cobalt", |
| "//sdk/fidl/fuchsia.diagnostics", |
| "//sdk/fidl/fuchsia.hardware.thermal:fuchsia.hardware.thermal_c", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_llcpp", |
| "//sdk/fidl/fuchsia.ui.activity", |
| "//sdk/lib/inspect/contrib/cpp:archive_reader", |
| "//sdk/lib/sys/cpp", |
| "//sdk/lib/sys/inspect/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/cobalt/bin/utils:clock", |
| "//src/cobalt/bin/utils:status_utils", |
| "//src/lib/cobalt/cpp:cobalt_event_builder", |
| "//src/lib/fsl", |
| "//src/lib/fxl", |
| "//third_party/cobalt/src/registry:buckets_config", |
| "//zircon/public/lib/zx", |
| "//zircon/system/ulib/abs_clock", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace-provider:trace-provider-with-fdio", |
| ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| executable("system-metrics") { |
| output_name = "cobalt_system_metrics_bin" |
| |
| sources = [ "system_metrics_main.cc" ] |
| |
| deps = [ |
| ":system_metrics_daemon_lib", |
| "//sdk/lib/sys/cpp", |
| ] |
| } |
| |
| config_data("config") { |
| for_pkg = "cobalt_system_metrics" |
| |
| sources = [ |
| # The metric specs for granular error stats. |
| "granular_error_stats_specs.txt", |
| |
| # The default allowlist included in core. Other products can define their own allowlist. |
| "log_stats_component_allowlist.txt", |
| ] |
| } |
| |
| package("cobalt_system_metrics") { |
| deps = [ ":system-metrics" ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/cobalt_system_metrics.cmx") |
| dest = "cobalt_system_metrics.cmx" |
| }, |
| ] |
| |
| binaries = [ |
| { |
| name = "cobalt_system_metrics_bin" |
| dest = "cobalt_system_metrics" |
| }, |
| ] |
| } |
| |
| executable("cobalt_system_metrics_unittests") { |
| testonly = true |
| |
| sources = [ |
| "log_stats_fetcher_impl_test.cc", |
| "system_metrics_daemon_test.cc", |
| ] |
| |
| deps = [ |
| ":system_metrics_daemon_lib", |
| "testing:fake_fetchers", |
| "//garnet/public/lib/gtest", |
| "//sdk/fidl/fuchsia.cobalt", |
| "//sdk/lib/inspect/testing/cpp", |
| "//sdk/lib/sys/cpp/testing:unit", |
| "//src/cobalt/bin/testing:fake_clock_lib", |
| "//src/cobalt/bin/testing:fake_logger_lib", |
| "//src/cobalt/bin/utils:clock", |
| "//src/lib/fsl", |
| "//src/lib/fxl/test:gtest_main", |
| ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| |
| # TODO(67363): Temporarily disable lsan for this target. Reenable once all leaks are fixed. |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |