-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmicro_benchmark_mutex.cpp
More file actions
53 lines (39 loc) · 1.42 KB
/
micro_benchmark_mutex.cpp
File metadata and controls
53 lines (39 loc) · 1.42 KB
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
// Copyright 2019-2025 UnoDB contributors
// Should be the first include
#include "global.hpp" // IWYU pragma: keep
#include <thread>
#include <benchmark/benchmark.h>
#include "micro_benchmark_concurrency.hpp"
#include "micro_benchmark_utils.hpp"
namespace {
class [[nodiscard]] concurrent_benchmark_mutex final
: public unodb::benchmark::concurrent_benchmark<unodb::benchmark::mutex_db,
std::thread> {};
concurrent_benchmark_mutex benchmark_fixture;
void parallel_get(benchmark::State& state) {
benchmark_fixture.parallel_get(state);
}
void parallel_insert_disjoint_ranges(benchmark::State& state) {
benchmark_fixture.parallel_insert_disjoint_ranges(state);
}
void parallel_delete_disjoint_ranges(benchmark::State& state) {
benchmark_fixture.parallel_delete_disjoint_ranges(state);
}
} // namespace
UNODB_START_BENCHMARKS()
BENCHMARK(parallel_get)
->Apply(unodb::benchmark::concurrency_ranges16)
->Unit(benchmark::kMillisecond)
->MeasureProcessCPUTime()
->UseRealTime();
BENCHMARK(parallel_insert_disjoint_ranges)
->Apply(unodb::benchmark::concurrency_ranges32)
->Unit(benchmark::kMillisecond)
->MeasureProcessCPUTime()
->UseRealTime();
BENCHMARK(parallel_delete_disjoint_ranges)
->Apply(unodb::benchmark::concurrency_ranges32)
->Unit(benchmark::kMillisecond)
->MeasureProcessCPUTime()
->UseRealTime();
UNODB_BENCHMARK_MAIN();