# Copyright (C) 2022 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("../../../../gn/test.gni")

source_set("minimal") {
  sources = [
    "ftrace_module.cc",
    "ftrace_module.h",
  ]
  deps = [
    "../../../../gn:default_deps",
    "../common:parser_types",
    "../proto:proto_importer_module",
  ]
}

source_set("full") {
  sources = [
    "binder_tracker.cc",
    "binder_tracker.h",
    "drm_tracker.cc",
    "drm_tracker.h",
    "ftrace_module_impl.cc",
    "ftrace_module_impl.h",
    "ftrace_parser.cc",
    "ftrace_parser.h",
    "ftrace_sched_event_tracker.cc",
    "ftrace_sched_event_tracker.h",
    "ftrace_tokenizer.cc",
    "ftrace_tokenizer.h",
    "generic_ftrace_tracker.cc",
    "generic_ftrace_tracker.h",
    "gpu_work_period_tracker.cc",
    "gpu_work_period_tracker.h",
    "iostat_tracker.cc",
    "iostat_tracker.h",
    "mali_gpu_event_tracker.cc",
    "mali_gpu_event_tracker.h",
    "pixel_mm_kswapd_event_tracker.cc",
    "pixel_mm_kswapd_event_tracker.h",
    "pkvm_hyp_cpu_tracker.cc",
    "pkvm_hyp_cpu_tracker.h",
    "rss_stat_tracker.cc",
    "rss_stat_tracker.h",
    "thermal_tracker.cc",
    "thermal_tracker.h",
    "v4l2_tracker.cc",
    "v4l2_tracker.h",
    "virtio_gpu_tracker.cc",
    "virtio_gpu_tracker.h",
    "virtio_video_tracker.cc",
    "virtio_video_tracker.h",
  ]
  deps = [
    ":ftrace_descriptors",
    ":minimal",
    "../../../../gn:default_deps",
    "../../../../protos/perfetto/common:zero",
    "../../../../protos/perfetto/trace:zero",
    "../../../../protos/perfetto/trace/ftrace:zero",
    "../../../../protos/perfetto/trace/interned_data:zero",
    "../../../../protos/perfetto/trace/profiling:zero",
    "../../../protozero",
    "../../sorter",
    "../../storage",
    "../../tables",
    "../../types",
    "../common",
    "../common:parser_types",
    "../i2c:full",
    "../proto:minimal",
    "../proto:packet_sequence_state_generation_hdr",
    "../syscalls:full",
    "../systrace:systrace_parser",
  ]
}

source_set("ftrace_descriptors") {
  sources = [
    "ftrace_descriptors.cc",
    "ftrace_descriptors.h",
  ]
  deps = [
    "../../../../gn:default_deps",
    "../../../../include/perfetto/ext/base:base",
    "../../../protozero",
  ]
}

perfetto_unittest_source_set("unittests") {
  testonly = true
  sources = [
    "binder_tracker_unittest.cc",
    "ftrace_sched_event_tracker_unittest.cc",
  ]
  deps = [
    "../../../../gn:default_deps",
    "../../../../gn:gtest_and_gmock",
    "../../storage",
    "../../types",
    "../common",
    "../ftrace:full",
  ]
}
