aboutsummaryrefslogtreecommitdiff
path: root/absl/random
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-08-07 15:25:26 -0700
committerGravatar CJ Johnson <johnsoncj@google.com>2019-08-08 11:25:03 -0400
commit8efba58a3b656e9b41fb0471ae6453425a61c520 (patch)
treecbf508ad433c030e577afb87b89faba36539549b /absl/random
parentb49b8d16b67ec6912899684b732e6367f258cfdb (diff)
Export of internal Abseil changes
-- 38bc0644e17bf9fe4d78d3db92cd06f585b99ba7 by Andy Soffer <asoffer@google.com>: Change benchmark to be cc_binary instead of cc_test, and fix a bug in the zipf_distribution benchmark in which arguments were passed in the wrong order. PiperOrigin-RevId: 262227159 -- 3b5411d8f285a758a1713f7ef0dbfa3518f2b38b by CJ Johnson <johnsoncj@google.com>: Updates Simple<*>() overload to match the name schema of the others PiperOrigin-RevId: 262211217 -- 0cb6812cb8b6e3bf0386b9354189ffcf46c4c094 by Andy Soffer <asoffer@google.com>: Removing period in trailing namespace comments. PiperOrigin-RevId: 262210952 -- c903feae3a881be81adf37e9fccd558ee3ed1e64 by CJ Johnson <johnsoncj@google.com>: This is a cleanup on the public header of InlinedVector to be more presentable PiperOrigin-RevId: 262207691 -- 9a94384dc79cdcf38f6153894f337ebb744e2d76 by Tom Manshreck <shreck@google.com>: Fix incorrect doc on operator()[] for flat_hash_set PiperOrigin-RevId: 262206962 -- 17e88ee10b727af82c04f8150b6d246eaac836cb by Derek Mauro <dmauro@google.com>: Fix gcc-5 build error PiperOrigin-RevId: 262198236 GitOrigin-RevId: 38bc0644e17bf9fe4d78d3db92cd06f585b99ba7 Change-Id: I77cababa47ba3ee8b6cebb2c2cfc9f60a331f6b7
Diffstat (limited to 'absl/random')
-rw-r--r--absl/random/BUILD.bazel4
-rw-r--r--absl/random/benchmarks.cc12
-rw-r--r--absl/random/distributions.h2
-rw-r--r--absl/random/internal/seed_material_test.cc3
-rw-r--r--absl/random/zipf_distribution.h2
5 files changed, 12 insertions, 11 deletions
diff --git a/absl/random/BUILD.bazel b/absl/random/BUILD.bazel
index 00d42c9..f7587bf 100644
--- a/absl/random/BUILD.bazel
+++ b/absl/random/BUILD.bazel
@@ -368,9 +368,9 @@ BENCHMARK_TAGS = [
]
# Benchmarks for various methods / test utilities
-cc_test(
+cc_binary(
name = "benchmarks",
- size = "small",
+ testonly = 1,
srcs = [
"benchmarks.cc",
],
diff --git a/absl/random/benchmarks.cc b/absl/random/benchmarks.cc
index 265d54d..87bbb98 100644
--- a/absl/random/benchmarks.cc
+++ b/absl/random/benchmarks.cc
@@ -25,7 +25,6 @@
#include <type_traits>
#include <vector>
-#include "benchmark/benchmark.h"
#include "absl/base/macros.h"
#include "absl/meta/type_traits.h"
#include "absl/random/bernoulli_distribution.h"
@@ -40,6 +39,7 @@
#include "absl/random/uniform_int_distribution.h"
#include "absl/random/uniform_real_distribution.h"
#include "absl/random/zipf_distribution.h"
+#include "benchmark/benchmark.h"
namespace {
@@ -221,12 +221,12 @@ void BM_Poisson(benchmark::State& state) {
BM_Dist<Engine, Dist>(state, a);
}
-template <typename Engine, typename Dist, int V = 1, int Q = 2>
+template <typename Engine, typename Dist, int Q = 2, int V = 1>
void BM_Zipf(benchmark::State& state) {
using value_type = typename Dist::result_type;
- volatile double v = V;
volatile double q = Q;
- BM_Dist<Engine, Dist>(state, std::numeric_limits<value_type>::max(), v, q);
+ volatile double v = V;
+ BM_Dist<Engine, Dist>(state, std::numeric_limits<value_type>::max(), q, v);
}
template <typename Engine, typename Dist>
@@ -333,8 +333,8 @@ void BM_Thread(benchmark::State& state) {
absl::log_uniform_int_distribution<int64_t>); \
BENCHMARK_TEMPLATE(BM_Dist, Engine, std::geometric_distribution<int64_t>); \
BENCHMARK_TEMPLATE(BM_Zipf, Engine, absl::zipf_distribution<uint64_t>); \
- BENCHMARK_TEMPLATE(BM_Zipf, Engine, absl::zipf_distribution<uint64_t>, 3, \
- 2); \
+ BENCHMARK_TEMPLATE(BM_Zipf, Engine, absl::zipf_distribution<uint64_t>, 2, \
+ 3); \
BENCHMARK_TEMPLATE(BM_Bernoulli, Engine, std::bernoulli_distribution, \
257305); \
BENCHMARK_TEMPLATE(BM_Bernoulli, Engine, absl::bernoulli_distribution, \
diff --git a/absl/random/distributions.h b/absl/random/distributions.h
index c37b734..d8ba3cd 100644
--- a/absl/random/distributions.h
+++ b/absl/random/distributions.h
@@ -437,6 +437,6 @@ IntType Zipf(URBG&& urbg, // NOLINT(runtime/references)
distribution_t, format_t>(&urbg, hi, q, v);
}
-} // namespace absl.
+} // namespace absl
#endif // ABSL_RANDOM_DISTRIBUTIONS_H_
diff --git a/absl/random/internal/seed_material_test.cc b/absl/random/internal/seed_material_test.cc
index 0de6c4c..6db2820 100644
--- a/absl/random/internal/seed_material_test.cc
+++ b/absl/random/internal/seed_material_test.cc
@@ -28,7 +28,8 @@
#define ABSL_EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
EXPECT_DEATH_IF_SUPPORTED(statement, ".*")
#else
-#define ABSL_EXPECT_DEATH_IF_SUPPORTED EXPECT_DEATH_IF_SUPPORTED
+#define ABSL_EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
+ EXPECT_DEATH_IF_SUPPORTED(statement, regex)
#endif
namespace {
diff --git a/absl/random/zipf_distribution.h b/absl/random/zipf_distribution.h
index 1e4dba8..d7b4ac3 100644
--- a/absl/random/zipf_distribution.h
+++ b/absl/random/zipf_distribution.h
@@ -264,6 +264,6 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
-} // namespace absl.
+} // namespace absl
#endif // ABSL_RANDOM_ZIPF_DISTRIBUTION_H_