-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
49 lines (37 loc) · 1.35 KB
/
main.cpp
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
#include "SudokuGenerator.hpp"
#include "benchmark/benchmark.h"
//average speed of generate a sudoku
void BM_generate_1_sudoku(benchmark::State& state) {
while (state.KeepRunning())
{
Sudoku sudoku;
sudoku.initialize();
}
}
BENCHMARK(BM_generate_1_sudoku)->Iterations(20);
void BM_generate_1_sudoku_and_get_flatten_board(benchmark::State& state) {
while (state.KeepRunning())
{
Sudoku sudoku;
sudoku.initialize();
sudoku.getFlattenBoard();
}
}
BENCHMARK(BM_generate_1_sudoku_and_get_flatten_board)->Iterations(20);
void BM_single_thread_sudoku_generator(benchmark::State& state) {
for (auto _ : state) single_thread_sudoku_generator();
}
BENCHMARK(BM_single_thread_sudoku_generator);
void BM_multi_thread_sudoku_generator_using_ATOMIC(benchmark::State& state) {
for (auto _ : state) multi_thread_sudoku_generator_using_ATOMIC();
}
BENCHMARK(BM_multi_thread_sudoku_generator_using_ATOMIC);
void BM_multi_thread_sudoku_generator_using_MUTEX(benchmark::State& state) {
for (auto _ : state) multi_thread_sudoku_generator_using_MUTEX();
}
BENCHMARK(BM_multi_thread_sudoku_generator_using_MUTEX);
void BM_multi_thread_sudoku_generator_using_INT(benchmark::State& state) {
for (auto _ : state) multi_thread_sudoku_generator_using_INT();
}
BENCHMARK(BM_multi_thread_sudoku_generator_using_INT);
BENCHMARK_MAIN();