]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/sdk/test/common/random_benchmark.cc
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
4 #include "src/common/random.h"
9 #include <benchmark/benchmark.h>
13 using opentelemetry::sdk::common::Random
;
15 void BM_RandomIdGeneration(benchmark::State
&state
)
17 while (state
.KeepRunning())
19 benchmark::DoNotOptimize(Random::GenerateRandom64());
22 BENCHMARK(BM_RandomIdGeneration
);
24 void BM_RandomIdStdGeneration(benchmark::State
&state
)
26 std::mt19937_64 generator
{0};
27 while (state
.KeepRunning())
29 benchmark::DoNotOptimize(generator());
32 BENCHMARK(BM_RandomIdStdGeneration
);