gem5  v20.1.0.0
Public Member Functions | Protected Attributes | Private Attributes | List of all members
FALRU::CacheTracking Class Reference

Mechanism that allows us to simultaneously collect miss statistics for multiple caches. More...

Public Member Functions

 CacheTracking (unsigned min_size, unsigned max_size, unsigned block_size)
 
void init (FALRUBlk *head, FALRUBlk *tail)
 Initialiaze cache blocks and the tracking mechanism. More...
 
void moveBlockToHead (FALRUBlk *blk)
 Update boundaries as a block will be moved to the MRU. More...
 
void moveBlockToTail (FALRUBlk *blk)
 Update boundaries as a block will be moved to the LRU. More...
 
void recordAccess (FALRUBlk *blk)
 Notify of a block access. More...
 
void check (const FALRUBlk *head, const FALRUBlk *tail) const
 Check that the tracking mechanism is in consistent state. More...
 
void regStats (std::string name)
 Register the stats for this object. More...
 

Protected Attributes

Stats::Vector hits
 Hits in each cache. More...
 
Stats::Vector misses
 Misses in each cache. More...
 
Stats::Scalar accesses
 Total number of accesses. More...
 

Private Attributes

const unsigned blkSize
 The size of the cache block. More...
 
const unsigned minTrackedSize
 The smallest cache we are tracking. More...
 
const int numTrackedCaches
 The number of different size caches being tracked. More...
 
const CachesMask inAllCachesMask
 A mask for all cache being tracked. More...
 
std::vector< FALRUBlk * > boundaries
 Array of pointers to blocks at the cache boundaries. More...
 

Detailed Description

Mechanism that allows us to simultaneously collect miss statistics for multiple caches.

Currently, we keep track of caches from a set minimum size of interest up to the actual cache size.

Definition at line 279 of file fa_lru.hh.

Constructor & Destructor Documentation

◆ CacheTracking()

FALRU::CacheTracking::CacheTracking ( unsigned  min_size,
unsigned  max_size,
unsigned  block_size 
)
inline

Definition at line 282 of file fa_lru.hh.

References fatal_if, and numTrackedCaches.

Member Function Documentation

◆ check()

void FALRU::CacheTracking::check ( const FALRUBlk head,
const FALRUBlk tail 
) const

Check that the tracking mechanism is in consistent state.

Iterate from the head (MRU) to the tail (LRU) of the list of blocks and assert the inCachesMask and the boundaries are in consistent state.

Parameters
headthe MRU block of the actual cache
headthe LRU block of the actual cache

Definition at line 289 of file fa_lru.cc.

References blkSize, boundaries, FALRU::head, inAllCachesMask, FALRUBlk::inCachesMask, ArmISA::j, minTrackedSize, FALRUBlk::next, panic_if, and FALRU::tail.

Referenced by FALRU::moveToHead(), and FALRU::moveToTail().

◆ init()

void FALRU::CacheTracking::init ( FALRUBlk head,
FALRUBlk tail 
)

Initialiaze cache blocks and the tracking mechanism.

All blocks in the cache need to be initialized once.

Parameters
blkthe MRU block
blkthe LRU block

Definition at line 317 of file fa_lru.cc.

References BaseTags::blkSize, FALRU::head, FALRUBlk::inCachesMask, ArmISA::j, FALRUBlk::next, and FALRU::tail.

Referenced by FALRU::tagsInit().

◆ moveBlockToHead()

void FALRU::CacheTracking::moveBlockToHead ( FALRUBlk blk)

Update boundaries as a block will be moved to the MRU.

For all caches that didn't fit the block before moving it, we move their boundaries one block closer to the MRU. We also update InCacheMasks as neccessary.

Parameters
blkthe block that will be moved to the head

Definition at line 344 of file fa_lru.cc.

References ArmISA::i, FALRUBlk::inCachesMask, and FALRUBlk::prev.

Referenced by FALRU::moveToHead().

◆ moveBlockToTail()

void FALRU::CacheTracking::moveBlockToTail ( FALRUBlk blk)

Update boundaries as a block will be moved to the LRU.

For all caches that fitted the block before moving it, we move their boundaries one block closer to the LRU. We also update InCacheMasks as neccessary.

Parameters
blkthe block that will be moved to the head

Definition at line 370 of file fa_lru.cc.

References ArmISA::i, FALRUBlk::inCachesMask, and FALRUBlk::next.

Referenced by FALRU::moveToTail().

◆ recordAccess()

void FALRU::CacheTracking::recordAccess ( FALRUBlk blk)

Notify of a block access.

This should be called every time a block is accessed and it updates statistics. If the input block is nullptr then we treat the access as a miss. The block's InCacheMask determines the caches in which the block fits.

Parameters
blkthe block to record the access for

Definition at line 395 of file fa_lru.cc.

References ArmISA::i, FALRUBlk::inCachesMask, and CacheBlk::isValid().

Referenced by FALRU::accessBlock().

◆ regStats()

void FALRU::CacheTracking::regStats ( std::string  name)

Register the stats for this object.

Definition at line 428 of file fa_lru.cc.

References ArmISA::i, SimObject::name(), and printSize().

Referenced by FALRU::regStats().

Member Data Documentation

◆ blkSize

const unsigned FALRU::CacheTracking::blkSize
private

The size of the cache block.

Definition at line 360 of file fa_lru.hh.

Referenced by check().

◆ boundaries

std::vector<FALRUBlk*> FALRU::CacheTracking::boundaries
private

Array of pointers to blocks at the cache boundaries.

Definition at line 368 of file fa_lru.hh.

Referenced by check().

◆ inAllCachesMask

const CachesMask FALRU::CacheTracking::inAllCachesMask
private

A mask for all cache being tracked.

Definition at line 366 of file fa_lru.hh.

Referenced by check().

◆ minTrackedSize

const unsigned FALRU::CacheTracking::minTrackedSize
private

The smallest cache we are tracking.

Definition at line 362 of file fa_lru.hh.

Referenced by check().

◆ numTrackedCaches

const int FALRU::CacheTracking::numTrackedCaches
private

The number of different size caches being tracked.

Definition at line 364 of file fa_lru.hh.

Referenced by CacheTracking().


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:24 for gem5 by doxygen 1.8.17