# Copyright (c) 2023 Project CHIP Authors
#
# 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("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("${build_root}/config/compiler/compiler.gni")
import("${chip_root}/src/platform/device.gni")

declare_args() {
  # Tracing can have a non-zero size impact to binaries. We try to make
  # the impact minimal (the backends themselves add some size), however
  # for now tracing is opt-in
  #
  # Additionally, if tracing is enabled, the main() function has to add
  # backends explicitly
  matter_enable_tracing_support = false

  # Defines the trace backend. Current matter tracing splits the logic
  # into two parts:
  #   - data logging, well defined and using type-safe data
  #   - trace begin/end/instant states for monitoring execution and
  #     checking execution time and performance
  # For tracing specifically, due to performance constraints, several
  # backends prefer to be the one and only tracing provider (e.g.
  # pw_tracing uses tokenization to reduce string sizes and allow
  # for fast tracing even when the communication channels are slow).
  #
  # The setting below controls the destination of the tracing macros
  #
  # Notable built-in targets:
  #    "${chip_root}/src/tracing/none" disables the scopes macros
  #    "${chip_root}/src/tracing/multiplexed" sends begin/end/instant to backends
  #
  # since tracing is very noisy, we generally expect it to be explicitly
  # set up.
  #
  matter_trace_config = ""
  matter_enable_esp_insights_trace = false
}

if (current_os == "android" ||
    (chip_device_platform == "esp32" && matter_enable_esp_insights_trace)) {
  matter_enable_tracing_support = true
}

if (current_os == "linux" || current_os == "android") {
  matter_trace_config = "${chip_root}/src/tracing/perfetto:perfetto_tracing"
} else if (chip_device_platform == "esp32" &&
           matter_enable_esp_insights_trace) {
  matter_trace_config = "${chip_root}/src/tracing/esp32_trace"
} else {
  matter_trace_config = "${chip_root}/src/tracing/none"
}
