gem5  v20.1.0.0
Classes | Public Member Functions | Private Attributes | List of all members
Stats::AvgStor Class Reference

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

#include <statistics.hh>

Classes

struct  Params
 

Public Member Functions

 AvgStor (Info *info)
 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 (Info *info)
 Prepare stat data for dumping or serialization. More...
 
void reset (Info *info)
 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 554 of file statistics.hh.

Constructor & Destructor Documentation

◆ AvgStor()

Stats::AvgStor::AvgStor ( Info info)
inline

Build and initializes this stat storage.

Definition at line 573 of file statistics.hh.

Member Function Documentation

◆ dec()

void Stats::AvgStor::dec ( Counter  val)
inline

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

Parameters
valThe amount to decrement.

Definition at line 600 of file statistics.hh.

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

◆ inc()

void Stats::AvgStor::inc ( Counter  val)
inline

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

Parameters
valThe amount to increment.

Definition at line 594 of file statistics.hh.

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

◆ prepare()

void Stats::AvgStor::prepare ( Info info)
inline

Prepare stat data for dumping or serialization.

Definition at line 628 of file statistics.hh.

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

◆ reset()

void Stats::AvgStor::reset ( Info info)
inline

Reset stat value to default.

Definition at line 638 of file statistics.hh.

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

◆ result()

Result Stats::AvgStor::result ( ) const
inline

Return the current average.

Returns
The current average.

Definition at line 613 of file statistics.hh.

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

◆ set()

void Stats::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 583 of file statistics.hh.

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

Referenced by dec(), and inc().

◆ value()

Counter Stats::AvgStor::value ( ) const
inline

Return the current count.

Returns
The current count.

Definition at line 606 of file statistics.hh.

References current.

◆ zero()

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

Definition at line 622 of file statistics.hh.

References total.

Member Data Documentation

◆ current

Counter Stats::AvgStor::current
private

The current count.

Definition at line 558 of file statistics.hh.

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

◆ last

Tick Stats::AvgStor::last
mutableprivate

The tick that current last changed.

Definition at line 564 of file statistics.hh.

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

◆ lastReset

Tick Stats::AvgStor::lastReset
private

The tick of the last reset.

Definition at line 560 of file statistics.hh.

Referenced by reset(), and result().

◆ total

Result Stats::AvgStor::total
mutableprivate

The total count for all tick.

Definition at line 562 of file statistics.hh.

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


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

Generated on Wed Sep 30 2020 14:03:12 for gem5 by doxygen 1.8.17