]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/sdk/test/common/random_benchmark.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / sdk / test / common / random_benchmark.cc
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 #include "src/common/random.h"
5
6 #include <cstdint>
7 #include <random>
8
9 #include <benchmark/benchmark.h>
10
11 namespace
12 {
13 using opentelemetry::sdk::common::Random;
14
15 void BM_RandomIdGeneration(benchmark::State &state)
16 {
17 while (state.KeepRunning())
18 {
19 benchmark::DoNotOptimize(Random::GenerateRandom64());
20 }
21 }
22 BENCHMARK(BM_RandomIdGeneration);
23
24 void BM_RandomIdStdGeneration(benchmark::State &state)
25 {
26 std::mt19937_64 generator{0};
27 while (state.KeepRunning())
28 {
29 benchmark::DoNotOptimize(generator());
30 }
31 }
32 BENCHMARK(BM_RandomIdStdGeneration);
33
34 } // namespace
35 BENCHMARK_MAIN();