-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.cc
61 lines (50 loc) · 1.52 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
#include <benchmark/benchmark.h>
#include "quicksort.h"
// static void BM_quicksort_naive(benchmark::State &state) {
// int a[] = {1,2,3,10, 3, 6, 5, 3, 1, 0, 9, 8, 7};
// for (auto _ : state) {
// quicksort_naive(a, 0, 12);
// }
// }
// BENCHMARK(BM_quicksort_naive)->Unit(benchmark::kMillisecond);
// BENCHMARK_MAIN();
// template <class Q> void BM_Sequential(benchmark::State& state) {
// Q q;
// typename Q::value_type v;
// for (auto _ : state) {
// for (int i = state.range(0); i--; )
// q.push(v);
// for (int e = state.range(0); e--; )
// q.Wait(&v);
// }
// // actually messages, not bytes:
// state.SetBytesProcessed(
// static_cast<int64_t>(state.iterations())*state.range(0));
// }
// template <class T, class function> void BM_sort(benchmark::State& state) {
// Q q;
// typename Q::value_type v;
// for (auto _ : state) {
// for (int i = state.range(0); i--; )
// q.push(v);
// for (int e = state.range(0); e--; )
// q.Wait(&v);
// }
// // actually messages, not bytes:
// state.SetBytesProcessed(
// static_cast<int64_t>(state.iterations())*state.range(0));
// }
/*
Template:
- Dtype
- Array Size
- Uni | O | RO | LO | PU
- function
*/
auto BM_test = [](benchmark::State& st, auto Inputs) { /* ... */ };
int main(int argc, char** argv) {
// for (auto& test_input : { /* ... */ })
// benchmark::RegisterBenchmark(test_input.name(), BM_test, test_input);
// benchmark::Initialize(&argc, argv);
// benchmark::RunSpecifiedBenchmarks();
}