Skip to content

Commit 38173d5

Browse files
committed
Fix issues in benchmarks
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 40d919c commit 38173d5

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

benchmark/multithread.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ static void mt_alloc_free(poolCreateExtParams params,
6565
auto values = umf_bench::measure<std::chrono::milliseconds>(
6666
bench.n_repeats, bench.n_threads,
6767
[&, pool = pool.get()](auto thread_id) {
68-
for (int i = 0; i < bench.n_iterations; i++) {
68+
for (int i = 0; i < (int)bench.n_iterations; i++) {
6969
allocs[thread_id].push_back(
7070
umfPoolMalloc(pool, bench.alloc_size));
7171
if (!allocs[thread_id].back()) {
7272
numFailures[thread_id]++;
7373
}
7474
}
7575

76-
for (int i = 0; i < bench.n_iterations; i++) {
76+
for (int i = 0; i < (int)bench.n_iterations; i++) {
7777
umfPoolFree(pool, allocs[thread_id][i]);
7878
}
7979

@@ -131,5 +131,8 @@ int main() {
131131
std::cout << "skipping disjoint_pool mt_alloc_free" << std::endl;
132132
#endif
133133

134+
// ctest looks for "PASSED" in the output
135+
std::cout << "PASSED" << std::endl;
136+
134137
return 0;
135138
}

benchmark/ubench.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,16 @@ static alloc_t *alloc_array(size_t iters) {
8181
////////////////// GLIBC
8282

8383
static void *glibc_malloc(void *provider, size_t size, size_t alignment) {
84+
(void)provider; // unused
85+
(void)alignment; // unused
8486
return malloc(size);
8587
}
8688

87-
static void glibc_free(void *provider, void *ptr, size_t size) { free(ptr); }
89+
static void glibc_free(void *provider, void *ptr, size_t size) {
90+
(void)provider; // unused
91+
(void)size; // unused
92+
free(ptr);
93+
}
8894

8995
UBENCH_EX(simple, glibc_malloc) {
9096
alloc_t *array = alloc_array(N_ITERATIONS);
@@ -162,11 +168,13 @@ UBENCH_EX(simple, os_memory_provider) {
162168
}
163169

164170
static void *w_umfPoolMalloc(void *provider, size_t size, size_t alignment) {
171+
(void)alignment; // unused
165172
umf_memory_pool_handle_t hPool = (umf_memory_pool_handle_t)provider;
166173
return umfPoolMalloc(hPool, size);
167174
}
168175

169176
static void w_umfPoolFree(void *provider, void *ptr, size_t size) {
177+
(void)size; // unused
170178
enum umf_result_t umf_result;
171179
umf_memory_pool_handle_t hPool = (umf_memory_pool_handle_t)provider;
172180
umf_result = umfPoolFree(hPool, ptr);
@@ -330,4 +338,4 @@ UBENCH_EX(simple, scalable_pool_with_os_memory_provider) {
330338
}
331339
#endif /* (defined UMF_BUILD_LIBUMF_POOL_SCALABLE) && (defined UMF_BUILD_OS_MEMORY_PROVIDER) */
332340

333-
UBENCH_MAIN();
341+
UBENCH_MAIN()

0 commit comments

Comments
 (0)