gem5  v21.2.0.0
Classes | Public Member Functions | Private Attributes | List of all members
gem5::statistics::AvgStor Class Reference

Templatized storage and interface to a per-tick average stat. More...

#include <storage.hh>

Classes

struct  Params
 

Public Member Functions

 AvgStor (const StorageParams *const storage_params)
 Build and initializes this stat storage. More...
 
void set (Counter val)
 Set the current count to the one provided, update the total and last set values. More...
 
void inc (Counter val)
 Increment the current count by the provided value, calls set. More...
 
void dec (Counter val)
 Deccrement the current count by the provided value, calls set. More...
 
Counter value () const
 Return the current count. More...
 
Result result () const
 Return the current average. More...
 
bool zero () const
 
void prepare (const StorageParams *const storage_params)
 Prepare stat data for dumping or serialization. More...
 
void reset (const StorageParams *const storage_params)
 Reset stat value to default. More...
 

Private Attributes

Counter current
 The current count. More...
 
Tick lastReset
 The tick of the last reset. More...
 
Result total
 The total count for all tick. More...
 
Tick last
 The tick that current last changed. More...
 

Detailed Description

Templatized storage and interface to a per-tick average stat.

This keeps a current count and updates a total (count * ticks) when this count changes. This allows the quick calculation of a per tick count of the item being watched. This is good for keeping track of residencies in structures among other things.

Definition at line 127 of file storage.hh.

Constructor & Destructor Documentation

◆ AvgStor()

gem5::statistics::AvgStor::AvgStor ( const StorageParams *const  storage_params)
inline

Build and initializes this stat storage.

Definition at line 145 of file storage.hh.

Member Function Documentation

◆ dec()

void gem5::statistics::AvgStor::dec ( Counter  val)
inline

Deccrement the current count by the provided value, calls set.

Parameters
valThe amount to decrement.

Definition at line 172 of file storage.hh.

References current, set(), and gem5::X86ISA::val.

Referenced by TEST().

◆ inc()

void gem5::statistics::AvgStor::inc ( Counter  val)
inline

Increment the current count by the provided value, calls set.

Parameters
valThe amount to increment.

Definition at line 166 of file storage.hh.

References current, set(), and gem5::X86ISA::val.

Referenced by TEST().

◆ prepare()

void gem5::statistics::AvgStor::prepare ( const StorageParams *const  storage_params)
inline

Prepare stat data for dumping or serialization.

Definition at line 200 of file storage.hh.

References current, gem5::curTick(), last, and total.

Referenced by TEST().

◆ reset()

void gem5::statistics::AvgStor::reset ( const StorageParams *const  storage_params)
inline

Reset stat value to default.

Definition at line 210 of file storage.hh.

References gem5::curTick(), last, lastReset, and total.

Referenced by TEST().

◆ result()

Result gem5::statistics::AvgStor::result ( ) const
inline

Return the current average.

Returns
The current average.

Definition at line 185 of file storage.hh.

References current, gem5::curTick(), last, lastReset, and total.

Referenced by TEST().

◆ set()

void gem5::statistics::AvgStor::set ( Counter  val)
inline

Set the current count to the one provided, update the total and last set values.

Parameters
valThe new count.

Definition at line 155 of file storage.hh.

References current, gem5::curTick(), last, total, and gem5::X86ISA::val.

Referenced by dec(), inc(), and TEST().

◆ value()

Counter gem5::statistics::AvgStor::value ( ) const
inline

Return the current count.

Returns
The current count.

Definition at line 178 of file storage.hh.

References current.

Referenced by TEST().

◆ zero()

bool gem5::statistics::AvgStor::zero ( ) const
inline
Returns
true if zero value

Definition at line 194 of file storage.hh.

References total.

Referenced by TEST().

Member Data Documentation

◆ current

Counter gem5::statistics::AvgStor::current
private

The current count.

Definition at line 131 of file storage.hh.

Referenced by dec(), inc(), prepare(), result(), set(), and value().

◆ last

Tick gem5::statistics::AvgStor::last
mutableprivate

The tick that current last changed.

Definition at line 137 of file storage.hh.

Referenced by prepare(), reset(), result(), and set().

◆ lastReset

Tick gem5::statistics::AvgStor::lastReset
private

The tick of the last reset.

Definition at line 133 of file storage.hh.

Referenced by reset(), and result().

◆ total

Result gem5::statistics::AvgStor::total
mutableprivate

The total count for all tick.

Definition at line 135 of file storage.hh.

Referenced by prepare(), reset(), result(), set(), and zero().


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

Generated on Tue Dec 21 2021 11:36:25 for gem5 by doxygen 1.8.17