MCPcopy Create free account
hub / github.com/apache/arrow / AllocateTouchDeallocate

Function AllocateTouchDeallocate

cpp/src/arrow/memory_pool_benchmark.cc:103–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101// Benchmark the cost of allocating memory plus accessing it.
102template <typename Alloc>
103static 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) \

Callers

nothing calls this directly

Calls 3

TouchCacheLinesFunction · 0.85
AllocateMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected