| 418 | } |
| 419 | |
| 420 | BufferPool::Client::Client(BufferPool* pool, TmpFileGroup* file_group, |
| 421 | const string& name, ReservationTracker* parent_reservation, MemTracker* mem_tracker, |
| 422 | MemLimit mem_limit_mode, int64_t reservation_limit, RuntimeProfile* profile) |
| 423 | : pool_(pool), |
| 424 | file_group_(file_group), |
| 425 | name_(name), |
| 426 | debug_write_delay_ms_(0), |
| 427 | num_pages_(0), |
| 428 | buffers_allocated_bytes_(0) { |
| 429 | // Set up a child profile with buffer pool info. |
| 430 | RuntimeProfile* child_profile = |
| 431 | profile->CreateChild(RuntimeProfile::BUFFER_POOL, true, true, false); |
| 432 | reservation_.InitChildTracker( |
| 433 | child_profile, parent_reservation, mem_tracker, reservation_limit, mem_limit_mode); |
| 434 | counters_.alloc_time = ADD_TIMER(child_profile, "AllocTime"); |
| 435 | counters_.sys_alloc_time = ADD_TIMER(child_profile, "SystemAllocTime"); |
| 436 | counters_.compression_time = ADD_TIMER(child_profile, "CompressionTime"); |
| 437 | counters_.encryption_time = ADD_TIMER(child_profile, "EncryptionTime"); |
| 438 | counters_.cumulative_allocations = |
| 439 | ADD_COUNTER(child_profile, "CumulativeAllocations", TUnit::UNIT); |
| 440 | counters_.cumulative_bytes_alloced = |
| 441 | ADD_COUNTER(child_profile, "CumulativeAllocationBytes", TUnit::BYTES); |
| 442 | counters_.read_wait_time = ADD_TIMER(child_profile, "ReadIoWaitTime"); |
| 443 | counters_.read_io_ops = ADD_COUNTER(child_profile, "ReadIoOps", TUnit::UNIT); |
| 444 | counters_.bytes_read = ADD_COUNTER(child_profile, "ReadIoBytes", TUnit::BYTES); |
| 445 | counters_.write_wait_time = ADD_TIMER(child_profile, "WriteIoWaitTime"); |
| 446 | counters_.write_io_ops = ADD_COUNTER(child_profile, "WriteIoOps", TUnit::UNIT); |
| 447 | counters_.bytes_written = ADD_COUNTER(child_profile, "WriteIoBytes", TUnit::BYTES); |
| 448 | counters_.peak_unpinned_bytes = |
| 449 | child_profile->AddHighWaterMarkCounter("PeakUnpinnedBytes", TUnit::BYTES); |
| 450 | } |
| 451 | |
| 452 | BufferPool::Page* BufferPool::Client::CreatePinnedPage(BufferHandle&& buffer) { |
| 453 | Page* page = new Page(this, buffer.len()); |