BUILD.bazel 3.6 KB

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