本文整理汇总了C++中Address::getSet方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::getSet方法的具体用法?C++ Address::getSet怎么用?C++ Address::getSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::getSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateCache
/**
* Updates cache appropriately when an access to 'address' occurs.
* Updates Hit count, Miss count, Cold Miss count appropriately.
*/
void Cache::updateCache (Address address) {
if (addressLog.find(make_pair(address.getSet(), address.getIndex()))
== addressLog.end()) {
addressLog.insert(make_pair(address.getSet(), address.getIndex()));
numColdMiss++;
}
bool status = cache[address.getSet()].updateLRUQueue(address);
if (status)
numHits++;
else
numMisses++;
}
示例2: updateLRUQueue
/**
* Updates queue of addresses appropriately according to
* LRU Replacement policy.
* Return true if a Hit occurs, otherwise returns false.
*/
bool LRUQueue::updateLRUQueue (Address address) {
if (lruQueue.size() == 0) {
lruQueue.push_back(address);
return false;
}
list<Address>::iterator iterator;
for (iterator = lruQueue.begin(); iterator != lruQueue.end();
iterator++) {
if (iterator->getSet() == address.getSet() &&
iterator->getIndex() == address.getIndex()) {
lruQueue.push_back(address);
lruQueue.erase(iterator);
return true;
}
}
if (lruQueue.size() == ways) {
lruQueue.pop_front();
}
lruQueue.push_back(address);
return false;
}