diff options
author | Lisa Hsu <Lisa.Hsu@amd.com> | 2010-02-23 09:33:18 -0800 |
---|---|---|
committer | Lisa Hsu <Lisa.Hsu@amd.com> | 2010-02-23 09:33:18 -0800 |
commit | be4cf50c5a6a5761f6474fb9f85a9c241101f3ce (patch) | |
tree | d9902a5c9c9ec4f9cf0250c59800211d38faeb0a /src/base | |
parent | 2ad386f104cf84bd8bcb50eef50f04cdbcf9ebf7 (diff) | |
download | gem5-be4cf50c5a6a5761f6474fb9f85a9c241101f3ce.tar.xz |
stats: this makes some fixes to AverageStat and AverageVector.
Also, make Formulas work on AverageVector. First, Stat::Average (and thus
Stats::AverageVector) was broken when coming out of a checkpoint and on resets,
this fixes that. Formulas also didn't work with AverageVector, but added
support for that.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/statistics.hh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 0f001dccb..06a9d465d 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -492,6 +492,8 @@ class AvgStor private: /** The current count. */ Counter current; + /** The tick of the last reset */ + Tick lastReset; /** The total count for all tick. */ mutable Result total; /** The tick that current last changed. */ @@ -505,7 +507,7 @@ class AvgStor * Build and initializes this stat storage. */ AvgStor(Info *info) - : current(0), total(0), last(0) + : current(0), lastReset(0), total(0), last(0) { } /** @@ -547,7 +549,7 @@ class AvgStor result() const { assert(last == curTick); - return (Result)(total + current) / (Result)(curTick + 1); + return (Result)(total + current) / (Result)(curTick - lastReset + 1); } /** @@ -573,6 +575,7 @@ class AvgStor { total = 0.0; last = curTick; + lastReset = curTick; } }; @@ -2551,6 +2554,10 @@ class Temp : node(new VectorStatNode(s.info())) { } + Temp(const AverageVector &s) + : node(new VectorStatNode(s.info())) + { } + /** * */ |