diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/jaegertracing/opentelemetry-cpp/sdk/test/common/attributemap_hash_benchmark.cc | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/jaegertracing/opentelemetry-cpp/sdk/test/common/attributemap_hash_benchmark.cc')
-rw-r--r-- | src/jaegertracing/opentelemetry-cpp/sdk/test/common/attributemap_hash_benchmark.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/jaegertracing/opentelemetry-cpp/sdk/test/common/attributemap_hash_benchmark.cc b/src/jaegertracing/opentelemetry-cpp/sdk/test/common/attributemap_hash_benchmark.cc new file mode 100644 index 000000000..811ecb23d --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/sdk/test/common/attributemap_hash_benchmark.cc @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include <benchmark/benchmark.h> +#include "opentelemetry/sdk/common/attributemap_hash.h" + +using namespace opentelemetry::sdk::common; +namespace +{ +void BM_AttributeMapHash(benchmark::State &state) +{ + OrderedAttributeMap map1 = {{"k1", "v1"}, {"k2", "v2"}, {"k3", "v3"}, {"k4", "v4"}, + {"k5", true}, {"k6", 12}, {"k7", 12.209}}; + while (state.KeepRunning()) + { + benchmark::DoNotOptimize(GetHashForAttributeMap(map1)); + } +} +BENCHMARK(BM_AttributeMapHash); + +} // namespace +BENCHMARK_MAIN(); |