xref: /aosp_15_r20/external/abseil-cpp/absl/profiling/BUILD.bazel (revision 9356374a3709195abf420251b3e825997ff56c0f)
1*9356374aSAndroid Build Coastguard Worker# Copyright 2021 The Abseil Authors
2*9356374aSAndroid Build Coastguard Worker#
3*9356374aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*9356374aSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*9356374aSAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*9356374aSAndroid Build Coastguard Worker#
7*9356374aSAndroid Build Coastguard Worker#     https://www.apache.org/licenses/LICENSE-2.0
8*9356374aSAndroid Build Coastguard Worker#
9*9356374aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*9356374aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*9356374aSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*9356374aSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*9356374aSAndroid Build Coastguard Worker# limitations under the License.
14*9356374aSAndroid Build Coastguard Worker
15*9356374aSAndroid Build Coastguard Workerload(
16*9356374aSAndroid Build Coastguard Worker    "//absl:copts/configure_copts.bzl",
17*9356374aSAndroid Build Coastguard Worker    "ABSL_DEFAULT_COPTS",
18*9356374aSAndroid Build Coastguard Worker    "ABSL_DEFAULT_LINKOPTS",
19*9356374aSAndroid Build Coastguard Worker    "ABSL_TEST_COPTS",
20*9356374aSAndroid Build Coastguard Worker)
21*9356374aSAndroid Build Coastguard Worker
22*9356374aSAndroid Build Coastguard Workerpackage(
23*9356374aSAndroid Build Coastguard Worker    default_visibility = ["//visibility:private"],
24*9356374aSAndroid Build Coastguard Worker    features = [
25*9356374aSAndroid Build Coastguard Worker        "header_modules",
26*9356374aSAndroid Build Coastguard Worker        "layering_check",
27*9356374aSAndroid Build Coastguard Worker        "parse_headers",
28*9356374aSAndroid Build Coastguard Worker    ],
29*9356374aSAndroid Build Coastguard Worker)
30*9356374aSAndroid Build Coastguard Worker
31*9356374aSAndroid Build Coastguard Workerlicenses(["notice"])
32*9356374aSAndroid Build Coastguard Worker
33*9356374aSAndroid Build Coastguard Workercc_library(
34*9356374aSAndroid Build Coastguard Worker    name = "sample_recorder",
35*9356374aSAndroid Build Coastguard Worker    hdrs = ["internal/sample_recorder.h"],
36*9356374aSAndroid Build Coastguard Worker    copts = ABSL_DEFAULT_COPTS,
37*9356374aSAndroid Build Coastguard Worker    linkopts = ABSL_DEFAULT_LINKOPTS,
38*9356374aSAndroid Build Coastguard Worker    visibility = [
39*9356374aSAndroid Build Coastguard Worker        "//absl:__subpackages__",
40*9356374aSAndroid Build Coastguard Worker    ],
41*9356374aSAndroid Build Coastguard Worker    deps = [
42*9356374aSAndroid Build Coastguard Worker        "//absl/base:config",
43*9356374aSAndroid Build Coastguard Worker        "//absl/base:core_headers",
44*9356374aSAndroid Build Coastguard Worker        "//absl/synchronization",
45*9356374aSAndroid Build Coastguard Worker        "//absl/time",
46*9356374aSAndroid Build Coastguard Worker    ],
47*9356374aSAndroid Build Coastguard Worker)
48*9356374aSAndroid Build Coastguard Worker
49*9356374aSAndroid Build Coastguard Workercc_test(
50*9356374aSAndroid Build Coastguard Worker    name = "sample_recorder_test",
51*9356374aSAndroid Build Coastguard Worker    srcs = ["internal/sample_recorder_test.cc"],
52*9356374aSAndroid Build Coastguard Worker    linkopts = ABSL_DEFAULT_LINKOPTS,
53*9356374aSAndroid Build Coastguard Worker    tags = [
54*9356374aSAndroid Build Coastguard Worker        "no_test_wasm",
55*9356374aSAndroid Build Coastguard Worker    ],
56*9356374aSAndroid Build Coastguard Worker    deps = [
57*9356374aSAndroid Build Coastguard Worker        ":sample_recorder",
58*9356374aSAndroid Build Coastguard Worker        "//absl/base:core_headers",
59*9356374aSAndroid Build Coastguard Worker        "//absl/synchronization",
60*9356374aSAndroid Build Coastguard Worker        "//absl/synchronization:thread_pool",
61*9356374aSAndroid Build Coastguard Worker        "//absl/time",
62*9356374aSAndroid Build Coastguard Worker        "@com_google_googletest//:gtest",
63*9356374aSAndroid Build Coastguard Worker        "@com_google_googletest//:gtest_main",
64*9356374aSAndroid Build Coastguard Worker    ],
65*9356374aSAndroid Build Coastguard Worker)
66*9356374aSAndroid Build Coastguard Worker
67*9356374aSAndroid Build Coastguard Workercc_library(
68*9356374aSAndroid Build Coastguard Worker    name = "exponential_biased",
69*9356374aSAndroid Build Coastguard Worker    srcs = ["internal/exponential_biased.cc"],
70*9356374aSAndroid Build Coastguard Worker    hdrs = ["internal/exponential_biased.h"],
71*9356374aSAndroid Build Coastguard Worker    linkopts = ABSL_DEFAULT_LINKOPTS,
72*9356374aSAndroid Build Coastguard Worker    visibility = [
73*9356374aSAndroid Build Coastguard Worker        "//absl:__subpackages__",
74*9356374aSAndroid Build Coastguard Worker    ],
75*9356374aSAndroid Build Coastguard Worker    deps = [
76*9356374aSAndroid Build Coastguard Worker        "//absl/base:config",
77*9356374aSAndroid Build Coastguard Worker        "//absl/base:core_headers",
78*9356374aSAndroid Build Coastguard Worker    ],
79*9356374aSAndroid Build Coastguard Worker)
80*9356374aSAndroid Build Coastguard Worker
81*9356374aSAndroid Build Coastguard Workercc_test(
82*9356374aSAndroid Build Coastguard Worker    name = "exponential_biased_test",
83*9356374aSAndroid Build Coastguard Worker    size = "small",
84*9356374aSAndroid Build Coastguard Worker    srcs = ["internal/exponential_biased_test.cc"],
85*9356374aSAndroid Build Coastguard Worker    copts = ABSL_TEST_COPTS,
86*9356374aSAndroid Build Coastguard Worker    linkopts = ABSL_DEFAULT_LINKOPTS,
87*9356374aSAndroid Build Coastguard Worker    visibility = ["//visibility:private"],
88*9356374aSAndroid Build Coastguard Worker    deps = [
89*9356374aSAndroid Build Coastguard Worker        ":exponential_biased",
90*9356374aSAndroid Build Coastguard Worker        "//absl/strings",
91*9356374aSAndroid Build Coastguard Worker        "@com_google_googletest//:gtest",
92*9356374aSAndroid Build Coastguard Worker        "@com_google_googletest//:gtest_main",
93*9356374aSAndroid Build Coastguard Worker    ],
94*9356374aSAndroid Build Coastguard Worker)
95*9356374aSAndroid Build Coastguard Worker
96*9356374aSAndroid Build Coastguard Workercc_library(
97*9356374aSAndroid Build Coastguard Worker    name = "periodic_sampler",
98*9356374aSAndroid Build Coastguard Worker    srcs = ["internal/periodic_sampler.cc"],
99*9356374aSAndroid Build Coastguard Worker    hdrs = ["internal/periodic_sampler.h"],
100*9356374aSAndroid Build Coastguard Worker    copts = ABSL_DEFAULT_COPTS,
101*9356374aSAndroid Build Coastguard Worker    linkopts = ABSL_DEFAULT_LINKOPTS,
102*9356374aSAndroid Build Coastguard Worker    visibility = [
103*9356374aSAndroid Build Coastguard Worker        # TODO(b/304670045): remove after periodic_sampler moves to //spanner/common.
104*9356374aSAndroid Build Coastguard Worker        "//absl:__subpackages__",
105*9356374aSAndroid Build Coastguard Worker    ],
106*9356374aSAndroid Build Coastguard Worker    deps = [
107*9356374aSAndroid Build Coastguard Worker        ":exponential_biased",
108*9356374aSAndroid Build Coastguard Worker        "//absl/base:core_headers",
109*9356374aSAndroid Build Coastguard Worker    ],
110*9356374aSAndroid Build Coastguard Worker)
111*9356374aSAndroid Build Coastguard Worker
112*9356374aSAndroid Build Coastguard Workercc_test(
113*9356374aSAndroid Build Coastguard Worker    name = "periodic_sampler_test",
114*9356374aSAndroid Build Coastguard Worker    size = "small",
115*9356374aSAndroid Build Coastguard Worker    srcs = ["internal/periodic_sampler_test.cc"],
116*9356374aSAndroid Build Coastguard Worker    copts = ABSL_TEST_COPTS,
117*9356374aSAndroid Build Coastguard Worker    linkopts = ABSL_DEFAULT_LINKOPTS,
118*9356374aSAndroid Build Coastguard Worker    visibility = ["//visibility:private"],
119*9356374aSAndroid Build Coastguard Worker    deps = [
120*9356374aSAndroid Build Coastguard Worker        ":periodic_sampler",
121*9356374aSAndroid Build Coastguard Worker        "//absl/base:core_headers",
122*9356374aSAndroid Build Coastguard Worker        "@com_google_googletest//:gtest",
123*9356374aSAndroid Build Coastguard Worker        "@com_google_googletest//:gtest_main",
124*9356374aSAndroid Build Coastguard Worker    ],
125*9356374aSAndroid Build Coastguard Worker)
126*9356374aSAndroid Build Coastguard Worker
127*9356374aSAndroid Build Coastguard Workercc_binary(
128*9356374aSAndroid Build Coastguard Worker    name = "periodic_sampler_benchmark",
129*9356374aSAndroid Build Coastguard Worker    testonly = True,
130*9356374aSAndroid Build Coastguard Worker    srcs = ["internal/periodic_sampler_benchmark.cc"],
131*9356374aSAndroid Build Coastguard Worker    copts = ABSL_TEST_COPTS,
132*9356374aSAndroid Build Coastguard Worker    linkopts = ABSL_DEFAULT_LINKOPTS,
133*9356374aSAndroid Build Coastguard Worker    tags = ["benchmark"],
134*9356374aSAndroid Build Coastguard Worker    visibility = ["//visibility:private"],
135*9356374aSAndroid Build Coastguard Worker    deps = [
136*9356374aSAndroid Build Coastguard Worker        ":periodic_sampler",
137*9356374aSAndroid Build Coastguard Worker        "//absl/base:core_headers",
138*9356374aSAndroid Build Coastguard Worker        "@com_github_google_benchmark//:benchmark_main",
139*9356374aSAndroid Build Coastguard Worker    ],
140*9356374aSAndroid Build Coastguard Worker)
141