1# 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 15load( 16 "//absl:copts/configure_copts.bzl", 17 "ABSL_DEFAULT_COPTS", 18 "ABSL_DEFAULT_LINKOPTS", 19 "ABSL_TEST_COPTS", 20) 21 22package( 23 default_visibility = ["//visibility:private"], 24 features = [ 25 "header_modules", 26 "layering_check", 27 "parse_headers", 28 ], 29) 30 31licenses(["notice"]) 32 33cc_library( 34 name = "sample_recorder", 35 hdrs = ["internal/sample_recorder.h"], 36 copts = ABSL_DEFAULT_COPTS, 37 linkopts = ABSL_DEFAULT_LINKOPTS, 38 visibility = [ 39 "//absl:__subpackages__", 40 ], 41 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, 53 tags = [ 54 "no_test_wasm", 55 ], 56 deps = [ 57 ":sample_recorder", 58 "//absl/base:core_headers", 59 "//absl/synchronization", 60 "//absl/synchronization:thread_pool", 61 "//absl/time", 62 "@com_google_googletest//:gtest", 63 "@com_google_googletest//:gtest_main", 64 ], 65) 66 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", 91 "@com_google_googletest//:gtest", 92 "@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 = [ 103 # TODO(b/304670045): remove after periodic_sampler moves to //spanner/common. 104 "//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", 122 "@com_google_googletest//:gtest", 123 "@com_google_googletest//:gtest_main", 124 ], 125) 126 127cc_binary( 128 name = "periodic_sampler_benchmark", 129 testonly = True, 130 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) 141