| # Copyright 2019 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/test.gni") |
| |
| source_set("perf-mon") { |
| visibility = [ ":*" ] |
| |
| sources = [ |
| "perf-mon.cc", |
| "perf-mon.h", |
| ] |
| |
| if (current_cpu == "arm64") { |
| sources += [ "arm64-pm.cc" ] |
| } else if (current_cpu == "x64") { |
| sources += [ "intel-pm.cc" ] |
| } else { |
| sources += [ "unsupported-arch.cc" ] |
| } |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.perfmon.cpu:fuchsia.perfmon.cpu_cpp", |
| "//sdk/lib/syslog/cpp", |
| "//zircon/system/ulib/zircon-internal", |
| ] |
| } |
| |
| executable("cpu-trace-bin") { |
| output_name = "cpu-trace" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| sources = [ "cpu-trace.cc" ] |
| |
| deps = [ |
| ":perf-mon", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_cpp", |
| "//sdk/fidl/fuchsia.perfmon.cpu:fuchsia.perfmon.cpu_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/fidl", |
| "//sdk/lib/syslog/cpp", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/zircon-internal", |
| ] |
| } |
| |
| fuchsia_package_with_single_component("cpu-trace") { |
| manifest = "meta/cpu-trace.cml" |
| deps = [ ":cpu-trace-bin" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":perf-mon-tests" ] |
| } |
| |
| test("perf-mon-tests-bin") { |
| output_name = "perf-mon-tests" |
| sources = [ "tests/perf-mon-tests.cc" ] |
| deps = [ |
| ":perf-mon", |
| "//sdk/fidl/fuchsia.perfmon.cpu:fuchsia.perfmon.cpu_cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fit", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/system/ulib/zircon-internal", |
| ] |
| } |
| |
| fuchsia_unittest_package("perf-mon-tests") { |
| deps = [ ":perf-mon-tests-bin" ] |
| } |