File: attributemap_hash_benchmark.cc

package info (click to toggle)
opentelemetry-cpp 1.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,744 kB
  • sloc: cpp: 79,029; sh: 1,640; makefile: 43; python: 31
file content (24 lines) | stat: -rw-r--r-- 661 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <benchmark/benchmark.h>

#include "opentelemetry/sdk/common/attribute_utils.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();