-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.cc
61 lines (46 loc) · 1.1 KB
/
bench.cc
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifdef BENCH
#include <benchmark/benchmark.h>
#include <iostream>
#include <string>
#include "tetravex.hh"
#include "utils.hh"
static void Tetravex_n(benchmark::State& state, int n)
{
std::vector<std::string> file_in = get_file_list(n);
for (auto _ : state)
{
for (auto& file : file_in)
{
Tetravex game(file);
solve(game);
}
}
state.SetItemsProcessed(state.iterations() * file_in.size());
}
static void BM_Tetravex_s2(benchmark::State& state)
{
Tetravex_n(state, 2);
}
static void BM_Tetravex_s3(benchmark::State& state)
{
Tetravex_n(state, 3);
}
static void BM_Tetravex_s4(benchmark::State& state)
{
Tetravex_n(state, 4);
}
static void BM_Tetravex_s5(benchmark::State& state)
{
Tetravex_n(state, 5);
}
static void BM_Tetravex_s6(benchmark::State& state)
{
Tetravex_n(state, 6);
}
BENCHMARK(BM_Tetravex_s2)->Unit(benchmark::kSecond);
BENCHMARK(BM_Tetravex_s3)->Unit(benchmark::kSecond);
BENCHMARK(BM_Tetravex_s4)->Unit(benchmark::kSecond);
BENCHMARK(BM_Tetravex_s5)->Unit(benchmark::kSecond);
BENCHMARK(BM_Tetravex_s6)->Unit(benchmark::kSecond);
BENCHMARK_MAIN();
#endif