Skip to content

Commit

Permalink
apacheGH-35458: [C++][Benchmarking] Require Google Benchmark 1.6.1 or…
Browse files Browse the repository at this point in the history
… later

Google Benchmark 1.6.1 added `benchmark::MemoryManager::Stop(Result&)`
and deprecated `benchmark::MemoryManager::Stop(Result*)`.

Google Benchmark 1.8.0 dropped deprecated
`benchmark::MemoryManager::Stop(Result*)`.

We can always use `benchmark::MemoryManager::Stop(Result&)` by
requiring Google Benchmark 1.6.1 or later.
  • Loading branch information
kou committed May 6, 2023
1 parent febd0ff commit 3620b34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ macro(build_benchmark)
endmacro()

if(ARROW_BUILD_BENCHMARKS)
set(BENCHMARK_REQUIRED_VERSION 1.6.0)
set(BENCHMARK_REQUIRED_VERSION 1.6.1)
resolve_dependency(benchmark
REQUIRED_VERSION
${BENCHMARK_REQUIRED_VERSION}
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/util/benchmark_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class MemoryPoolMemoryManager : public benchmark::MemoryManager {
global_allocations_start = default_pool->num_allocations();
}

void Stop(benchmark::MemoryManager::Result* result) override {
void Stop(benchmark::MemoryManager::Result& result) override {
// If num_allocations is still zero, we assume that the memory pool wasn't passed down
// so we should record them.
MemoryPool* default_pool = default_memory_pool();
Expand All @@ -166,9 +166,9 @@ class MemoryPoolMemoryManager : public benchmark::MemoryManager {
<< " allocations.\n";
}

result->max_bytes_used = memory_pool->max_memory();
result->total_allocated_bytes = memory_pool->total_bytes_allocated();
result->num_allocs = memory_pool->num_allocations();
result.max_bytes_used = memory_pool->max_memory();
result.total_allocated_bytes = memory_pool->total_bytes_allocated();
result.num_allocs = memory_pool->num_allocations();
}
}

Expand Down

0 comments on commit 3620b34

Please sign in to comment.