MCPcopy Create free account
hub / github.com/apache/impala / AllocateBuffers

Method AllocateBuffers

be/src/runtime/bufferpool/buffer-pool-test.cc:225–237  ·  view source on GitHub ↗

Allocate buffers of varying sizes at most 'max_buffer_size' that add up to 'total_bytes'. Both numbers must be a multiple of the minimum buffer size. If 'randomize_core' is true, will switch thread between cores randomly before each allocation.

Source from the content-addressed store, hash-verified

223 /// If 'randomize_core' is true, will switch thread between cores randomly before
224 /// each allocation.
225 void AllocateBuffers(BufferPool* pool, BufferPool::ClientHandle* client,
226 int64_t max_buffer_size, int64_t total_bytes,
227 vector<BufferPool::BufferHandle>* buffers, bool randomize_core = false) {
228 int64_t curr_buffer_size = max_buffer_size;
229 int64_t bytes_remaining = total_bytes;
230 while (bytes_remaining > 0) {
231 while (curr_buffer_size > client->GetUnusedReservation()) curr_buffer_size /= 2;
232 if (randomize_core) CpuTestUtil::PinToRandomCore(&rng_);
233 buffers->emplace_back();
234 ASSERT_OK(pool->AllocateBuffer(client, curr_buffer_size, &buffers->back()));
235 bytes_remaining -= curr_buffer_size;
236 }
237 }
238
239 /// Do a temporary test allocation. Return the status of AllocateBuffer().
240 Status AllocateAndFree(BufferPool* pool, ClientHandle* client, int64_t len) {

Callers

nothing calls this directly

Calls 2

GetUnusedReservationMethod · 0.45
AllocateBufferMethod · 0.45

Tested by

no test coverage detected