summaryrefslogtreecommitdiff
path: root/base/statistics.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2003-11-05 17:57:41 -0500
committerNathan Binkert <binkertn@umich.edu>2003-11-05 17:57:41 -0500
commit9471a4d20ffa98ae3f83edbe8cad1d282ab328af (patch)
tree08d0bd7401c1994b8688739df8f965b1326a65be /base/statistics.cc
parent74fd8b1ad106c98e08bc433a6cc63a3c6cf564df (diff)
downloadgem5-9471a4d20ffa98ae3f83edbe8cad1d282ab328af.tar.xz
Fix stats reset
make SIGUSR2 dump and reset stats Make resetting time work base/statistics.cc: Fix statistics reset so that it works again, and correctly reset bins as well. (The old code wouldn't reset if you didn't have any bins, and then would actually only reset the first bin) cpu/simple_cpu/simple_cpu.cc: cpu/simple_cpu/simple_cpu.hh: convert idleCycles/idleFraction into a single Average stat to make reset work more simply sim/main.cc: handle SIGUSR2 to dump and reset stats (SIGUSR1 only dumps them) sim/sim_time.cc: sim/sim_time.hh: Add support for resetting the time --HG-- extra : convert_revision : ea43e03c50c0a4bb826dc0842a8c4fa1a9289e0a
Diffstat (limited to 'base/statistics.cc')
-rw-r--r--base/statistics.cc34
1 files changed, 20 insertions, 14 deletions
diff --git a/base/statistics.cc b/base/statistics.cc
index 5f21e4de7..1ffbeb690 100644
--- a/base/statistics.cc
+++ b/base/statistics.cc
@@ -265,19 +265,27 @@ Database::check()
void
Database::reset()
{
- list<GenBin *>::iterator bi = bins.begin();
- list<GenBin *>::iterator be = bins.end();
list_t::iterator i = allStats.begin();
list_t::iterator end = allStats.end();
-
- while (bi != be) {
- (*bi)->activate();
-
- while (i != end) {
- (*i)->reset();
+ while (i != end) {
+ Stat *stat = *i;
+ stat->reset();
++i;
- }
- ++bi;
+ }
+
+ list<GenBin *>::iterator bi = bins.begin();
+ list<GenBin *>::iterator be = bins.end();
+ while (bi != be) {
+ GenBin *bin = *bi;
+ bin->activate();
+
+ i = allStats.begin();
+ while (i != end) {
+ Stat *stat = *i;
+ stat->reset();
+ ++i;
+ }
+ ++bi;
}
}
@@ -736,7 +744,7 @@ VectorDisplay(std::ostream &stream,
_pdf = vec[i] / _total;
_cdf += _pdf;
} else {
- _pdf = _cdf = 0.0;
+ _pdf = _cdf = NAN;
}
if (!(myflags & cdf)) {
PrintOne(stream, vec[i], subname, subdesc, myprecision,
@@ -768,10 +776,8 @@ VectorDisplay(std::ostream &stream,
_pdf = vec[i] / _total;
_cdf += _pdf;
} else {
- _pdf = _cdf = 0.0;
+ _pdf = _cdf = NAN;
}
- _pdf = vec[i] / _total;
- _cdf += _pdf;
PrintOne(stream, vec[i], name, mydesc, myprecision,
myflags, _pdf, _cdf);
}