blob: abe127ecdc99757c94943a78485b1613e10352e5 [file] [log] [blame]
Abseil Team4bb9e392021-09-01 13:48:23 -07001# Copyright 2021 The Abseil Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Abseil Teamb2dc72c2021-09-13 17:04:32 -070015load(
16 "//absl:copts/configure_copts.bzl",
17 "ABSL_DEFAULT_COPTS",
18 "ABSL_DEFAULT_LINKOPTS",
Abseil Teama59b4da2021-10-06 17:55:30 -070019 "ABSL_TEST_COPTS",
Abseil Teamb2dc72c2021-09-13 17:04:32 -070020)
21
Derek Mauro143e9832023-10-10 13:29:16 -070022package(
23 default_visibility = ["//visibility:private"],
24 features = [
Derek Mauro0ef3ef42023-10-11 07:57:33 -070025 "header_modules",
Derek Mauro143e9832023-10-10 13:29:16 -070026 "layering_check",
27 "parse_headers",
28 ],
29)
Abseil Team4bb9e392021-09-01 13:48:23 -070030
31licenses(["notice"])
Abseil Teamb2dc72c2021-09-13 17:04:32 -070032
33cc_library(
34 name = "sample_recorder",
35 hdrs = ["internal/sample_recorder.h"],
36 copts = ABSL_DEFAULT_COPTS,
37 linkopts = ABSL_DEFAULT_LINKOPTS,
Abseil Team29f83072021-09-20 13:35:36 -070038 visibility = [
39 "//absl:__subpackages__",
40 ],
Abseil Teamb2dc72c2021-09-13 17:04:32 -070041 deps = [
42 "//absl/base:config",
43 "//absl/base:core_headers",
44 "//absl/synchronization",
45 "//absl/time",
46 ],
47)
48
49cc_test(
50 name = "sample_recorder_test",
51 srcs = ["internal/sample_recorder_test.cc"],
52 linkopts = ABSL_DEFAULT_LINKOPTS,
Tom Rybkac34c5522022-06-02 08:22:18 -070053 tags = [
54 "no_test_wasm",
55 ],
Abseil Teamb2dc72c2021-09-13 17:04:32 -070056 deps = [
57 ":sample_recorder",
58 "//absl/base:core_headers",
59 "//absl/synchronization",
60 "//absl/synchronization:thread_pool",
61 "//absl/time",
Derek Mauro143e9832023-10-10 13:29:16 -070062 "@com_google_googletest//:gtest",
Abseil Teamb2dc72c2021-09-13 17:04:32 -070063 "@com_google_googletest//:gtest_main",
64 ],
65)
Abseil Teama59b4da2021-10-06 17:55:30 -070066
67cc_library(
68 name = "exponential_biased",
69 srcs = ["internal/exponential_biased.cc"],
70 hdrs = ["internal/exponential_biased.h"],
71 linkopts = ABSL_DEFAULT_LINKOPTS,
72 visibility = [
73 "//absl:__subpackages__",
74 ],
75 deps = [
76 "//absl/base:config",
77 "//absl/base:core_headers",
78 ],
79)
80
81cc_test(
82 name = "exponential_biased_test",
83 size = "small",
84 srcs = ["internal/exponential_biased_test.cc"],
85 copts = ABSL_TEST_COPTS,
86 linkopts = ABSL_DEFAULT_LINKOPTS,
87 visibility = ["//visibility:private"],
88 deps = [
89 ":exponential_biased",
90 "//absl/strings",
Derek Mauro143e9832023-10-10 13:29:16 -070091 "@com_google_googletest//:gtest",
Abseil Teama59b4da2021-10-06 17:55:30 -070092 "@com_google_googletest//:gtest_main",
93 ],
94)
95
96cc_library(
97 name = "periodic_sampler",
98 srcs = ["internal/periodic_sampler.cc"],
99 hdrs = ["internal/periodic_sampler.h"],
100 copts = ABSL_DEFAULT_COPTS,
101 linkopts = ABSL_DEFAULT_LINKOPTS,
102 visibility = [
Abseil Team8bb41742023-10-11 10:20:04 -0700103 # TODO(b/304670045): remove after periodic_sampler moves to //spanner/common.
Abseil Teama59b4da2021-10-06 17:55:30 -0700104 "//absl:__subpackages__",
105 ],
106 deps = [
107 ":exponential_biased",
108 "//absl/base:core_headers",
109 ],
110)
111
112cc_test(
113 name = "periodic_sampler_test",
114 size = "small",
115 srcs = ["internal/periodic_sampler_test.cc"],
116 copts = ABSL_TEST_COPTS,
117 linkopts = ABSL_DEFAULT_LINKOPTS,
118 visibility = ["//visibility:private"],
119 deps = [
120 ":periodic_sampler",
121 "//absl/base:core_headers",
Derek Mauro143e9832023-10-10 13:29:16 -0700122 "@com_google_googletest//:gtest",
Abseil Teama59b4da2021-10-06 17:55:30 -0700123 "@com_google_googletest//:gtest_main",
124 ],
125)
126
127cc_binary(
128 name = "periodic_sampler_benchmark",
Shahriar Rouf780bfc12024-01-31 10:07:48 -0800129 testonly = True,
Abseil Teama59b4da2021-10-06 17:55:30 -0700130 srcs = ["internal/periodic_sampler_benchmark.cc"],
131 copts = ABSL_TEST_COPTS,
132 linkopts = ABSL_DEFAULT_LINKOPTS,
133 tags = ["benchmark"],
134 visibility = ["//visibility:private"],
135 deps = [
136 ":periodic_sampler",
137 "//absl/base:core_headers",
138 "@com_github_google_benchmark//:benchmark_main",
139 ],
140)