Project
Loading...
Searching...
No Matches
benchSampaHeader.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <benchmark/benchmark.h>
14
15using namespace o2::mch::raw;
16
17static void BM_ComputeHamming1(benchmark::State& state)
18{
19 for (auto _ : state) {
20 benchmark::DoNotOptimize(computeHammingCode1(0x3722e80103208));
21 }
22}
23
24static void BM_ComputeHamming2(benchmark::State& state)
25{
26 for (auto _ : state) {
27 benchmark::DoNotOptimize(computeHammingCode2(0x3722e80103208));
28 }
29}
30
31static void BM_ComputeHamming3(benchmark::State& state)
32{
33 for (auto _ : state) {
34 benchmark::DoNotOptimize(computeHammingCode3(0x3722e80103208));
35 }
36}
37static void BM_ComputeHamming4(benchmark::State& state)
38{
39 for (auto _ : state) {
40 benchmark::DoNotOptimize(computeHammingCode4(0x3722e80103208));
41 }
42}
43
44static void BM_ComputeHeaderParity1(benchmark::State& state)
45{
46 for (auto _ : state) {
47 benchmark::DoNotOptimize(computeHeaderParity1(0x3722e80103208));
48 }
49}
50
51static void BM_ComputeHeaderParity2(benchmark::State& state)
52{
53 for (auto _ : state) {
54 benchmark::DoNotOptimize(computeHeaderParity2(0x3722e80103208));
55 }
56}
57
58static void BM_ComputeHeaderParity3(benchmark::State& state)
59{
60 for (auto _ : state) {
61 benchmark::DoNotOptimize(computeHeaderParity3(0x3722e80103208));
62 }
63}
64
65static void BM_ComputeHeaderParity4(benchmark::State& state)
66{
67 for (auto _ : state) {
68 benchmark::DoNotOptimize(computeHeaderParity4(0x3722e80103208));
69 }
70}
71
72// Register the function as a benchmark
73BENCHMARK(BM_ComputeHamming1);
74BENCHMARK(BM_ComputeHamming2);
75BENCHMARK(BM_ComputeHamming3);
76BENCHMARK(BM_ComputeHamming4);
77
78BENCHMARK(BM_ComputeHeaderParity1);
79BENCHMARK(BM_ComputeHeaderParity2);
80BENCHMARK(BM_ComputeHeaderParity3);
81BENCHMARK(BM_ComputeHeaderParity4);
82
83// Run the benchmark
benchmark::State & state
BENCHMARK(BM_ComputeHamming1)
BENCHMARK_MAIN()
int computeHammingCode3(uint64_t value)
int computeHeaderParity1(uint64_t value)
int computeHammingCode2(uint64_t value)
int computeHeaderParity4(uint64_t value)
int computeHammingCode1(uint64_t value)
int computeHeaderParity2(uint64_t value)
int computeHeaderParity3(uint64_t value)
int computeHammingCode4(uint64_t value)