/* *@function: *@param pdpt_entry: */ bool PAEPaging::remove_pdt( entry_list pdpt_entry) { bool succeed = true; for( entry_list_ptr it=pdpt_entry.begin(); it!= pdpt_entry.end();it++ ) { if( remove_pdt(*it)==false) { debug_printf("remove page directory pointed by entry %d of page directory pointer failed", *it); succeed = false; } } return succeed; }
void tx_watch::do_display() { // Sort entries by count. Highest numbers at the top. std::sort(entries_.begin(), entries_.end(), [](const entry_count& entry_a, const entry_count& entry_b) { return entry_a.count > entry_b.count; }); // Display the first 20 entries. for (size_t i = 0; i < 20 && i < entries_.size(); ++i) { const entry_count& entry = entries_[i]; log_info() << entry.tx_hash << " " << entry.count; } }
void tx_watch::do_cleanup() { // Erase entries where timest is older than (now - timeout_) seconds. time_t current_time = time(nullptr); auto erase_pred = [&](const entry_count& entry) { return (current_time - entry.timest) > timeout_; }; auto erase_begin = std::remove_if(entries_.begin(), entries_.end(), erase_pred); // If we have old entries to delete then erase them. if (erase_begin != entries_.end()) entries_.erase(erase_begin); }