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

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

Inheritance diagram for gem5::FALRU::CacheTracking:
gem5::statistics::Group

Public Member Functions

 CacheTracking (unsigned min_size, unsigned max_size, unsigned block_size, statistics::Group *parent)
 
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...
 
- Public Member Functions inherited from gem5::statistics::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group. More...
 
virtual ~Group ()
 
virtual void regStats ()
 Callback to set stat parameters. More...
 
virtual void resetStats ()
 Callback to reset stats. More...
 
virtual void preDumpStats ()
 Callback before stats are dumped. More...
 
void addStat (statistics::Info *info)
 Register a stat with this group. More...
 
const std::map< std::string, Group * > & getStatGroups () const
 Get all child groups associated with this object. More...
 
const std::vector< Info * > & getStats () const
 Get all stats associated with this object. More...
 
void addStatGroup (const char *name, Group *block)
 Add a stat block as a child of this block. More...
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group. More...
 
void mergeStatGroup (Group *block)
 Merge the contents (stats & children) of a block to this block. More...
 
 Group ()=delete
 
 Group (const Group &)=delete
 
Groupoperator= (const Group &)=delete
 

Protected Attributes

statistics::Vector hits
 Hits in each cache. More...
 
statistics::Vector misses
 Misses in each cache. More...
 
statistics::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 278 of file fa_lru.hh.

Constructor & Destructor Documentation

◆ CacheTracking()

gem5::FALRU::CacheTracking::CacheTracking ( unsigned  min_size,
unsigned  max_size,
unsigned  block_size,
statistics::Group parent 
)

Member Function Documentation

◆ check()

void gem5::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 335 of file fa_lru.cc.

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

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

◆ init()

void gem5::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 363 of file fa_lru.cc.

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

Referenced by gem5::FALRU::tagsInit().

◆ moveBlockToHead()

void gem5::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 390 of file fa_lru.cc.

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

Referenced by gem5::FALRU::moveToHead().

◆ moveBlockToTail()

void gem5::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 416 of file fa_lru.cc.

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

Referenced by gem5::FALRU::moveToTail().

◆ recordAccess()

void gem5::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 441 of file fa_lru.cc.

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

Referenced by gem5::FALRU::accessBlock().

Member Data Documentation

◆ blkSize

const unsigned gem5::FALRU::CacheTracking::blkSize
private

The size of the cache block.

Definition at line 342 of file fa_lru.hh.

◆ boundaries

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

Array of pointers to blocks at the cache boundaries.

Definition at line 350 of file fa_lru.hh.

◆ inAllCachesMask

const CachesMask gem5::FALRU::CacheTracking::inAllCachesMask
private

A mask for all cache being tracked.

Definition at line 348 of file fa_lru.hh.

◆ minTrackedSize

const unsigned gem5::FALRU::CacheTracking::minTrackedSize
private

The smallest cache we are tracking.

Definition at line 344 of file fa_lru.hh.

Referenced by CacheTracking().

◆ numTrackedCaches

const int gem5::FALRU::CacheTracking::numTrackedCaches
private

The number of different size caches being tracked.

Definition at line 346 of file fa_lru.hh.

Referenced by CacheTracking().


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

Generated on Wed Dec 21 2022 10:23:26 for gem5 by doxygen 1.9.1