| 6 | using namespace std; |
| 7 | |
| 8 | void MigrationController::InputBlocks( |
| 9 | const vector<ATTEntry>& blocks) { |
| 10 | assert(nvm_pages_.empty()); |
| 11 | for (vector<ATTEntry>::const_iterator it = blocks.begin(); |
| 12 | it != blocks.end(); ++it) { |
| 13 | if (it->state == ATTEntry::CLEAN || it->state == ATTEntry::FREE) { |
| 14 | assert(it->epoch_writes == 0); |
| 15 | continue; |
| 16 | } |
| 17 | uint64_t block_addr = it->phy_tag << block_bits_; |
| 18 | NVMPage& p = nvm_pages_[PageAlign(block_addr)]; |
| 19 | p.epoch_reads += it->epoch_reads; |
| 20 | p.epoch_writes += it->epoch_writes; |
| 21 | |
| 22 | if (it->epoch_writes) { |
| 23 | p.blocks.insert(block_addr); |
| 24 | assert(p.blocks.size() <= page_blocks_); |
| 25 | } |
| 26 | } |
| 27 | dirty_nvm_pages_ += nvm_pages_.size(); |
| 28 | } |
| 29 | |
| 30 | bool MigrationController::ExtractNVMPage(NVMPageStats& stats, |
| 31 | Profiler& profiler) { |