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

Method CreatePages

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

Create pages of varying sizes at most 'max_page_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

249 /// If 'randomize_core' is true, will switch thread between cores randomly before
250 /// each allocation.
251 void CreatePages(BufferPool* pool, BufferPool::ClientHandle* client,
252 int64_t max_page_size, int64_t total_bytes, vector<BufferPool::PageHandle>* pages,
253 bool randomize_core = false) {
254 ASSERT_GE(client->GetUnusedReservation(), total_bytes);
255 int64_t curr_page_size = max_page_size;
256 int64_t bytes_remaining = total_bytes;
257 while (bytes_remaining > 0) {
258 while (curr_page_size > client->GetUnusedReservation()) curr_page_size /= 2;
259 pages->emplace_back();
260 if (randomize_core) CpuTestUtil::PinToRandomCore(&rng_);
261 ASSERT_OK(pool->CreatePage(client, curr_page_size, &pages->back()));
262 bytes_remaining -= curr_page_size;
263 }
264 }
265
266 /// Free all the 'buffers' and clear the vector.
267 /// If 'randomize_core' is true, will switch thread between cores randomly before

Callers

nothing calls this directly

Calls 2

CreatePageMethod · 0.80
GetUnusedReservationMethod · 0.45

Tested by

no test coverage detected