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(default_visibility = ["//visibility:private"]) 23 24licenses(["notice"]) 25 26cc_library( 27 name = "sample_recorder", 28 hdrs = ["internal/sample_recorder.h"], 29 copts = ABSL_DEFAULT_COPTS, 30 linkopts = ABSL_DEFAULT_LINKOPTS, 31 visibility = [ 32 "//absl:__subpackages__", 33 ], 34 deps = [ 35 "//absl/base:config", 36 "//absl/base:core_headers", 37 "//absl/synchronization", 38 "//absl/time", 39 ], 40) 41 42cc_test( 43 name = "sample_recorder_test", 44 srcs = ["internal/sample_recorder_test.cc"], 45 linkopts = ABSL_DEFAULT_LINKOPTS, 46 deps = [ 47 ":sample_recorder", 48 "//absl/base:core_headers", 49 "//absl/synchronization", 50 "//absl/synchronization:thread_pool", 51 "//absl/time", 52 "@com_google_googletest//:gtest_main", 53 ], 54) 55 56cc_library( 57 name = "exponential_biased", 58 srcs = ["internal/exponential_biased.cc"], 59 hdrs = ["internal/exponential_biased.h"], 60 linkopts = ABSL_DEFAULT_LINKOPTS, 61 visibility = [ 62 "//absl:__subpackages__", 63 ], 64 deps = [ 65 "//absl/base:config", 66 "//absl/base:core_headers", 67 ], 68) 69 70cc_test( 71 name = "exponential_biased_test", 72 size = "small", 73 srcs = ["internal/exponential_biased_test.cc"], 74 copts = ABSL_TEST_COPTS, 75 linkopts = ABSL_DEFAULT_LINKOPTS, 76 visibility = ["//visibility:private"], 77 deps = [ 78 ":exponential_biased", 79 "//absl/strings", 80 "@com_google_googletest//:gtest_main", 81 ], 82) 83 84cc_library( 85 name = "periodic_sampler", 86 srcs = ["internal/periodic_sampler.cc"], 87 hdrs = ["internal/periodic_sampler.h"], 88 copts = ABSL_DEFAULT_COPTS, 89 linkopts = ABSL_DEFAULT_LINKOPTS, 90 visibility = [ 91 "//absl:__subpackages__", 92 ], 93 deps = [ 94 ":exponential_biased", 95 "//absl/base:core_headers", 96 ], 97) 98 99cc_test( 100 name = "periodic_sampler_test", 101 size = "small", 102 srcs = ["internal/periodic_sampler_test.cc"], 103 copts = ABSL_TEST_COPTS, 104 linkopts = ABSL_DEFAULT_LINKOPTS, 105 visibility = ["//visibility:private"], 106 deps = [ 107 ":periodic_sampler", 108 "//absl/base:core_headers", 109 "@com_google_googletest//:gtest_main", 110 ], 111) 112 113cc_binary( 114 name = "periodic_sampler_benchmark", 115 testonly = 1, 116 srcs = ["internal/periodic_sampler_benchmark.cc"], 117 copts = ABSL_TEST_COPTS, 118 linkopts = ABSL_DEFAULT_LINKOPTS, 119 tags = ["benchmark"], 120 visibility = ["//visibility:private"], 121 deps = [ 122 ":periodic_sampler", 123 "//absl/base:core_headers", 124 "@com_github_google_benchmark//:benchmark_main", 125 ], 126) 127