diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-05-23 21:58:12 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-05-23 21:58:12 +0000 |
commit | 3f7f9df5f0c419b7f7dd39e32852161f406a441f (patch) | |
tree | 67ae6454e4496f6370cf8236500946e2c7e926b0 /src/util/stats.h | |
parent | 91656937b2188f05cdd9b42955c04e6157349285 (diff) |
Merge from arrays2 branch.
Diffstat (limited to 'src/util/stats.h')
-rw-r--r-- | src/util/stats.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util/stats.h b/src/util/stats.h index 882cc1f81..a94733595 100644 --- a/src/util/stats.h +++ b/src/util/stats.h @@ -446,6 +446,24 @@ public: };/* class IntStat */ +template <class T> +class SizeStat : public Stat { +private: + const T& d_sized; +public: + SizeStat(const std::string&name, const T& sized) : + Stat(name), d_sized(sized) {} + ~SizeStat() {} + + void flushInformation(std::ostream& out) const { + out<< d_sized.size(); + } + std::string getValue() const { + std::stringstream ss; + flushInformation(ss); + return ss.str(); + } +};/* class SizeStat */ /** * The value for an AverageStat is the running average of (e1, e_2, ..., e_n), |