X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=base%2Fstatistics.hh;h=c46744cac6b4a9b74528748f3e3d94ddf351ca3a;hb=5aa71721193c49016ffa69934b44ce38672e4eed;hp=f3b8a3922b93c8fa1243cd35d0f7eeec1559fce2;hpb=014f451d1fa63c4027b49c090441f2cd09269b0f;p=gem5.git diff --git a/base/statistics.hh b/base/statistics.hh index f3b8a3922..c46744cac 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2004 The Regents of The University of Michigan + * Copyright (c) 2003-2005 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,6 +62,7 @@ #include "base/stats/flags.hh" #include "base/stats/visit.hh" #include "base/stats/types.hh" +#include "config/stats_binning.hh" #include "sim/host.hh" class Callback; @@ -407,7 +408,7 @@ class Wrap : public Child public: Wrap() { - map(new Data(*this)); + map(new Data(*this)); } /** @@ -417,10 +418,10 @@ class Wrap : public Child */ Parent &name(const std::string &_name) { - Data *data = statData(); + Data *data = this->statData(); data->name = _name; - setPrint(); - return self(); + this->setPrint(); + return this->self(); } /** @@ -431,8 +432,8 @@ class Wrap : public Child */ Parent &desc(const std::string &_desc) { - statData()->desc = _desc; - return self(); + this->statData()->desc = _desc; + return this->self(); } /** @@ -442,8 +443,8 @@ class Wrap : public Child */ Parent &precision(int _precision) { - statData()->precision = _precision; - return self(); + this->statData()->precision = _precision; + return this->self(); } /** @@ -453,8 +454,8 @@ class Wrap : public Child */ Parent &flags(StatFlags _flags) { - statData()->flags |= _flags; - return self(); + this->statData()->flags |= _flags; + return this->self(); } /** @@ -466,8 +467,8 @@ class Wrap : public Child template Parent &prereq(const Stat &prereq) { - statData()->prereq = prereq.statData(); - return self(); + this->statData()->prereq = prereq.statData(); + return this->self(); } }; @@ -487,11 +488,11 @@ class WrapVec : public Wrap */ Parent &subname(int index, const std::string &name) { - std::vector &subn = statData()->subnames; + std::vector &subn = this->statData()->subnames; if (subn.size() <= index) subn.resize(index + 1); subn[index] = name; - return self(); + return this->self(); } /** @@ -503,12 +504,12 @@ class WrapVec : public Wrap */ Parent &subdesc(int index, const std::string &desc) { - std::vector &subd = statData()->subdescs; + std::vector &subd = this->statData()->subdescs; if (subd.size() <= index) subd.resize(index + 1); subd[index] = desc; - return self(); + return this->self(); } }; @@ -523,19 +524,19 @@ class WrapVec2d : public WrapVec */ Parent &ysubnames(const char **names) { - Data *data = statData(); - data->y_subnames.resize(y); - for (int i = 0; i < y; ++i) + Data *data = this->statData(); + data->y_subnames.resize(this->y); + for (int i = 0; i < this->y; ++i) data->y_subnames[i] = names[i]; - return self(); + return this->self(); } Parent &ysubname(int index, const std::string subname) { - Data *data = statData(); - assert(index < y); - data->y_subnames.resize(y); + Data *data = this->statData(); + assert(index < this->y); + data->y_subnames.resize(this->y); data->y_subnames[index] = subname.c_str(); - return self(); + return this->self(); } }; @@ -711,7 +712,7 @@ class ScalarBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::Bin bin_t; + typedef typename Bin::template Bin bin_t; protected: /** The bin of this stat. */ @@ -914,7 +915,7 @@ class VectorBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::VectorBin bin_t; + typedef typename Bin::template VectorBin bin_t; protected: /** The bin of this stat. */ @@ -1022,7 +1023,7 @@ class ScalarProxy /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::VectorBin bin_t; + typedef typename Bin::template VectorBin bin_t; private: /** Pointer to the bin in the parent VectorBase. */ @@ -1155,7 +1156,7 @@ class ScalarProxy const StatData *statData() const { return getStatData(stat); } std::string str() const { - return csprintf("%s[%d]", statData()->name, index); + return csprintf("%s[%d]", this->statData()->name, index); } }; @@ -1176,7 +1177,7 @@ class Vector2dBase : public DataAccess { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin bin_t; + typedef typename Bin::template VectorBin bin_t; protected: size_t x; @@ -1204,7 +1205,7 @@ class Vector2dBase : public DataAccess data->cvec[i] = this->data(i)->value(params); } - std::string ysubname(int i) const { return (*y_subnames)[i]; } + std::string ysubname(int i) const { return (*this->y_subnames)[i]; } friend class VectorProxy; VectorProxy operator[](int index); @@ -1225,7 +1226,7 @@ class VectorProxy { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin bin_t; + typedef typename Bin::template VectorBin bin_t; private: bin_t *bin; @@ -1622,7 +1623,7 @@ class DistBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::Bin bin_t; + typedef typename Bin::template Bin bin_t; protected: /** The bin of this stat. */ @@ -1698,7 +1699,7 @@ class VectorDistBase : public DataAccess { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin bin_t; + typedef typename Bin::template VectorBin bin_t; protected: bin_t bin; @@ -1749,7 +1750,7 @@ class DistProxy { public: typedef typename Storage::Params params_t; - typedef typename Bin::Bin bin_t; + typedef typename Bin::template Bin bin_t; typedef VectorDistBase base_t; private: @@ -2184,7 +2185,7 @@ class SumNode : public Node * binned. If the typedef is NoBin, nothing is binned. If it is * MainBin, then all stats are binned under that Bin. */ -#if defined(FS_MEASURE) || defined(STATS_BINNING) +#if STATS_BINNING typedef MainBin DefaultBin; #else typedef NoBin DefaultBin; @@ -2206,7 +2207,7 @@ class Scalar Scalar() { - setInit(); + this->setInit(); } /** @@ -2258,7 +2259,7 @@ class Average Average() { - setInit(); + this->setInit(); } /** @@ -2290,8 +2291,8 @@ class Vector * @return A reference to this stat. */ Vector &init(size_t size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2314,8 +2315,8 @@ class AverageVector * @return A reference to this stat. */ AverageVector &init(size_t size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2333,10 +2334,10 @@ class Vector2d { public: Vector2d &init(size_t _x, size_t _y) { - statData()->x = x = _x; - statData()->y = y = _y; - bin.init(x * y, params); - setInit(); + this->statData()->x = this->x = _x; + this->statData()->y = this->y = _y; + this->bin.init(this->x * this->y, this->params); + this->setInit(); return *this; } @@ -2367,12 +2368,12 @@ class Distribution * @return A reference to this distribution. */ Distribution &init(Counter min, Counter max, Counter bkt) { - params.min = min; - params.max = max; - params.bucket_size = bkt; - params.size = (int)rint((max - min) / bkt + 1.0); - bin.init(params); - setInit(); + this->params.min = min; + this->params.max = max; + this->params.bucket_size = bkt; + this->params.size = (int)rint((max - min) / bkt + 1.0); + this->bin.init(this->params); + this->setInit(); return *this; } @@ -2399,8 +2400,8 @@ class StandardDeviation * Construct and initialize this distribution. */ StandardDeviation() { - bin.init(params); - setInit(); + this->bin.init(this->params); + this->setInit(); } }; @@ -2426,8 +2427,8 @@ class AverageDeviation */ AverageDeviation() { - bin.init(params); - setInit(); + this->bin.init(this->params); + this->setInit(); } }; @@ -2457,12 +2458,12 @@ class VectorDistribution * @return A reference to this distribution. */ VectorDistribution &init(int size, Counter min, Counter max, Counter bkt) { - params.min = min; - params.max = max; - params.bucket_size = bkt; - params.size = (int)rint((max - min) / bkt + 1.0); - bin.init(size, params); - setInit(); + this->params.min = min; + this->params.max = max; + this->params.bucket_size = bkt; + this->params.size = (int)rint((max - min) / bkt + 1.0); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2491,8 +2492,8 @@ class VectorStandardDeviation * @return A reference to this distribution. */ VectorStandardDeviation &init(int size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2521,8 +2522,8 @@ class VectorAverageDeviation * @return A reference to this distribution. */ VectorAverageDeviation &init(int size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2872,12 +2873,6 @@ operator/(Temp l, Temp r) return NodePtr(new BinaryNode >(l, r)); } -inline Temp -operator%(Temp l, Temp r) -{ - return NodePtr(new BinaryNode >(l, r)); -} - inline Temp operator-(Temp l) {