diff options
Diffstat (limited to 'base/statistics.cc')
-rw-r--r-- | base/statistics.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/base/statistics.cc b/base/statistics.cc index abebcae53..2f52314b9 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -35,6 +35,7 @@ #include <math.h> +#include "base/callback.hh" #include "base/cprintf.hh" #include "base/intmath.hh" #include "base/misc.hh" @@ -143,6 +144,7 @@ class Database StatData *find(const Stat *stat); void check(); + void reset(); void regStat(Stat *stat); StatData *print(Stat *stat); }; @@ -208,6 +210,18 @@ Database::check() } void +Database::reset() +{ + list_t::iterator i = allStats.begin(); + list_t::iterator end = allStats.end(); + + while (i != end) { + (*i)->reset(); + ++i; + } +} + +void Database::regStat(Stat *stat) { if (map.find(stat) != map.end()) @@ -842,4 +856,19 @@ dump(ostream &stream) Detail::StatDB().dump(stream); } +CallbackQueue resetQueue; + +void +regReset(Callback *cb) +{ + resetQueue.add(cb); +} + +void +reset() +{ + Detail::StatDB().reset(); + resetQueue.process(); +} + } // namespace Statistics |