# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================

# Description:
# profile_utils targets.

load("//xla/tsl:tsl.bzl", "internal_visibility", "tsl_copts")
load("//xla/tsl:tsl.default.bzl", "filegroup")
load(
    "//xla/tsl/platform:rules_cc.bzl",
    "cc_library",
)

package(
    # copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
    default_visibility = internal_visibility([
        "//xla/stream_executor:__subpackages__",
        "//tensorflow/core/platform:__subpackages__",
        "@tsl//tsl:__pkg__",
        "//xla/tsl/platform/default:__pkg__",
    ]),
    licenses = ["notice"],
)

exports_files(srcs = [
    "android_armv7a_cpu_utils_helper.cc",
    "android_armv7a_cpu_utils_helper.h",
    "clock_cycle_profiler.h",
    "cpu_utils.cc",
    "cpu_utils.h",
    "cpu_utils_test.cc",
    "i_cpu_utils_helper.h",
])

filegroup(
    name = "legacy_lib_internal_srcs",
    srcs = [
        "clock_cycle_profiler.cc",
    ],
    visibility = internal_visibility([
        "//tensorflow/core/platform:__subpackages__",
        "@tsl//tsl/platform:__pkg__",
    ]),
)

cc_library(
    name = "profile_utils_cpu_utils",
    srcs = [
        "android_armv7a_cpu_utils_helper.cc",
        "android_armv7a_cpu_utils_helper.h",
        "cpu_utils.cc",
    ],
    hdrs = [
        "cpu_utils.h",
        "i_cpu_utils_helper.h",
    ],
    copts = tsl_copts(),
    deps = [
        "//xla/tsl/platform:logging",
        "//xla/tsl/platform:macros",
        "//xla/tsl/platform:types",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/strings:str_format",
    ],
    alwayslink = 1,
)
