Skip to content

Commit 1c9c7a1

Browse files
authored
Merge pull request #1140 from lplewa/single_thread
explicitly declare single threaded benchmark
2 parents 113f3e0 + 258c6f2 commit 1c9c7a1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

benchmark/benchmark.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ static void multithreaded(benchmark::internal::Benchmark *benchmark) {
3535
benchmark->Threads(1);
3636
}
3737

38+
static void singlethreaded(benchmark::internal::Benchmark *benchmark) {
39+
benchmark->Threads(1);
40+
}
41+
3842
static void
3943
default_multiple_alloc_fix_size(benchmark::internal::Benchmark *benchmark) {
4044
benchmark->Args({10000, 1, 4096});
@@ -68,15 +72,17 @@ UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark, proxy_pool,
6872
UMF_BENCHMARK_REGISTER_F(multiple_malloc_free_benchmark, proxy_pool)
6973
->Apply(&default_multiple_alloc_fix_size)
7074
// reduce iterations, as this benchmark is slower than others
71-
->Iterations(50000);
75+
->Iterations(50000)
76+
->Apply(&singlethreaded);
7277

7378
UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark, os_provider,
7479
fixed_alloc_size,
7580
provider_allocator<os_provider>);
7681
UMF_BENCHMARK_REGISTER_F(multiple_malloc_free_benchmark, os_provider)
7782
->Apply(&default_multiple_alloc_fix_size)
7883
// reduce iterations, as this benchmark is slower than others
79-
->Iterations(50000);
84+
->Iterations(50000)
85+
->Apply(&singlethreaded);
8086

8187
UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark, disjoint_pool_fix,
8288
fixed_alloc_size,
@@ -89,8 +95,9 @@ UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark,
8995
disjoint_pool_uniform, uniform_alloc_size,
9096
pool_allocator<disjoint_pool<os_provider>>);
9197
UMF_BENCHMARK_REGISTER_F(multiple_malloc_free_benchmark, disjoint_pool_uniform)
92-
->Apply(&default_multiple_alloc_uniform_size);
93-
// TODO: enable
98+
->Apply(&default_multiple_alloc_uniform_size)
99+
->Apply(&singlethreaded);
100+
// TODO: change to multithreaded
94101
//->Apply(&multithreaded);
95102

96103
#ifdef UMF_POOL_JEMALLOC_ENABLED

0 commit comments

Comments
 (0)