summaryrefslogtreecommitdiff
path: root/source/test/unittests/foo.bench.c
blob: a3d5c188729ce7a21ed8bef3d26ac1d426be37c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#define KIT_BENCH_FILE foo
#include "../../kit_test/bench.h"

struct test_foo_ {
  double f;
};

BENCHMARK("foo") {
  BENCHMARK_BEGIN;
  {
    int              x = 0;
    struct test_foo_ f = { 0. };

    for (int i = 0; i < 100000; i++) {
      x += (1 << 1);
      x ^= i;
      f.f += 0.1;
    }
    DO_NOT_OPTIMIZE(x);
    DO_NOT_OPTIMIZE(f);
  }
  BENCHMARK_END;
}

BENCHMARK("bar") { }