| 101 | // Benchmark the cost of allocating memory plus accessing it. |
| 102 | template <typename Alloc> |
| 103 | static void AllocateTouchDeallocate( |
| 104 | benchmark::State& state) { // NOLINT non-const reference |
| 105 | const int64_t nbytes = state.range(0); |
| 106 | MemoryPool* pool = *Alloc::GetAllocator(); |
| 107 | |
| 108 | for (auto _ : state) { |
| 109 | uint8_t* data; |
| 110 | ARROW_CHECK_OK(pool->Allocate(nbytes, &data)); |
| 111 | TouchCacheLines(data, nbytes); |
| 112 | pool->Free(data, nbytes); |
| 113 | } |
| 114 | state.SetItemsProcessed(state.iterations()); |
| 115 | state.SetBytesProcessed(state.iterations() * nbytes); |
| 116 | } |
| 117 | |
| 118 | #define BENCHMARK_ALLOCATE_ARGS \ |
| 119 | ->RangeMultiplier(16) \ |
nothing calls this directly
no test coverage detected