| 28 | } |
| 29 | |
| 30 | bool MigrationController::ExtractNVMPage(NVMPageStats& stats, |
| 31 | Profiler& profiler) { |
| 32 | if (nvm_heap_.empty()) { |
| 33 | for (unordered_map<uint64_t, NVMPage>::iterator it = nvm_pages_.begin(); |
| 34 | it != nvm_pages_.end(); ++it) { |
| 35 | double dr = it->second.blocks.size() / page_blocks_; |
| 36 | double wr = it->second.epoch_writes / page_blocks_; |
| 37 | nvm_heap_.push_back({it->first, dr, wr}); |
| 38 | |
| 39 | total_nvm_writes_ += it->second.epoch_writes; |
| 40 | dirty_nvm_blocks_ += it->second.blocks.size(); |
| 41 | } |
| 42 | make_heap(nvm_heap_.begin(), nvm_heap_.end()); |
| 43 | } |
| 44 | profiler.AddTableOp(); |
| 45 | |
| 46 | if (nvm_heap_.empty()) return false; |
| 47 | |
| 48 | stats = nvm_heap_.front(); |
| 49 | pop_heap(nvm_heap_.begin(), nvm_heap_.end()); |
| 50 | nvm_heap_.pop_back(); |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | bool MigrationController::ExtractDRAMPage(DRAMPageStats& stats, |
| 55 | Profiler& profiler) { |