changeset 345ef3bda3d2 in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=345ef3bda3d2 description: style: Bring statistics code in line with the proper style.
diffstat: 3 files changed, 3 insertions(+), 3 deletions(-) src/base/statistics.hh | 2 +- src/base/stats/mysql.hh | 3 ++- src/base/stats/statdb.cc | 1 - diffs (truncated from 1161 to 300 lines): diff -r e2983d751be4 -r 345ef3bda3d2 src/base/statistics.hh --- a/src/base/statistics.hh Thu Oct 09 00:10:02 2008 -0700 +++ b/src/base/statistics.hh Thu Oct 09 04:58:23 2008 -0700 @@ -177,7 +177,9 @@ virtual const VCounter &value() const = 0; virtual const VResult &result() const = 0; virtual Result total() const = 0; - void update() + + void + update() { if (!subnames.empty()) { int s = size(); @@ -206,18 +208,25 @@ virtual void reset() { s.reset(); } virtual size_t size() const { return s.size(); } - virtual VCounter &value() const + + virtual VCounter & + value() const { s.value(cvec); return cvec; } - virtual const VResult &result() const + + virtual const VResult & + result() const { s.result(rvec); return rvec; } + virtual Result total() const { return s.total(); } - virtual void visit(Visit &visitor) + + virtual void + visit(Visit &visitor) { update(); s.update(this); @@ -261,7 +270,9 @@ virtual bool check() const { return s.check(); } virtual void reset() { s.reset(); } virtual bool zero() const { return s.zero(); } - virtual void visit(Visit &visitor) + + virtual void + visit(Visit &visitor) { s.update(this); visitor.visit(*this); @@ -280,7 +291,9 @@ mutable VResult rvec; virtual size_t size() const = 0; - void update() + + void + update() { int s = size(); if (subnames.size() < s) @@ -304,7 +317,9 @@ virtual void reset() { s.reset(); } virtual size_t size() const { return s.size(); } virtual bool zero() const { return s.zero(); } - virtual void visit(Visit &visitor) + + virtual void + visit(Visit &visitor) { update(); s.update(this); @@ -324,7 +339,8 @@ mutable int x; mutable int y; - void update() + void + update() { if (subnames.size() < x) subnames.resize(x); @@ -343,7 +359,9 @@ virtual bool check() const { return s.check(); } virtual void reset() { s.reset(); } virtual bool zero() const { return s.zero(); } - virtual void visit(Visit &visitor) + + virtual void + visit(Visit &visitor) { update(); s.update(this); @@ -371,7 +389,8 @@ Parent &self() { return *reinterpret_cast<Parent *>(this); } protected: - Data<Child> *statData() + Data<Child> * + statData() { StatData *__data = DataAccess::statData(); Data<Child> *ptr = dynamic_cast<Data<Child> *>(__data); @@ -380,7 +399,8 @@ } public: - const Data<Child> *statData() const + const Data<Child> * + statData() const { const StatData *__data = DataAccess::statData(); const Data<Child> *ptr = dynamic_cast<const Data<Child> *>(__data); @@ -393,6 +413,7 @@ * Copy constructor, copies are not allowed. */ Wrap(const Wrap &stat); + /** * Can't copy stats. */ @@ -409,7 +430,8 @@ * @param name The new name. * @return A reference to this stat. */ - Parent &name(const std::string &_name) + Parent & + name(const std::string &_name) { Data<Child> *data = this->statData(); data->name = _name; @@ -423,7 +445,8 @@ * @param desc The new description. * @return A reference to this stat. */ - Parent &desc(const std::string &_desc) + Parent & + desc(const std::string &_desc) { this->statData()->desc = _desc; return this->self(); @@ -434,7 +457,8 @@ * @param p The new precision * @return A reference to this stat. */ - Parent &precision(int _precision) + Parent & + precision(int _precision) { this->statData()->precision = _precision; return this->self(); @@ -445,7 +469,8 @@ * @param f The new flags. * @return A reference to this stat. */ - Parent &flags(StatFlags _flags) + Parent & + flags(StatFlags _flags) { this->statData()->flags |= _flags; return this->self(); @@ -458,7 +483,8 @@ * @return A reference to this stat. */ template <class Stat> - Parent &prereq(const Stat &prereq) + Parent & + prereq(const Stat &prereq) { this->statData()->prereq = prereq.statData(); return this->self(); @@ -479,7 +505,8 @@ * @param name The new name of the subfield. * @return A reference to this stat. */ - Parent &subname(int index, const std::string &name) + Parent & + subname(int index, const std::string &name) { std::vector<std::string> &subn = this->statData()->subnames; if (subn.size() <= index) @@ -495,7 +522,8 @@ * @param desc The new description of the subfield * @return A reference to this stat. */ - Parent &subdesc(int index, const std::string &desc) + Parent & + subdesc(int index, const std::string &desc) { std::vector<std::string> &subd = this->statData()->subdescs; if (subd.size() <= index) @@ -515,7 +543,8 @@ * @warning This makes the assumption that if you're gonna subnames a 2d * vector, you're subnaming across all y */ - Parent &ysubnames(const char **names) + Parent & + ysubnames(const char **names) { Data<Child> *data = this->statData(); data->y_subnames.resize(this->y); @@ -523,7 +552,9 @@ data->y_subnames[i] = names[i]; return this->self(); } - Parent &ysubname(int index, const std::string subname) + + Parent & + ysubname(int index, const std::string subname) { Data<Child> *data = this->statData(); assert(index < this->y); @@ -633,7 +664,8 @@ * @param val The new count. * @param p The parameters for this storage. */ - void set(Counter val, Params &p) { + void + set(Counter val, Params &p) { total += current * (curTick - last); last = curTick; current = val; @@ -665,7 +697,8 @@ * @param p The parameters for this storage. * @return The current average. */ - Result result(const Params &p) const + Result + result(const Params &p) const { total += current * (curTick - last); last = curTick; @@ -675,7 +708,8 @@ /** * Reset stat value to default */ - void reset() + void + reset() { total = 0; last = curTick; @@ -864,14 +898,16 @@ ~ValueBase() { if (proxy) delete proxy; } template <class T> - void scalar(T &value) + void + scalar(T &value) { proxy = new ValueProxy<T>(value); setInit(); } template <class T> - void functor(T &func) + void + functor(T &func) { proxy = new FunctorProxy<T>(func); setInit(); @@ -946,7 +982,8 @@ * @param sp The proxy to copy. * @return A reference to this proxy. */ - const ScalarProxy &operator=(const ScalarProxy &sp) { + const ScalarProxy & + operator=(const ScalarProxy &sp) { stat = sp.stat; index = sp.index; return *this; @@ -976,7 +1013,11 @@ * @param v The new value. */ template <typename U> - void operator=(const U &v) { stat->data(index)->set(v, stat->params); } + void + operator=(const U &v) + { + stat->data(index)->set(v, stat->params); + } /** * Increment the stat by the given value. This calls the associated @@ -984,7 +1025,11 @@ * @param v The value to add. */ template <typename U> - void operator+=(const U &v) { stat->data(index)->inc(v, stat->params); } + void + operator+=(const U &v) + { + stat->data(index)->inc(v, stat->params); + } /** _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev