gem5  v20.1.0.0
statistics.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020 Arm Limited
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2003-2005 The Regents of The University of Michigan
15  * Copyright (c) 2017, Centre National de la Recherche Scientifique
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
58 #ifndef __BASE_STATISTICS_HH__
59 #define __BASE_STATISTICS_HH__
60 
61 #include <algorithm>
62 #include <cassert>
63 #ifdef __SUNPRO_CC
64 #include <math.h>
65 #endif
66 #include <cmath>
67 #include <functional>
68 #include <iosfwd>
69 #include <list>
70 #include <map>
71 #include <memory>
72 #include <string>
73 #include <vector>
74 
75 #include "base/stats/group.hh"
76 #include "base/stats/info.hh"
77 #include "base/stats/output.hh"
78 #include "base/stats/types.hh"
79 #include "base/cast.hh"
80 #include "base/cprintf.hh"
81 #include "base/intmath.hh"
82 #include "base/str.hh"
83 #include "base/types.hh"
84 
86 extern Tick curTick();
87 
88 /* A namespace for all of the Statistics */
89 namespace Stats {
90 
91 template <class Stat, class Base>
92 class InfoProxy : public Base
93 {
94  protected:
95  Stat &s;
96 
97  public:
98  InfoProxy(Stat &stat) : s(stat) {}
99 
100  bool check() const { return s.check(); }
101  void prepare() { s.prepare(); }
102  void reset() { s.reset(); }
103  void
104  visit(Output &visitor)
105  {
106  visitor.visit(*static_cast<Base *>(this));
107  }
108  bool zero() const { return s.zero(); }
109 };
110 
111 template <class Stat>
112 class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo>
113 {
114  public:
115  ScalarInfoProxy(Stat &stat) : InfoProxy<Stat, ScalarInfo>(stat) {}
116 
117  Counter value() const { return this->s.value(); }
118  Result result() const { return this->s.result(); }
119  Result total() const { return this->s.total(); }
120 };
121 
122 template <class Stat>
123 class VectorInfoProxy : public InfoProxy<Stat, VectorInfo>
124 {
125  protected:
126  mutable VCounter cvec;
127  mutable VResult rvec;
128 
129  public:
130  VectorInfoProxy(Stat &stat) : InfoProxy<Stat, VectorInfo>(stat) {}
131 
132  size_type size() const { return this->s.size(); }
133 
134  VCounter &
135  value() const
136  {
137  this->s.value(cvec);
138  return cvec;
139  }
140 
141  const VResult &
142  result() const
143  {
144  this->s.result(rvec);
145  return rvec;
146  }
147 
148  Result total() const { return this->s.total(); }
149 };
150 
151 template <class Stat>
152 class DistInfoProxy : public InfoProxy<Stat, DistInfo>
153 {
154  public:
155  DistInfoProxy(Stat &stat) : InfoProxy<Stat, DistInfo>(stat) {}
156 };
157 
158 template <class Stat>
159 class VectorDistInfoProxy : public InfoProxy<Stat, VectorDistInfo>
160 {
161  public:
162  VectorDistInfoProxy(Stat &stat) : InfoProxy<Stat, VectorDistInfo>(stat) {}
163 
164  size_type size() const { return this->s.size(); }
165 };
166 
167 template <class Stat>
168 class Vector2dInfoProxy : public InfoProxy<Stat, Vector2dInfo>
169 {
170  public:
171  Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {}
172 
173  Result total() const { return this->s.total(); }
174 };
175 
177 {
178  virtual ~StorageParams();
179 };
180 
182 {
183  private:
185 
186  protected:
188  void setInfo(Group *parent, Info *info);
190  void setParams(const StorageParams *params);
192  void setInit();
193 
195  Info *info();
197  const Info *info() const;
198 
199  public:
201  : _info(nullptr) {};
202 
206  void reset() { }
207 
212  bool zero() const { return true; }
213 
219  bool check() const { return true; }
220 };
221 
222 template <class Derived, template <class> class InfoProxyType>
223 class DataWrap : public InfoAccess
224 {
225  public:
226  typedef InfoProxyType<Derived> Info;
227 
228  protected:
229  Derived &self() { return *static_cast<Derived *>(this); }
230 
231  protected:
232  Info *
234  {
235  return safe_cast<Info *>(InfoAccess::info());
236  }
237 
238  public:
239  const Info *
240  info() const
241  {
242  return safe_cast<const Info *>(InfoAccess::info());
243  }
244 
245  public:
246  DataWrap() = delete;
247  DataWrap(const DataWrap &) = delete;
248  DataWrap &operator=(const DataWrap &) = delete;
249 
250 
251  DataWrap(Group *parent, const char *name, const char *desc)
252  {
253  auto info = new Info(self());
254  this->setInfo(parent, info);
255 
256  if (parent)
257  parent->addStat(info);
258 
259  if (name) {
260  info->setName(parent, name);
261  info->flags.set(display);
262  }
263 
264  if (desc)
265  info->desc = desc;
266  }
267 
273  Derived &
274  name(const std::string &name)
275  {
276  Info *info = this->info();
277  info->setName(name);
278  info->flags.set(display);
279  return this->self();
280  }
281  const std::string &name() const { return this->info()->name; }
282 
289  Derived &
290  setSeparator(const std::string &_sep)
291  {
292  this->info()->setSeparator(_sep);
293  return this->self();
294  }
295  const std::string &setSeparator() const
296  {
297  return this->info()->separatorString;
298  }
299 
306  Derived &
307  desc(const std::string &_desc)
308  {
309  this->info()->desc = _desc;
310  return this->self();
311  }
312 
318  Derived &
319  precision(int _precision)
320  {
321  this->info()->precision = _precision;
322  return this->self();
323  }
324 
330  Derived &
331  flags(Flags _flags)
332  {
333  this->info()->flags.set(_flags);
334  return this->self();
335  }
336 
343  template <class Stat>
344  Derived &
345  prereq(const Stat &prereq)
346  {
347  this->info()->prereq = prereq.info();
348  return this->self();
349  }
350 };
351 
352 template <class Derived, template <class> class InfoProxyType>
353 class DataWrapVec : public DataWrap<Derived, InfoProxyType>
354 {
355  public:
356  typedef InfoProxyType<Derived> Info;
357 
358  DataWrapVec(Group *parent = nullptr, const char *name = nullptr,
359  const char *desc = nullptr)
360  : DataWrap<Derived, InfoProxyType>(parent, name, desc)
361  {}
362 
363  // The following functions are specific to vectors. If you use them
364  // in a non vector context, you will get a nice compiler error!
365 
373  Derived &
374  subname(off_type index, const std::string &name)
375  {
376  Derived &self = this->self();
377  Info *info = self.info();
378 
379  std::vector<std::string> &subn = info->subnames;
380  if (subn.size() <= index)
381  subn.resize(index + 1);
382  subn[index] = name;
383  return self;
384  }
385 
386  // The following functions are specific to 2d vectors. If you use
387  // them in a non vector context, you will get a nice compiler
388  // error because info doesn't have the right variables.
389 
397  Derived &
398  subdesc(off_type index, const std::string &desc)
399  {
400  Info *info = this->info();
401 
402  std::vector<std::string> &subd = info->subdescs;
403  if (subd.size() <= index)
404  subd.resize(index + 1);
405  subd[index] = desc;
406 
407  return this->self();
408  }
409 
410  void
412  {
413  Derived &self = this->self();
414  Info *info = this->info();
415 
416  size_t size = self.size();
417  for (off_type i = 0; i < size; ++i)
418  self.data(i)->prepare(info);
419  }
420 
421  void
423  {
424  Derived &self = this->self();
425  Info *info = this->info();
426 
427  size_t size = self.size();
428  for (off_type i = 0; i < size; ++i)
429  self.data(i)->reset(info);
430  }
431 };
432 
433 template <class Derived, template <class> class InfoProxyType>
434 class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType>
435 {
436  public:
437  typedef InfoProxyType<Derived> Info;
438 
439  DataWrapVec2d(Group *parent, const char *name, const char *desc)
440  : DataWrapVec<Derived, InfoProxyType>(parent, name, desc)
441  {
442  }
443 
448  Derived &
449  ysubnames(const char **names)
450  {
451  Derived &self = this->self();
452  Info *info = this->info();
453 
454  info->y_subnames.resize(self.y);
455  for (off_type i = 0; i < self.y; ++i)
456  info->y_subnames[i] = names[i];
457  return self;
458  }
459 
460  Derived &
461  ysubname(off_type index, const std::string &subname)
462  {
463  Derived &self = this->self();
464  Info *info = this->info();
465 
466  assert(index < self.y);
467  info->y_subnames.resize(self.y);
468  info->y_subnames[index] = subname.c_str();
469  return self;
470  }
471 
472  std::string
474  {
475  return this->info()->y_subnames[i];
476  }
477 
478 };
479 
481 //
482 // Simple Statistics
483 //
485 
489 class StatStor
490 {
491  private:
494 
495  public:
496  struct Params : public StorageParams {};
497 
498  public:
503  StatStor(Info *info)
504  : data(Counter())
505  { }
506 
511  void set(Counter val) { data = val; }
516  void inc(Counter val) { data += val; }
521  void dec(Counter val) { data -= val; }
526  Counter value() const { return data; }
531  Result result() const { return (Result)data; }
535  void prepare(Info *info) { }
539  void reset(Info *info) { data = Counter(); }
540 
544  bool zero() const { return data == Counter(); }
545 };
546 
554 class AvgStor
555 {
556  private:
562  mutable Result total;
564  mutable Tick last;
565 
566  public:
567  struct Params : public StorageParams {};
568 
569  public:
573  AvgStor(Info *info)
574  : current(0), lastReset(0), total(0), last(0)
575  { }
576 
582  void
584  {
585  total += current * (curTick() - last);
586  last = curTick();
587  current = val;
588  }
589 
594  void inc(Counter val) { set(current + val); }
595 
600  void dec(Counter val) { set(current - val); }
601 
606  Counter value() const { return current; }
607 
612  Result
613  result() const
614  {
615  assert(last == curTick());
616  return (Result)(total + current) / (Result)(curTick() - lastReset + 1);
617  }
618 
622  bool zero() const { return total == 0.0; }
623 
627  void
628  prepare(Info *info)
629  {
630  total += current * (curTick() - last);
631  last = curTick();
632  }
633 
637  void
638  reset(Info *info)
639  {
640  total = 0.0;
641  last = curTick();
642  lastReset = curTick();
643  }
644 
645 };
646 
651 template <class Derived, class Stor>
652 class ScalarBase : public DataWrap<Derived, ScalarInfoProxy>
653 {
654  public:
655  typedef Stor Storage;
656  typedef typename Stor::Params Params;
657 
658  protected:
660  char storage[sizeof(Storage)] __attribute__ ((aligned (8)));
661 
662  protected:
668  Storage *
670  {
671  return reinterpret_cast<Storage *>(storage);
672  }
673 
680  const Storage *
681  data() const
682  {
683  return reinterpret_cast<const Storage *>(storage);
684  }
685 
686  void
688  {
689  new (storage) Storage(this->info());
690  this->setInit();
691  }
692 
693  public:
698  Counter value() const { return data()->value(); }
699 
700  public:
701  ScalarBase(Group *parent = nullptr, const char *name = nullptr,
702  const char *desc = nullptr)
703  : DataWrap<Derived, ScalarInfoProxy>(parent, name, desc)
704  {
705  this->doInit();
706  }
707 
708  public:
709  // Common operators for stats
714  void operator++() { data()->inc(1); }
719  void operator--() { data()->dec(1); }
720 
722  void operator++(int) { ++*this; }
724  void operator--(int) { --*this; }
725 
731  template <typename U>
732  void operator=(const U &v) { data()->set(v); }
733 
739  template <typename U>
740  void operator+=(const U &v) { data()->inc(v); }
741 
747  template <typename U>
748  void operator-=(const U &v) { data()->dec(v); }
749 
754  size_type size() const { return 1; }
755 
756  Counter value() { return data()->value(); }
757 
758  Result result() { return data()->result(); }
759 
760  Result total() { return result(); }
761 
762  bool zero() { return result() == 0.0; }
763 
764  void reset() { data()->reset(this->info()); }
765  void prepare() { data()->prepare(this->info()); }
766 };
767 
768 class ProxyInfo : public ScalarInfo
769 {
770  public:
771  std::string str() const { return std::to_string(value()); }
772  size_type size() const { return 1; }
773  bool check() const { return true; }
774  void prepare() { }
775  void reset() { }
776  bool zero() const { return value() == 0; }
777 
778  void visit(Output &visitor) { visitor.visit(*this); }
779 };
780 
781 template <class T>
782 class ValueProxy : public ProxyInfo
783 {
784  private:
785  T *scalar;
786 
787  public:
789  Counter value() const { return *scalar; }
790  Result result() const { return *scalar; }
791  Result total() const { return *scalar; }
792 };
793 
794 template <class T, class Enabled=void>
795 class FunctorProxy : public ProxyInfo
796 {
797  private:
799 
800  public:
801  FunctorProxy(T &func) : functor(&func) {}
802  Counter value() const { return (*functor)(); }
803  Result result() const { return (*functor)(); }
804  Result total() const { return (*functor)(); }
805 };
806 
813 template <class T>
814 class FunctorProxy<T,
815  typename std::enable_if<std::is_constructible<std::function<Result()>,
816  const T &>::value>::type> : public ProxyInfo
817 {
818  private:
819  std::function<Result()> functor;
820 
821  public:
822  FunctorProxy(const T &func) : functor(func) {}
823  Counter value() const { return functor(); }
824  Result result() const { return functor(); }
825  Result total() const { return functor(); }
826 };
827 
832 template <class T, class V>
833 class MethodProxy : public ProxyInfo
834 {
835  private:
836  T *object;
837  typedef V (T::*MethodPointer) () const;
839 
840  public:
841  MethodProxy(T *obj, MethodPointer meth) : object(obj), method(meth) {}
842  Counter value() const { return (object->*method)(); }
843  Result result() const { return (object->*method)(); }
844  Result total() const { return (object->*method)(); }
845 };
846 
847 template <class Derived>
848 class ValueBase : public DataWrap<Derived, ScalarInfoProxy>
849 {
850  private:
852 
853  public:
854  ValueBase(Group *parent, const char *name, const char *desc)
855  : DataWrap<Derived, ScalarInfoProxy>(parent, name, desc),
856  proxy(NULL)
857  {
858  }
859 
860  ~ValueBase() { if (proxy) delete proxy; }
861 
862  template <class T>
863  Derived &
865  {
866  proxy = new ValueProxy<T>(value);
867  this->setInit();
868  return this->self();
869  }
870 
871  template <class T>
872  Derived &
873  functor(const T &func)
874  {
875  proxy = new FunctorProxy<T>(func);
876  this->setInit();
877  return this->self();
878  }
879 
880  template <class T>
881  Derived &
882  functor(T &func)
883  {
884  proxy = new FunctorProxy<T>(func);
885  this->setInit();
886  return this->self();
887  }
888 
896  template <class T, class V>
897  Derived &
898  method(T *obj, V (T::*method)() const)
899  {
900  proxy = new MethodProxy<T,V>(obj, method);
901  this->setInit();
902  return this->self();
903  }
904 
905  Counter value() { return proxy->value(); }
906  Result result() const { return proxy->result(); }
907  Result total() const { return proxy->total(); };
908  size_type size() const { return proxy->size(); }
909 
910  std::string str() const { return proxy->str(); }
911  bool zero() const { return proxy->zero(); }
912  bool check() const { return proxy != NULL; }
913  void prepare() { }
914  void reset() { }
915 };
916 
918 //
919 // Vector Statistics
920 //
922 
927 template <class Stat>
929 {
930  private:
932  Stat &stat;
933 
936 
937  public:
942  Counter value() const { return stat.data(index)->value(); }
943 
948  Result result() const { return stat.data(index)->result(); }
949 
950  public:
956  : stat(s), index(i)
957  {
958  }
959 
965  : stat(sp.stat), index(sp.index)
966  {}
967 
973  const ScalarProxy &
975  {
976  stat = sp.stat;
977  index = sp.index;
978  return *this;
979  }
980 
981  public:
982  // Common operators for stats
987  void operator++() { stat.data(index)->inc(1); }
992  void operator--() { stat.data(index)->dec(1); }
993 
995  void operator++(int) { ++*this; }
997  void operator--(int) { --*this; }
998 
1004  template <typename U>
1005  void
1006  operator=(const U &v)
1007  {
1008  stat.data(index)->set(v);
1009  }
1010 
1016  template <typename U>
1017  void
1018  operator+=(const U &v)
1019  {
1020  stat.data(index)->inc(v);
1021  }
1022 
1028  template <typename U>
1029  void
1030  operator-=(const U &v)
1031  {
1032  stat.data(index)->dec(v);
1033  }
1034 
1039  size_type size() const { return 1; }
1040 
1041  public:
1042  std::string
1043  str() const
1044  {
1045  return csprintf("%s[%d]", stat.info()->name, index);
1046  }
1047 };
1048 
1053 template <class Derived, class Stor>
1054 class VectorBase : public DataWrapVec<Derived, VectorInfoProxy>
1055 {
1056  public:
1057  typedef Stor Storage;
1058  typedef typename Stor::Params Params;
1059 
1062  friend class ScalarProxy<Derived>;
1063  friend class DataWrapVec<Derived, VectorInfoProxy>;
1064 
1065  protected:
1069 
1070  protected:
1077 
1083  const Storage *data(off_type index) const { return &storage[index]; }
1084 
1085  void
1087  {
1088  assert(s > 0 && "size must be positive!");
1089  assert(!storage && "already initialized");
1090  _size = s;
1091 
1092  char *ptr = new char[_size * sizeof(Storage)];
1093  storage = reinterpret_cast<Storage *>(ptr);
1094 
1095  for (off_type i = 0; i < _size; ++i)
1096  new (&storage[i]) Storage(this->info());
1097 
1098  this->setInit();
1099  }
1100 
1101  public:
1102  void
1103  value(VCounter &vec) const
1104  {
1105  vec.resize(size());
1106  for (off_type i = 0; i < size(); ++i)
1107  vec[i] = data(i)->value();
1108  }
1109 
1114  void
1115  result(VResult &vec) const
1116  {
1117  vec.resize(size());
1118  for (off_type i = 0; i < size(); ++i)
1119  vec[i] = data(i)->result();
1120  }
1121 
1126  Result
1127  total() const
1128  {
1129  Result total = 0.0;
1130  for (off_type i = 0; i < size(); ++i)
1131  total += data(i)->result();
1132  return total;
1133  }
1134 
1138  size_type size() const { return _size; }
1139 
1140  bool
1141  zero() const
1142  {
1143  for (off_type i = 0; i < size(); ++i)
1144  if (data(i)->zero())
1145  return false;
1146  return true;
1147  }
1148 
1149  bool
1150  check() const
1151  {
1152  return storage != NULL;
1153  }
1154 
1155  public:
1156  VectorBase(Group *parent, const char *name, const char *desc)
1157  : DataWrapVec<Derived, VectorInfoProxy>(parent, name, desc),
1158  storage(nullptr), _size(0)
1159  {}
1160 
1162  {
1163  if (!storage)
1164  return;
1165 
1166  for (off_type i = 0; i < _size; ++i)
1167  data(i)->~Storage();
1168  delete [] reinterpret_cast<char *>(storage);
1169  }
1170 
1176  Derived &
1178  {
1179  Derived &self = this->self();
1180  self.doInit(size);
1181  return self;
1182  }
1183 
1189  Proxy
1191  {
1192  assert (index < size());
1193  return Proxy(this->self(), index);
1194  }
1195 };
1196 
1197 template <class Stat>
1199 {
1200  private:
1201  Stat &stat;
1204 
1205  private:
1206  mutable VResult vec;
1207 
1208  typename Stat::Storage *
1210  {
1211  assert(index < len);
1212  return stat.data(offset + index);
1213  }
1214 
1215  const typename Stat::Storage *
1217  {
1218  assert(index < len);
1219  return stat.data(offset + index);
1220  }
1221 
1222  public:
1223  const VResult &
1224  result() const
1225  {
1226  vec.resize(size());
1227 
1228  for (off_type i = 0; i < size(); ++i)
1229  vec[i] = data(i)->result();
1230 
1231  return vec;
1232  }
1233 
1234  Result
1235  total() const
1236  {
1237  Result total = 0.0;
1238  for (off_type i = 0; i < size(); ++i)
1239  total += data(i)->result();
1240  return total;
1241  }
1242 
1243  public:
1245  : stat(s), offset(o), len(l)
1246  {
1247  }
1248 
1250  : stat(sp.stat), offset(sp.offset), len(sp.len)
1251  {
1252  }
1253 
1254  const VectorProxy &
1256  {
1257  stat = sp.stat;
1258  offset = sp.offset;
1259  len = sp.len;
1260  return *this;
1261  }
1262 
1265  {
1266  assert (index < size());
1267  return ScalarProxy<Stat>(stat, offset + index);
1268  }
1269 
1270  size_type size() const { return len; }
1271 };
1272 
1273 template <class Derived, class Stor>
1274 class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
1275 {
1276  public:
1278  typedef Stor Storage;
1279  typedef typename Stor::Params Params;
1281  friend class ScalarProxy<Derived>;
1282  friend class VectorProxy<Derived>;
1283  friend class DataWrapVec<Derived, Vector2dInfoProxy>;
1284  friend class DataWrapVec2d<Derived, Vector2dInfoProxy>;
1285 
1286  protected:
1291 
1292  protected:
1294  const Storage *data(off_type index) const { return &storage[index]; }
1295 
1296  public:
1297  Vector2dBase(Group *parent, const char *name, const char *desc)
1298  : DataWrapVec2d<Derived, Vector2dInfoProxy>(parent, name, desc),
1299  x(0), y(0), _size(0), storage(nullptr)
1300  {}
1301 
1303  {
1304  if (!storage)
1305  return;
1306 
1307  for (off_type i = 0; i < _size; ++i)
1308  data(i)->~Storage();
1309  delete [] reinterpret_cast<char *>(storage);
1310  }
1311 
1312  Derived &
1314  {
1315  assert(_x > 0 && _y > 0 && "sizes must be positive!");
1316  assert(!storage && "already initialized");
1317 
1318  Derived &self = this->self();
1319  Info *info = this->info();
1320 
1321  x = _x;
1322  y = _y;
1323  info->x = _x;
1324  info->y = _y;
1325  _size = x * y;
1326 
1327  char *ptr = new char[_size * sizeof(Storage)];
1328  storage = reinterpret_cast<Storage *>(ptr);
1329 
1330  for (off_type i = 0; i < _size; ++i)
1331  new (&storage[i]) Storage(info);
1332 
1333  this->setInit();
1334 
1335  return self;
1336  }
1337 
1338  Proxy
1340  {
1341  off_type offset = index * y;
1342  assert (offset + y <= size());
1343  return Proxy(this->self(), offset, y);
1344  }
1345 
1346 
1347  size_type
1348  size() const
1349  {
1350  return _size;
1351  }
1352 
1353  bool
1354  zero() const
1355  {
1356  return data(0)->zero();
1357  }
1358 
1363  Result
1364  total() const
1365  {
1366  Result total = 0.0;
1367  for (off_type i = 0; i < size(); ++i)
1368  total += data(i)->result();
1369  return total;
1370  }
1371 
1372  void
1374  {
1375  Info *info = this->info();
1376  size_type size = this->size();
1377 
1378  for (off_type i = 0; i < size; ++i)
1379  data(i)->prepare(info);
1380 
1381  info->cvec.resize(size);
1382  for (off_type i = 0; i < size; ++i)
1383  info->cvec[i] = data(i)->value();
1384  }
1385 
1389  void
1391  {
1392  Info *info = this->info();
1393  size_type size = this->size();
1394  for (off_type i = 0; i < size; ++i)
1395  data(i)->reset(info);
1396  }
1397 
1398  bool
1399  check() const
1400  {
1401  return storage != NULL;
1402  }
1403 };
1404 
1406 //
1407 // Non formula statistics
1408 //
1410 
1411 struct DistParams : public StorageParams
1412 {
1415 };
1416 
1421 {
1422  public:
1424  struct Params : public DistParams
1425  {
1434 
1436  buckets(0) {}
1437  };
1438 
1439  private:
1446 
1463 
1464  public:
1466  : cvec(safe_cast<const Params *>(info->storageParams)->buckets)
1467  {
1468  reset(info);
1469  }
1470 
1476  void
1477  sample(Counter val, int number)
1478  {
1479  if (val < min_track)
1480  underflow += number;
1481  else if (val > max_track)
1482  overflow += number;
1483  else {
1484  size_type index =
1485  (size_type)std::floor((val - min_track) / bucket_size);
1486  assert(index < size());
1487  cvec[index] += number;
1488  }
1489 
1490  if (val < min_val)
1491  min_val = val;
1492 
1493  if (val > max_val)
1494  max_val = val;
1495 
1496  sum += val * number;
1497  squares += val * val * number;
1498  samples += number;
1499  }
1500 
1505  size_type size() const { return cvec.size(); }
1506 
1511  bool
1512  zero() const
1513  {
1514  return samples == Counter();
1515  }
1516 
1517  void
1519  {
1520  const Params *params = safe_cast<const Params *>(info->storageParams);
1521 
1522  assert(params->type == Dist);
1523  data.type = params->type;
1524  data.min = params->min;
1525  data.max = params->max;
1526  data.bucket_size = params->bucket_size;
1527 
1528  data.min_val = (min_val == CounterLimits::max()) ? 0 : min_val;
1529  data.max_val = (max_val == CounterLimits::min()) ? 0 : max_val;
1530  data.underflow = underflow;
1531  data.overflow = overflow;
1532 
1533  data.cvec.resize(params->buckets);
1534  for (off_type i = 0; i < params->buckets; ++i)
1535  data.cvec[i] = cvec[i];
1536 
1537  data.sum = sum;
1538  data.squares = squares;
1539  data.samples = samples;
1540  }
1541 
1545  void
1546  reset(Info *info)
1547  {
1548  const Params *params = safe_cast<const Params *>(info->storageParams);
1549  min_track = params->min;
1550  max_track = params->max;
1551  bucket_size = params->bucket_size;
1552 
1553  min_val = CounterLimits::max();
1554  max_val = CounterLimits::min();
1555  underflow = Counter();
1556  overflow = Counter();
1557 
1558  size_type size = cvec.size();
1559  for (off_type i = 0; i < size; ++i)
1560  cvec[i] = Counter();
1561 
1562  sum = Counter();
1563  squares = Counter();
1564  samples = Counter();
1565  }
1566 };
1567 
1572 {
1573  public:
1575  struct Params : public DistParams
1576  {
1579 
1581  };
1582 
1583  private:
1590 
1601 
1602  public:
1604  : cvec(safe_cast<const Params *>(info->storageParams)->buckets)
1605  {
1606  reset(info);
1607  }
1608 
1609  void grow_up();
1610  void grow_out();
1611  void grow_convert();
1612  void add(HistStor *);
1613 
1619  void
1620  sample(Counter val, int number)
1621  {
1622  assert(min_bucket < max_bucket);
1623  if (val < min_bucket) {
1624  if (min_bucket == 0)
1625  grow_convert();
1626 
1627  while (val < min_bucket)
1628  grow_out();
1629  } else if (val >= max_bucket + bucket_size) {
1630  if (min_bucket == 0) {
1631  while (val >= max_bucket + bucket_size)
1632  grow_up();
1633  } else {
1634  while (val >= max_bucket + bucket_size)
1635  grow_out();
1636  }
1637  }
1638 
1639  size_type index =
1640  (int64_t)std::floor((val - min_bucket) / bucket_size);
1641 
1642  assert(index < size());
1643  cvec[index] += number;
1644 
1645  sum += val * number;
1646  squares += val * val * number;
1647  logs += log(val) * number;
1648  samples += number;
1649  }
1650 
1655  size_type size() const { return cvec.size(); }
1656 
1661  bool
1662  zero() const
1663  {
1664  return samples == Counter();
1665  }
1666 
1667  void
1669  {
1670  const Params *params = safe_cast<const Params *>(info->storageParams);
1671 
1672  assert(params->type == Hist);
1673  data.type = params->type;
1674  data.min = min_bucket;
1675  data.max = max_bucket + bucket_size - 1;
1676  data.bucket_size = bucket_size;
1677 
1678  data.min_val = min_bucket;
1679  data.max_val = max_bucket;
1680 
1681  int buckets = params->buckets;
1682  data.cvec.resize(buckets);
1683  for (off_type i = 0; i < buckets; ++i)
1684  data.cvec[i] = cvec[i];
1685 
1686  data.sum = sum;
1687  data.logs = logs;
1688  data.squares = squares;
1689  data.samples = samples;
1690  }
1691 
1695  void
1696  reset(Info *info)
1697  {
1698  const Params *params = safe_cast<const Params *>(info->storageParams);
1699  min_bucket = 0;
1700  max_bucket = params->buckets - 1;
1701  bucket_size = 1;
1702 
1703  size_type size = cvec.size();
1704  for (off_type i = 0; i < size; ++i)
1705  cvec[i] = Counter();
1706 
1707  sum = Counter();
1708  squares = Counter();
1709  samples = Counter();
1710  logs = Counter();
1711  }
1712 };
1713 
1719 {
1720  public:
1721  struct Params : public DistParams
1722  {
1724  };
1725 
1726  private:
1733 
1734  public:
1739  : sum(Counter()), squares(Counter()), samples(Counter())
1740  { }
1741 
1749  void
1750  sample(Counter val, int number)
1751  {
1752  sum += val * number;
1753  squares += val * val * number;
1754  samples += number;
1755  }
1756 
1761  size_type size() const { return 1; }
1762 
1767  bool zero() const { return samples == Counter(); }
1768 
1769  void
1771  {
1772  const Params *params = safe_cast<const Params *>(info->storageParams);
1773 
1774  assert(params->type == Deviation);
1775  data.type = params->type;
1776  data.sum = sum;
1777  data.squares = squares;
1778  data.samples = samples;
1779  }
1780 
1784  void
1785  reset(Info *info)
1786  {
1787  sum = Counter();
1788  squares = Counter();
1789  samples = Counter();
1790  }
1791 };
1792 
1798 {
1799  public:
1800  struct Params : public DistParams
1801  {
1803  };
1804 
1805  private:
1810 
1811  public:
1816  : sum(Counter()), squares(Counter())
1817  {}
1818 
1825  void
1826  sample(Counter val, int number)
1827  {
1828  sum += val * number;
1829  squares += val * val * number;
1830  }
1831 
1836  size_type size() const { return 1; }
1837 
1842  bool zero() const { return sum == Counter(); }
1843 
1844  void
1846  {
1847  const Params *params = safe_cast<const Params *>(info->storageParams);
1848 
1849  assert(params->type == Deviation);
1850  data.type = params->type;
1851  data.sum = sum;
1852  data.squares = squares;
1853  data.samples = curTick();
1854  }
1855 
1859  void
1860  reset(Info *info)
1861  {
1862  sum = Counter();
1863  squares = Counter();
1864  }
1865 };
1866 
1871 template <class Derived, class Stor>
1872 class DistBase : public DataWrap<Derived, DistInfoProxy>
1873 {
1874  public:
1876  typedef Stor Storage;
1877  typedef typename Stor::Params Params;
1878 
1879  protected:
1881  char storage[sizeof(Storage)] __attribute__ ((aligned (8)));
1882 
1883  protected:
1888  Storage *
1890  {
1891  return reinterpret_cast<Storage *>(storage);
1892  }
1893 
1898  const Storage *
1899  data() const
1900  {
1901  return reinterpret_cast<const Storage *>(storage);
1902  }
1903 
1904  void
1906  {
1907  new (storage) Storage(this->info());
1908  this->setInit();
1909  }
1910 
1911  public:
1912  DistBase(Group *parent, const char *name, const char *desc)
1913  : DataWrap<Derived, DistInfoProxy>(parent, name, desc)
1914  {
1915  }
1916 
1923  template <typename U>
1924  void sample(const U &v, int n = 1) { data()->sample(v, n); }
1925 
1930  size_type size() const { return data()->size(); }
1935  bool zero() const { return data()->zero(); }
1936 
1937  void
1939  {
1940  Info *info = this->info();
1941  data()->prepare(info, info->data);
1942  }
1943 
1947  void
1949  {
1950  data()->reset(this->info());
1951  }
1952 
1956  void add(DistBase &d) { data()->add(d.data()); }
1957 
1958 };
1959 
1960 template <class Stat>
1962 
1963 template <class Derived, class Stor>
1964 class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy>
1965 {
1966  public:
1968  typedef Stor Storage;
1969  typedef typename Stor::Params Params;
1971  friend class DistProxy<Derived>;
1972  friend class DataWrapVec<Derived, VectorDistInfoProxy>;
1973 
1974  protected:
1977 
1978  protected:
1979  Storage *
1981  {
1982  return &storage[index];
1983  }
1984 
1985  const Storage *
1987  {
1988  return &storage[index];
1989  }
1990 
1991  void
1993  {
1994  assert(s > 0 && "size must be positive!");
1995  assert(!storage && "already initialized");
1996  _size = s;
1997 
1998  char *ptr = new char[_size * sizeof(Storage)];
1999  storage = reinterpret_cast<Storage *>(ptr);
2000 
2001  Info *info = this->info();
2002  for (off_type i = 0; i < _size; ++i)
2003  new (&storage[i]) Storage(info);
2004 
2005  this->setInit();
2006  }
2007 
2008  public:
2009  VectorDistBase(Group *parent, const char *name, const char *desc)
2010  : DataWrapVec<Derived, VectorDistInfoProxy>(parent, name, desc),
2011  storage(NULL)
2012  {}
2013 
2015  {
2016  if (!storage)
2017  return ;
2018 
2019  for (off_type i = 0; i < _size; ++i)
2020  data(i)->~Storage();
2021  delete [] reinterpret_cast<char *>(storage);
2022  }
2023 
2025  {
2026  assert(index < size());
2027  return Proxy(this->self(), index);
2028  }
2029 
2030  size_type
2031  size() const
2032  {
2033  return _size;
2034  }
2035 
2036  bool
2037  zero() const
2038  {
2039  for (off_type i = 0; i < size(); ++i)
2040  if (!data(i)->zero())
2041  return false;
2042  return true;
2043  }
2044 
2045  void
2047  {
2048  Info *info = this->info();
2049  size_type size = this->size();
2050  info->data.resize(size);
2051  for (off_type i = 0; i < size; ++i)
2052  data(i)->prepare(info, info->data[i]);
2053  }
2054 
2055  bool
2056  check() const
2057  {
2058  return storage != NULL;
2059  }
2060 };
2061 
2062 template <class Stat>
2063 class DistProxy
2064 {
2065  private:
2066  Stat &stat;
2068 
2069  protected:
2070  typename Stat::Storage *data() { return stat.data(index); }
2071  const typename Stat::Storage *data() const { return stat.data(index); }
2072 
2073  public:
2075  : stat(s), index(i)
2076  {}
2077 
2079  : stat(sp.stat), index(sp.index)
2080  {}
2081 
2082  const DistProxy &
2084  {
2085  stat = sp.stat;
2086  index = sp.index;
2087  return *this;
2088  }
2089 
2090  public:
2091  template <typename U>
2092  void
2093  sample(const U &v, int n = 1)
2094  {
2095  data()->sample(v, n);
2096  }
2097 
2098  size_type
2099  size() const
2100  {
2101  return 1;
2102  }
2103 
2104  bool
2105  zero() const
2106  {
2107  return data()->zero();
2108  }
2109 
2113  void reset() { }
2114 };
2115 
2117 //
2118 // Formula Details
2119 //
2121 
2126 class Node
2127 {
2128  public:
2133  virtual size_type size() const = 0;
2138  virtual const VResult &result() const = 0;
2143  virtual Result total() const = 0;
2144 
2148  virtual std::string str() const = 0;
2149 
2150  virtual ~Node() {};
2151 };
2152 
2154 typedef std::shared_ptr<Node> NodePtr;
2155 
2156 class ScalarStatNode : public Node
2157 {
2158  private:
2160  mutable VResult vresult;
2161 
2162  public:
2164 
2165  const VResult &
2166  result() const
2167  {
2168  vresult[0] = data->result();
2169  return vresult;
2170  }
2171 
2172  Result total() const { return data->result(); };
2173 
2174  size_type size() const { return 1; }
2175 
2179  std::string str() const { return data->name; }
2180 };
2181 
2182 template <class Stat>
2183 class ScalarProxyNode : public Node
2184 {
2185  private:
2187  mutable VResult vresult;
2188 
2189  public:
2191  : proxy(p), vresult(1)
2192  { }
2193 
2194  const VResult &
2195  result() const
2196  {
2197  vresult[0] = proxy.result();
2198  return vresult;
2199  }
2200 
2201  Result
2202  total() const
2203  {
2204  return proxy.result();
2205  }
2206 
2207  size_type
2208  size() const
2209  {
2210  return 1;
2211  }
2212 
2216  std::string
2217  str() const
2218  {
2219  return proxy.str();
2220  }
2221 };
2222 
2223 class VectorStatNode : public Node
2224 {
2225  private:
2227 
2228  public:
2230  const VResult &result() const { return data->result(); }
2231  Result total() const { return data->total(); };
2232 
2233  size_type size() const { return data->size(); }
2234 
2235  std::string str() const { return data->name; }
2236 };
2237 
2238 template <class T>
2239 class ConstNode : public Node
2240 {
2241  private:
2243 
2244  public:
2245  ConstNode(T s) : vresult(1, (Result)s) {}
2246  const VResult &result() const { return vresult; }
2247  Result total() const { return vresult[0]; };
2248  size_type size() const { return 1; }
2249  std::string str() const { return std::to_string(vresult[0]); }
2250 };
2251 
2252 template <class T>
2253 class ConstVectorNode : public Node
2254 {
2255  private:
2257 
2258  public:
2259  ConstVectorNode(const T &s) : vresult(s.begin(), s.end()) {}
2260  const VResult &result() const { return vresult; }
2261 
2262  Result
2263  total() const
2264  {
2265  size_type size = this->size();
2266  Result tmp = 0;
2267  for (off_type i = 0; i < size; i++)
2268  tmp += vresult[i];
2269  return tmp;
2270  }
2271 
2272  size_type size() const { return vresult.size(); }
2273  std::string
2274  str() const
2275  {
2276  size_type size = this->size();
2277  std::string tmp = "(";
2278  for (off_type i = 0; i < size; i++)
2279  tmp += csprintf("%s ", std::to_string(vresult[i]));
2280  tmp += ")";
2281  return tmp;
2282  }
2283 };
2284 
2285 template <class Op>
2286 struct OpString;
2287 
2288 template<>
2289 struct OpString<std::plus<Result> >
2290 {
2291  static std::string str() { return "+"; }
2292 };
2293 
2294 template<>
2295 struct OpString<std::minus<Result> >
2296 {
2297  static std::string str() { return "-"; }
2298 };
2299 
2300 template<>
2301 struct OpString<std::multiplies<Result> >
2302 {
2303  static std::string str() { return "*"; }
2304 };
2305 
2306 template<>
2307 struct OpString<std::divides<Result> >
2308 {
2309  static std::string str() { return "/"; }
2310 };
2311 
2312 template<>
2313 struct OpString<std::modulus<Result> >
2314 {
2315  static std::string str() { return "%"; }
2316 };
2317 
2318 template<>
2319 struct OpString<std::negate<Result> >
2320 {
2321  static std::string str() { return "-"; }
2322 };
2323 
2324 template <class Op>
2325 class UnaryNode : public Node
2326 {
2327  public:
2329  mutable VResult vresult;
2330 
2331  public:
2333 
2334  const VResult &
2335  result() const
2336  {
2337  const VResult &lvec = l->result();
2338  size_type size = lvec.size();
2339 
2340  assert(size > 0);
2341 
2342  vresult.resize(size);
2343  Op op;
2344  for (off_type i = 0; i < size; ++i)
2345  vresult[i] = op(lvec[i]);
2346 
2347  return vresult;
2348  }
2349 
2350  Result
2351  total() const
2352  {
2353  const VResult &vec = this->result();
2354  Result total = 0.0;
2355  for (off_type i = 0; i < size(); i++)
2356  total += vec[i];
2357  return total;
2358  }
2359 
2360  size_type size() const { return l->size(); }
2361 
2362  std::string
2363  str() const
2364  {
2365  return OpString<Op>::str() + l->str();
2366  }
2367 };
2368 
2369 template <class Op>
2370 class BinaryNode : public Node
2371 {
2372  public:
2375  mutable VResult vresult;
2376 
2377  public:
2379 
2380  const VResult &
2381  result() const override
2382  {
2383  Op op;
2384  const VResult &lvec = l->result();
2385  const VResult &rvec = r->result();
2386 
2387  assert(lvec.size() > 0 && rvec.size() > 0);
2388 
2389  if (lvec.size() == 1 && rvec.size() == 1) {
2390  vresult.resize(1);
2391  vresult[0] = op(lvec[0], rvec[0]);
2392  } else if (lvec.size() == 1) {
2393  size_type size = rvec.size();
2394  vresult.resize(size);
2395  for (off_type i = 0; i < size; ++i)
2396  vresult[i] = op(lvec[0], rvec[i]);
2397  } else if (rvec.size() == 1) {
2398  size_type size = lvec.size();
2399  vresult.resize(size);
2400  for (off_type i = 0; i < size; ++i)
2401  vresult[i] = op(lvec[i], rvec[0]);
2402  } else if (rvec.size() == lvec.size()) {
2403  size_type size = rvec.size();
2404  vresult.resize(size);
2405  for (off_type i = 0; i < size; ++i)
2406  vresult[i] = op(lvec[i], rvec[i]);
2407  }
2408 
2409  return vresult;
2410  }
2411 
2412  Result
2413  total() const override
2414  {
2415  const VResult &vec = this->result();
2416  const VResult &lvec = l->result();
2417  const VResult &rvec = r->result();
2418  Result total = 0.0;
2419  Result lsum = 0.0;
2420  Result rsum = 0.0;
2421  Op op;
2422 
2423  assert(lvec.size() > 0 && rvec.size() > 0);
2424  assert(lvec.size() == rvec.size() ||
2425  lvec.size() == 1 || rvec.size() == 1);
2426 
2428  if (lvec.size() == rvec.size() && lvec.size() > 1) {
2429  for (off_type i = 0; i < size(); ++i) {
2430  lsum += lvec[i];
2431  rsum += rvec[i];
2432  }
2433  return op(lsum, rsum);
2434  }
2435 
2437  for (off_type i = 0; i < size(); ++i) {
2438  total += vec[i];
2439  }
2440 
2441  return total;
2442  }
2443 
2444  size_type
2445  size() const override
2446  {
2447  size_type ls = l->size();
2448  size_type rs = r->size();
2449  if (ls == 1) {
2450  return rs;
2451  } else if (rs == 1) {
2452  return ls;
2453  } else {
2454  assert(ls == rs && "Node vector sizes are not equal");
2455  return ls;
2456  }
2457  }
2458 
2459  std::string
2460  str() const override
2461  {
2462  return csprintf("(%s %s %s)", l->str(), OpString<Op>::str(), r->str());
2463  }
2464 };
2465 
2466 template <class Op>
2467 class SumNode : public Node
2468 {
2469  public:
2471  mutable VResult vresult;
2472 
2473  public:
2474  SumNode(NodePtr &p) : l(p), vresult(1) {}
2475 
2476  const VResult &
2477  result() const
2478  {
2479  const VResult &lvec = l->result();
2480  size_type size = lvec.size();
2481  assert(size > 0);
2482 
2483  vresult[0] = 0.0;
2484 
2485  Op op;
2486  for (off_type i = 0; i < size; ++i)
2487  vresult[0] = op(vresult[0], lvec[i]);
2488 
2489  return vresult;
2490  }
2491 
2492  Result
2493  total() const
2494  {
2495  const VResult &lvec = l->result();
2496  size_type size = lvec.size();
2497  assert(size > 0);
2498 
2499  Result result = 0.0;
2500 
2501  Op op;
2502  for (off_type i = 0; i < size; ++i)
2503  result = op(result, lvec[i]);
2504 
2505  return result;
2506  }
2507 
2508  size_type size() const { return 1; }
2509 
2510  std::string
2511  str() const
2512  {
2513  return csprintf("total(%s)", l->str());
2514  }
2515 };
2516 
2517 
2519 //
2520 // Visible Statistics Types
2521 //
2523 
2533 class Scalar : public ScalarBase<Scalar, StatStor>
2534 {
2535  public:
2537 
2538  Scalar(Group *parent = nullptr, const char *name = nullptr,
2539  const char *desc = nullptr)
2540  : ScalarBase<Scalar, StatStor>(parent, name, desc)
2541  {
2542  }
2543 };
2544 
2549 class Average : public ScalarBase<Average, AvgStor>
2550 {
2551  public:
2553 
2554  Average(Group *parent = nullptr, const char *name = nullptr,
2555  const char *desc = nullptr)
2556  : ScalarBase<Average, AvgStor>(parent, name, desc)
2557  {
2558  }
2559 };
2560 
2561 class Value : public ValueBase<Value>
2562 {
2563  public:
2564  Value(Group *parent = nullptr, const char *name = nullptr,
2565  const char *desc = nullptr)
2566  : ValueBase<Value>(parent, name, desc)
2567  {
2568  }
2569 };
2570 
2575 class Vector : public VectorBase<Vector, StatStor>
2576 {
2577  public:
2578  Vector(Group *parent = nullptr, const char *name = nullptr,
2579  const char *desc = nullptr)
2580  : VectorBase<Vector, StatStor>(parent, name, desc)
2581  {
2582  }
2583 };
2584 
2589 class AverageVector : public VectorBase<AverageVector, AvgStor>
2590 {
2591  public:
2592  AverageVector(Group *parent = nullptr, const char *name = nullptr,
2593  const char *desc = nullptr)
2594  : VectorBase<AverageVector, AvgStor>(parent, name, desc)
2595  {
2596  }
2597 };
2598 
2603 class Vector2d : public Vector2dBase<Vector2d, StatStor>
2604 {
2605  public:
2606  Vector2d(Group *parent = nullptr, const char *name = nullptr,
2607  const char *desc = nullptr)
2608  : Vector2dBase<Vector2d, StatStor>(parent, name, desc)
2609  {
2610  }
2611 };
2612 
2617 class Distribution : public DistBase<Distribution, DistStor>
2618 {
2619  public:
2620  Distribution(Group *parent = nullptr, const char *name = nullptr,
2621  const char *desc = nullptr)
2622  : DistBase<Distribution, DistStor>(parent, name, desc)
2623  {
2624  }
2625 
2633  Distribution &
2634  init(Counter min, Counter max, Counter bkt)
2635  {
2636  DistStor::Params *params = new DistStor::Params;
2637  params->min = min;
2638  params->max = max;
2639  params->bucket_size = bkt;
2640  // Division by zero is especially serious in an Aarch64 host,
2641  // where it gets rounded to allocate 32GiB RAM.
2642  assert(bkt > 0);
2643  params->buckets = (size_type)ceil((max - min + 1.0) / bkt);
2644  this->setParams(params);
2645  this->doInit();
2646  return this->self();
2647  }
2648 };
2649 
2654 class Histogram : public DistBase<Histogram, HistStor>
2655 {
2656  public:
2657  Histogram(Group *parent = nullptr, const char *name = nullptr,
2658  const char *desc = nullptr)
2659  : DistBase<Histogram, HistStor>(parent, name, desc)
2660  {
2661  }
2662 
2668  Histogram &
2670  {
2671  HistStor::Params *params = new HistStor::Params;
2672  params->buckets = size;
2673  this->setParams(params);
2674  this->doInit();
2675  return this->self();
2676  }
2677 };
2678 
2683 class StandardDeviation : public DistBase<StandardDeviation, SampleStor>
2684 {
2685  public:
2689  StandardDeviation(Group *parent = nullptr, const char *name = nullptr,
2690  const char *desc = nullptr)
2692  {
2693  SampleStor::Params *params = new SampleStor::Params;
2694  this->doInit();
2695  this->setParams(params);
2696  }
2697 };
2698 
2703 class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor>
2704 {
2705  public:
2709  AverageDeviation(Group *parent = nullptr, const char *name = nullptr,
2710  const char *desc = nullptr)
2712  {
2714  this->doInit();
2715  this->setParams(params);
2716  }
2717 };
2718 
2723 class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor>
2724 {
2725  public:
2726  VectorDistribution(Group *parent = nullptr, const char *name = nullptr,
2727  const char *desc = nullptr)
2729  {
2730  }
2731 
2742  {
2743  DistStor::Params *params = new DistStor::Params;
2744  params->min = min;
2745  params->max = max;
2746  params->bucket_size = bkt;
2747  params->buckets = (size_type)ceil((max - min + 1.0) / bkt);
2748  this->setParams(params);
2749  this->doInit(size);
2750  return this->self();
2751  }
2752 };
2753 
2759  : public VectorDistBase<VectorStandardDeviation, SampleStor>
2760 {
2761  public:
2762  VectorStandardDeviation(Group *parent = nullptr, const char *name = nullptr,
2763  const char *desc = nullptr)
2765  desc)
2766  {
2767  }
2768 
2776  {
2777  SampleStor::Params *params = new SampleStor::Params;
2778  this->doInit(size);
2779  this->setParams(params);
2780  return this->self();
2781  }
2782 };
2783 
2789  : public VectorDistBase<VectorAverageDeviation, AvgSampleStor>
2790 {
2791  public:
2792  VectorAverageDeviation(Group *parent = nullptr, const char *name = nullptr,
2793  const char *desc = nullptr)
2795  desc)
2796  {
2797  }
2798 
2806  {
2808  this->doInit(size);
2809  this->setParams(params);
2810  return this->self();
2811  }
2812 };
2813 
2814 template <class Stat>
2815 class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo>
2816 {
2817  protected:
2818  mutable VResult vec;
2819  mutable VCounter cvec;
2820 
2821  public:
2822  FormulaInfoProxy(Stat &stat) : InfoProxy<Stat, FormulaInfo>(stat) {}
2823 
2824  size_type size() const { return this->s.size(); }
2825 
2826  const VResult &
2827  result() const
2828  {
2829  this->s.result(vec);
2830  return vec;
2831  }
2832  Result total() const { return this->s.total(); }
2833  VCounter &value() const { return cvec; }
2834 
2835  std::string str() const { return this->s.str(); }
2836 };
2837 
2838 template <class Stat>
2839 class SparseHistInfoProxy : public InfoProxy<Stat, SparseHistInfo>
2840 {
2841  public:
2842  SparseHistInfoProxy(Stat &stat) : InfoProxy<Stat, SparseHistInfo>(stat) {}
2843 };
2844 
2849 template <class Derived, class Stor>
2850 class SparseHistBase : public DataWrap<Derived, SparseHistInfoProxy>
2851 {
2852  public:
2854  typedef Stor Storage;
2855  typedef typename Stor::Params Params;
2856 
2857  protected:
2859  char storage[sizeof(Storage)];
2860 
2861  protected:
2866  Storage *
2868  {
2869  return reinterpret_cast<Storage *>(storage);
2870  }
2871 
2876  const Storage *
2877  data() const
2878  {
2879  return reinterpret_cast<const Storage *>(storage);
2880  }
2881 
2882  void
2884  {
2885  new (storage) Storage(this->info());
2886  this->setInit();
2887  }
2888 
2889  public:
2890  SparseHistBase(Group *parent, const char *name, const char *desc)
2891  : DataWrap<Derived, SparseHistInfoProxy>(parent, name, desc)
2892  {
2893  }
2894 
2901  template <typename U>
2902  void sample(const U &v, int n = 1) { data()->sample(v, n); }
2903 
2908  size_type size() const { return data()->size(); }
2913  bool zero() const { return data()->zero(); }
2914 
2915  void
2917  {
2918  Info *info = this->info();
2919  data()->prepare(info, info->data);
2920  }
2921 
2925  void
2927  {
2928  data()->reset(this->info());
2929  }
2930 };
2931 
2936 {
2937  public:
2939  struct Params : public DistParams
2940  {
2942  };
2943 
2944  private:
2949 
2950  public:
2952  {
2953  reset(info);
2954  }
2955 
2961  void
2962  sample(Counter val, int number)
2963  {
2964  cmap[val] += number;
2965  samples += number;
2966  }
2967 
2972  size_type size() const { return cmap.size(); }
2973 
2978  bool
2979  zero() const
2980  {
2981  return samples == Counter();
2982  }
2983 
2984  void
2986  {
2987  MCounter::iterator it;
2988  data.cmap.clear();
2989  for (it = cmap.begin(); it != cmap.end(); it++) {
2990  data.cmap[(*it).first] = (*it).second;
2991  }
2992 
2993  data.samples = samples;
2994  }
2995 
2999  void
3000  reset(Info *info)
3001  {
3002  cmap.clear();
3003  samples = 0;
3004  }
3005 };
3006 
3007 class SparseHistogram : public SparseHistBase<SparseHistogram, SparseHistStor>
3008 {
3009  public:
3010  SparseHistogram(Group *parent = nullptr, const char *name = nullptr,
3011  const char *desc = nullptr)
3013  {
3014  }
3015 
3021  SparseHistogram &
3023  {
3025  this->setParams(params);
3026  this->doInit();
3027  return this->self();
3028  }
3029 };
3030 
3031 class Temp;
3037 class Formula : public DataWrapVec<Formula, FormulaInfoProxy>
3038 {
3039  protected:
3042  friend class Temp;
3043 
3044  public:
3048  Formula(Group *parent = nullptr, const char *name = nullptr,
3049  const char *desc = nullptr);
3050 
3051  Formula(Group *parent, const char *name, const char *desc,
3052  const Temp &r);
3053 
3059  const Formula &operator=(const Temp &r);
3060 
3061  template<typename T>
3062  const Formula &operator=(const T &v)
3063  {
3064  *this = Temp(v);
3065  return *this;
3066  }
3067 
3073  const Formula &operator+=(Temp r);
3074 
3080  const Formula &operator/=(Temp r);
3081 
3089  void result(VResult &vec) const;
3090 
3101  Result total() const;
3102 
3106  size_type size() const;
3107 
3108  void prepare() { }
3109 
3113  void reset();
3114 
3118  bool zero() const;
3119 
3120  std::string str() const;
3121 };
3122 
3123 class FormulaNode : public Node
3124 {
3125  private:
3127  mutable VResult vec;
3128 
3129  public:
3131 
3132  size_type size() const { return formula.size(); }
3133  const VResult &result() const { formula.result(vec); return vec; }
3134  Result total() const { return formula.total(); }
3135 
3136  std::string str() const { return formula.str(); }
3137 };
3138 
3142 class Temp
3143 {
3144  protected:
3149 
3150  public:
3155  Temp(const NodePtr &n) : node(n) { }
3156 
3157  Temp(NodePtr &&n) : node(std::move(n)) { }
3158 
3163  operator NodePtr&() { return node; }
3164 
3168  NodePtr getNodePtr() const { return node; }
3169 
3170  public:
3175  Temp(const Scalar &s)
3176  : node(new ScalarStatNode(s.info()))
3177  { }
3178 
3183  Temp(const Value &s)
3184  : node(new ScalarStatNode(s.info()))
3185  { }
3186 
3191  Temp(const Average &s)
3192  : node(new ScalarStatNode(s.info()))
3193  { }
3194 
3199  Temp(const Vector &s)
3200  : node(new VectorStatNode(s.info()))
3201  { }
3202 
3204  : node(new VectorStatNode(s.info()))
3205  { }
3206 
3210  Temp(const Formula &f)
3211  : node(new FormulaNode(f))
3212  { }
3213 
3218  template <class Stat>
3220  : node(new ScalarProxyNode<Stat>(p))
3221  { }
3222 
3227  Temp(signed char value)
3228  : node(new ConstNode<signed char>(value))
3229  { }
3230 
3235  Temp(unsigned char value)
3236  : node(new ConstNode<unsigned char>(value))
3237  { }
3238 
3243  Temp(signed short value)
3244  : node(new ConstNode<signed short>(value))
3245  { }
3246 
3251  Temp(unsigned short value)
3252  : node(new ConstNode<unsigned short>(value))
3253  { }
3254 
3259  Temp(signed int value)
3260  : node(new ConstNode<signed int>(value))
3261  { }
3262 
3267  Temp(unsigned int value)
3268  : node(new ConstNode<unsigned int>(value))
3269  { }
3270 
3275  Temp(signed long value)
3276  : node(new ConstNode<signed long>(value))
3277  { }
3278 
3283  Temp(unsigned long value)
3284  : node(new ConstNode<unsigned long>(value))
3285  { }
3286 
3291  Temp(signed long long value)
3292  : node(new ConstNode<signed long long>(value))
3293  { }
3294 
3299  Temp(unsigned long long value)
3300  : node(new ConstNode<unsigned long long>(value))
3301  { }
3302 
3307  Temp(float value)
3308  : node(new ConstNode<float>(value))
3309  { }
3310 
3315  Temp(double value)
3316  : node(new ConstNode<double>(value))
3317  { }
3318 };
3319 
3320 
3325 inline Temp
3327 {
3328  return Temp(std::make_shared<BinaryNode<std::plus<Result> > >(l, r));
3329 }
3330 
3331 inline Temp
3333 {
3334  return Temp(std::make_shared<BinaryNode<std::minus<Result> > >(l, r));
3335 }
3336 
3337 inline Temp
3339 {
3340  return Temp(std::make_shared<BinaryNode<std::multiplies<Result> > >(l, r));
3341 }
3342 
3343 inline Temp
3345 {
3346  return Temp(std::make_shared<BinaryNode<std::divides<Result> > >(l, r));
3347 }
3348 
3349 inline Temp
3351 {
3352  return Temp(std::make_shared<UnaryNode<std::negate<Result> > >(l));
3353 }
3354 
3355 template <typename T>
3356 inline Temp
3358 {
3359  return Temp(std::make_shared<ConstNode<T> >(val));
3360 }
3361 
3362 template <typename T>
3363 inline Temp
3365 {
3366  return Temp(std::make_shared<ConstVectorNode<T> >(val));
3367 }
3368 
3369 inline Temp
3371 {
3372  return Temp(std::make_shared<SumNode<std::plus<Result> > >(val));
3373 }
3374 
3376 void dump();
3377 void reset();
3378 void enable();
3379 bool enabled();
3380 const Info* resolve(const std::string &name);
3381 
3387 typedef void (*Handler)();
3388 
3389 void registerHandlers(Handler reset_handler, Handler dump_handler);
3390 
3395 void registerResetCallback(const std::function<void()> &callback);
3396 
3401 void registerDumpCallback(const std::function<void()> &callback);
3402 
3406 void processResetQueue();
3407 
3411 void processDumpQueue();
3412 
3414 
3415 typedef std::map<const void *, Info *> MapType;
3416 MapType &statsMap();
3417 
3418 typedef std::map<std::string, Info *> NameMapType;
3419 NameMapType &nameMap();
3420 
3421 bool validateStatName(const std::string &name);
3422 
3423 } // namespace Stats
3424 
3425 void debugDumpStats();
3426 
3427 #endif // __BASE_STATISTICS_HH__
Stats::FormulaNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:3134
Stats::AvgStor::last
Tick last
The tick that current last changed.
Definition: statistics.hh:564
Stats::AvgStor::AvgStor
AvgStor(Info *info)
Build and initializes this stat storage.
Definition: statistics.hh:573
Stats::ScalarProxy::ScalarProxy
ScalarProxy(Stat &s, off_type i)
Create and initialize this proxy, do not register it with the database.
Definition: statistics.hh:955
Stats::ScalarBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:681
Stats::ScalarBase::value
Counter value()
Definition: statistics.hh:756
Stats::MethodProxy::MethodPointer
V(T::* MethodPointer)() const
Definition: statistics.hh:837
Stats::VectorBase::Storage
Stor Storage
Definition: statistics.hh:1057
Stats::MethodProxy::total
Result total() const
Definition: statistics.hh:844
Stats::ScalarProxy::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:987
Stats::OpString< std::minus< Result > >::str
static std::string str()
Definition: statistics.hh:2297
Stats::Vector2dBase::size
size_type size() const
Definition: statistics.hh:1348
Stats::ScalarBase::result
Result result()
Definition: statistics.hh:758
Stats::ValueBase::ValueBase
ValueBase(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:854
Stats::ValueBase::result
Result result() const
Definition: statistics.hh:906
types.hh
Stats::SampleStor::Params::Params
Params()
Definition: statistics.hh:1723
Stats::Temp::Temp
Temp(unsigned short value)
Create a ConstNode.
Definition: statistics.hh:3251
Stats::UnaryNode::l
NodePtr l
Definition: statistics.hh:2328
Stats::ValueBase::scalar
Derived & scalar(T &value)
Definition: statistics.hh:864
Stats::FormulaInfoProxy::vec
VResult vec
Definition: statistics.hh:2818
Stats::Vector2dBase::x
size_type x
Definition: statistics.hh:1287
Stats::Deviation
@ Deviation
Definition: info.hh:173
Stats::Formula::operator+=
const Formula & operator+=(Temp r)
Add the given tree to the existing one.
Definition: statistics.cc:443
Stats::ValueBase::zero
bool zero() const
Definition: statistics.hh:911
Stats::VectorStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2230
Stats::ScalarInfoProxy::result
Result result() const
Definition: statistics.hh:118
Stats::MethodProxy::object
T * object
Definition: statistics.hh:836
Stats::ValueBase::method
Derived & method(T *obj, V(T::*method)() const)
Extended functor that calls the specified method of the provided object.
Definition: statistics.hh:898
Stats::FormulaInfoProxy::FormulaInfoProxy
FormulaInfoProxy(Stat &stat)
Definition: statistics.hh:2822
Stats::OpString< std::divides< Result > >::str
static std::string str()
Definition: statistics.hh:2309
Stats::VectorBase::doInit
void doInit(size_type s)
Definition: statistics.hh:1086
Stats::SampleStor::SampleStor
SampleStor(Info *info)
Create and initialize this storage.
Definition: statistics.hh:1738
Stats::AvgStor::reset
void reset(Info *info)
Reset stat value to default.
Definition: statistics.hh:638
Stats::InfoProxy::prepare
void prepare()
Definition: statistics.hh:101
Stats::AvgStor::dec
void dec(Counter val)
Deccrement the current count by the provided value, calls set.
Definition: statistics.hh:600
Stats::SumNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2493
Stats::VectorStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2231
Stats::SparseHistInfoProxy
Definition: statistics.hh:2839
Stats::Vector2dBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:1339
Stats::ScalarBase::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:722
Stats::ValueProxy::scalar
T * scalar
Definition: statistics.hh:785
Stats::ConstVectorNode::str
std::string str() const
Definition: statistics.hh:2274
Stats::processResetQueue
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
Definition: statistics.cc:525
Stats::ValueProxy::value
Counter value() const
Definition: statistics.hh:789
Stats::SampleStor::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:1767
Stats::DistBase::__attribute__
char storage[sizeof(Storage)] __attribute__((aligned(8)))
The storage for this stat.
Stats::VectorProxy::operator=
const VectorProxy & operator=(const VectorProxy &sp)
Definition: statistics.hh:1255
Stats::UnaryNode::UnaryNode
UnaryNode(NodePtr &p)
Definition: statistics.hh:2332
Stats::DistInfoProxy
Definition: statistics.hh:152
data
const char data[]
Definition: circlebuf.test.cc:42
Stats::AvgStor::prepare
void prepare(Info *info)
Prepare stat data for dumping or serialization.
Definition: statistics.hh:628
Stats::AvgStor::Params
Definition: statistics.hh:567
Stats::VectorInfo
Definition: info.hh:156
Stats::operator+
Temp operator+(Temp l, Temp r)
Definition: statistics.hh:3326
Stats::SparseHistData
Data structure of sparse histogram.
Definition: info.hh:244
MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:44
Stats::DistParams
The parameters for a distribution stat.
Definition: statistics.hh:1411
Stats::VectorDistInfoProxy::size
size_type size() const
Definition: statistics.hh:164
Stats::DistStor::Params::min
Counter min
The minimum value to track.
Definition: statistics.hh:1427
Stats::ScalarProxy::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:1006
Stats::VectorDistBase::~VectorDistBase
~VectorDistBase()
Definition: statistics.hh:2014
Stats::SparseHistStor::Params::Params
Params()
Definition: statistics.hh:2941
Stats::VectorProxy::offset
off_type offset
Definition: statistics.hh:1202
Stats::ScalarStatNode
Definition: statistics.hh:2156
group.hh
Stats::AvgStor
Templatized storage and interface to a per-tick average stat.
Definition: statistics.hh:554
Stats::HistStor::cvec
VCounter cvec
Counter for each bucket.
Definition: statistics.hh:1600
Stats::VectorBase::Params
Stor::Params Params
Definition: statistics.hh:1058
Stats::BinaryNode::total
Result total() const override
Return the total of the result vector.
Definition: statistics.hh:2413
Stats::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:3010
Stats::HistStor::Params::Params
Params()
Definition: statistics.hh:1580
Stats::off_type
unsigned int off_type
Definition: types.hh:55
Stats::DistProxy::data
const Stat::Storage * data() const
Definition: statistics.hh:2071
Stats::SparseHistBase::prepare
void prepare()
Definition: statistics.hh:2916
Stats::Vector2dBase::storage
Storage * storage
Definition: statistics.hh:1290
Stats::DataWrap::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:226
Stats::AvgStor::lastReset
Tick lastReset
The tick of the last reset.
Definition: statistics.hh:560
Stats::ConstVectorNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2263
Stats::FunctorProxy::value
Counter value() const
Definition: statistics.hh:802
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
Stats::Histogram::Histogram
Histogram(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2657
Stats::HistStor
Templatized storage and interface for a histogram stat.
Definition: statistics.hh:1571
Stats::enable
void enable()
Definition: statistics.cc:551
Stats::DistProxy::DistProxy
DistProxy(Stat &s, off_type i)
Definition: statistics.hh:2074
Stats::HistStor::add
void add(HistStor *)
Definition: statistics.cc:397
Stats::VectorProxy::total
Result total() const
Definition: statistics.hh:1235
Stats::Temp::getNodePtr
NodePtr getNodePtr() const
Makde gcc < 4.6.3 happy and explicitly get the underlying node.
Definition: statistics.hh:3168
Stats::HistStor::Params::buckets
size_type buckets
The number of buckets.
Definition: statistics.hh:1578
Stats::FormulaNode::str
std::string str() const
Definition: statistics.hh:3136
Stats::SumNode::vresult
VResult vresult
Definition: statistics.hh:2471
Stats::FunctorProxy::total
Result total() const
Definition: statistics.hh:804
Stats::DistParams::DistParams
DistParams(DistType t)
Definition: statistics.hh:1414
Stats::DataWrapVec::reset
void reset()
Definition: statistics.hh:422
Stats::Temp::Temp
Temp(unsigned int value)
Create a ConstNode.
Definition: statistics.hh:3267
Stats::ScalarInfoProxy::ScalarInfoProxy
ScalarInfoProxy(Stat &stat)
Definition: statistics.hh:115
Stats::AvgStor::result
Result result() const
Return the current average.
Definition: statistics.hh:613
Stats::DataWrapVec::prepare
void prepare()
Definition: statistics.hh:411
Stats::ScalarBase::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:754
Stats::DataWrapVec::DataWrapVec
DataWrapVec(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:358
Stats::Formula::str
std::string str() const
Definition: statistics.cc:506
Stats::VectorAverageDeviation::init
VectorAverageDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2805
Flags< FlagsType >
Stats::ValueProxy::ValueProxy
ValueProxy(T &val)
Definition: statistics.hh:788
Stats::ScalarBase::doInit
void doInit()
Definition: statistics.hh:687
Stats::DistStor::size
size_type size() const
Return the number of buckets in this distribution.
Definition: statistics.hh:1505
Stats::SampleStor::reset
void reset(Info *info)
Reset stat value to default.
Definition: statistics.hh:1785
Stats::VectorBase
Implementation of a vector of stats.
Definition: statistics.hh:1054
Stats::Temp::Temp
Temp(double value)
Create a ConstNode.
Definition: statistics.hh:3315
Stats::DistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:1899
Stats::ScalarProxyNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2208
Stats::ProxyInfo::prepare
void prepare()
Prepare the stat for dumping.
Definition: statistics.hh:774
Stats::ValueBase::str
std::string str() const
Definition: statistics.hh:910
Stats::OpString
Definition: statistics.hh:2286
Stats::NameMapType
std::map< std::string, Info * > NameMapType
Definition: statistics.hh:3418
Stats::ScalarBase
Implementation of a scalar stat.
Definition: statistics.hh:652
Stats::Vector2dInfo
Definition: info.hh:218
Stats::registerDumpCallback
void registerDumpCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are about to be dumped.
Definition: statistics.cc:589
Stats::DistProxy::stat
Stat & stat
Definition: statistics.hh:2066
Stats::DistStor::min_val
Counter min_val
The smallest value sampled.
Definition: statistics.hh:1448
Stats::SampleStor::size
size_type size() const
Return the number of entries in this stat, 1.
Definition: statistics.hh:1761
Stats::VectorDistBase::Proxy
DistProxy< Derived > Proxy
Definition: statistics.hh:1970
Stats::Value::Value
Value(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2564
Stats::Vector2dInfoProxy::total
Result total() const
Definition: statistics.hh:173
Stats::InfoAccess::_info
Info * _info
Definition: statistics.hh:184
Stats::FormulaNode::formula
const Formula & formula
Definition: statistics.hh:3126
sc_dt::to_string
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:91
type
uint8_t type
Definition: inet.hh:421
Stats::DataWrap
Definition: statistics.hh:223
Stats::HistStor::Params
The parameters for a distribution stat.
Definition: statistics.hh:1575
Stats::Temp::Temp
Temp(float value)
Create a ConstNode.
Definition: statistics.hh:3307
Stats::FormulaInfoProxy::value
VCounter & value() const
Definition: statistics.hh:2833
Stats::HistStor::max_bucket
Counter max_bucket
The maximum value to track.
Definition: statistics.hh:1587
Stats::BinaryNode::size
size_type size() const override
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2445
Stats::ScalarProxy::operator=
const ScalarProxy & operator=(const ScalarProxy &sp)
Set this proxy equal to the provided one.
Definition: statistics.hh:974
Stats::VectorDistBase::Params
Stor::Params Params
Definition: statistics.hh:1969
Stats::DataWrap::DataWrap
DataWrap(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:251
Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::value
Counter value() const
Definition: statistics.hh:823
Stats::AvgSampleStor::Params
Definition: statistics.hh:1800
Stats::DataWrapVec2d::ysubname
Derived & ysubname(off_type index, const std::string &subname)
Definition: statistics.hh:461
Stats::ValueBase::functor
Derived & functor(const T &func)
Definition: statistics.hh:873
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
Stats::Temp::Temp
Temp(const NodePtr &n)
Copy the given pointer to this class.
Definition: statistics.hh:3155
Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::functor
std::function< Result()> functor
Definition: statistics.hh:819
Stats::Formula::reset
void reset()
Formulas don't need to be reset.
Definition: statistics.cc:490
Stats::ScalarProxy::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:1039
Stats::SparseHistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:2908
Stats::ProxyInfo::visit
void visit(Output &visitor)
Visitor entry for outputing statistics data.
Definition: statistics.hh:778
cast.hh
Stats::DistType
DistType
Definition: info.hh:173
Stats::VectorProxy::size
size_type size() const
Definition: statistics.hh:1270
Stats::DistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:1930
Stats::SparseHistBase
Implementation of a sparse histogram stat.
Definition: statistics.hh:2850
Stats::Vector2dInfo::cvec
VCounter cvec
Local storage for the entry values, used for printing.
Definition: info.hh:230
Stats::ScalarBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:669
Stats::DistStor::prepare
void prepare(Info *info, DistData &data)
Definition: statistics.hh:1518
Stats::VectorStatNode
Definition: statistics.hh:2223
X86ISA::op
Bitfield< 4 > op
Definition: types.hh:78
Stats::VectorInfoProxy::result
const VResult & result() const
Definition: statistics.hh:142
Stats::ScalarProxyNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2202
Stats::SampleStor::Params
Definition: statistics.hh:1721
Stats::ScalarProxy
A proxy class to access the stat at a given index in a VectorBase stat.
Definition: statistics.hh:928
Stats::ScalarBase::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:748
Stats::VectorProxy::vec
VResult vec
Definition: statistics.hh:1206
Stats::DistStor::samples
Counter samples
The number of samples.
Definition: statistics.hh:1460
Stats::Hist
@ Hist
Definition: info.hh:173
Stats::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:224
std::vector< Counter >
Stats::AvgSampleStor::AvgSampleStor
AvgSampleStor(Info *info)
Create and initialize this storage.
Definition: statistics.hh:1815
Stats::InfoProxy
Definition: statistics.hh:92
Stats::AvgStor::zero
bool zero() const
Definition: statistics.hh:622
Stats::SumNode::str
std::string str() const
Definition: statistics.hh:2511
Stats::VectorBase::operator[]
Proxy operator[](off_type index)
Return a reference (ScalarProxy) to the stat at the given index.
Definition: statistics.hh:1190
Stats::InfoProxy::check
bool check() const
Definition: statistics.hh:100
Stats::InfoProxy::visit
void visit(Output &visitor)
Definition: statistics.hh:104
Stats::VectorInfoProxy::size
size_type size() const
Definition: statistics.hh:132
Stats::VectorBase::data
Storage * data(off_type index)
Retrieve the storage.
Definition: statistics.hh:1076
Stats::SparseHistStor::samples
Counter samples
Counter for number of samples.
Definition: statistics.hh:2946
Stats::Temp::Temp
Temp(signed char value)
Create a ConstNode.
Definition: statistics.hh:3227
Stats::AverageDeviation
Calculates the per tick mean and variance of the samples.
Definition: statistics.hh:2703
Stats::Value
Definition: statistics.hh:2561
Stats::BinaryNode::str
std::string str() const override
Definition: statistics.hh:2460
Stats::VectorDistBase::Info
VectorDistInfoProxy< Derived > Info
Definition: statistics.hh:1967
Stats::statsMap
MapType & statsMap()
Definition: statistics.cc:74
Stats::VectorBase::zero
bool zero() const
Definition: statistics.hh:1141
Stats::VectorDistBase::doInit
void doInit(size_type s)
Definition: statistics.hh:1992
Stats::Temp::Temp
Temp(signed long long value)
Create a ConstNode.
Definition: statistics.hh:3291
Stats::MCounter
std::map< Counter, int > MCounter
map of counters
Definition: types.hh:45
Stats::UnaryNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2335
Stats::DistStor::Params::max
Counter max
The maximum value to track.
Definition: statistics.hh:1429
Stats::AvgStor::value
Counter value() const
Return the current count.
Definition: statistics.hh:606
Stats::DistStor::min_track
Counter min_track
The minimum value to track.
Definition: statistics.hh:1441
Stats::reset
void reset()
Definition: statistics.cc:569
Stats::AvgSampleStor::sum
Counter sum
Current total.
Definition: statistics.hh:1807
Stats::UnaryNode::vresult
VResult vresult
Definition: statistics.hh:2329
Stats::display
const FlagsType display
Print this stat.
Definition: info.hh:47
Stats::VectorBase::data
const Storage * data(off_type index) const
Retrieve a const pointer to the storage.
Definition: statistics.hh:1083
Stats::Vector2dBase::check
bool check() const
Definition: statistics.hh:1399
Stats::SampleStor::squares
Counter squares
The sum of squares.
Definition: statistics.hh:1730
Stats::StatStor::Params
Definition: statistics.hh:496
Stats::Node
Base class for formula statistic node.
Definition: statistics.hh:2126
Stats::Vector
A vector of scalar stats.
Definition: statistics.hh:2575
Stats::VectorProxy::VectorProxy
VectorProxy(const VectorProxy &sp)
Definition: statistics.hh:1249
Stats::ScalarProxy::result
Result result() const
Return the current value of this statas a result type.
Definition: statistics.hh:948
Stats::VectorAverageDeviation
This is a vector of AverageDeviation stats.
Definition: statistics.hh:2788
Stats::VectorDistribution
A vector of distributions.
Definition: statistics.hh:2723
Stats::OpString< std::multiplies< Result > >::str
static std::string str()
Definition: statistics.hh:2303
Stats::Formula::Temp
friend class Temp
Definition: statistics.hh:3042
Stats::ScalarInfo::result
virtual Result result() const =0
Stats::Dist
@ Dist
Definition: info.hh:173
Stats::VectorDistBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:2024
Stats::HistStor::logs
Counter logs
The sum of logarithm of each sample, used to compute geometric mean.
Definition: statistics.hh:1594
Stats::DistStor
Templatized storage and interface for a distribution stat.
Definition: statistics.hh:1420
Stats::UnaryNode::str
std::string str() const
Definition: statistics.hh:2363
Stats::VectorBase::storage
Storage * storage
The storage of this stat.
Definition: statistics.hh:1067
Stats::Formula::operator=
const Formula & operator=(const Temp &r)
Set an unitialized Formula to the given root.
Definition: statistics.cc:433
Stats::ConstNode::ConstNode
ConstNode(T s)
Definition: statistics.hh:2245
Stats::SampleStor::prepare
void prepare(Info *info, DistData &data)
Definition: statistics.hh:1770
Stats::ScalarBase::Storage
Stor Storage
Definition: statistics.hh:655
Stats::VectorStatNode::VectorStatNode
VectorStatNode(const VectorInfo *d)
Definition: statistics.hh:2229
Stats::ScalarProxy::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:942
Stats::Temp::Temp
Temp(const Scalar &s)
Create a new ScalarStatNode.
Definition: statistics.hh:3175
Stats::Formula::zero
bool zero() const
Definition: statistics.cc:495
Stats::ScalarProxy::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:995
Stats::Temp::node
NodePtr node
Pointer to a Node object.
Definition: statistics.hh:3148
Stats::BinaryNode
Definition: statistics.hh:2370
Stats::HistStor::min_bucket
Counter min_bucket
The minimum value to track.
Definition: statistics.hh:1585
Stats::DataWrap::flags
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:331
Stats::Histogram
A simple histogram stat.
Definition: statistics.hh:2654
Stats::StorageParams
Definition: statistics.hh:176
Stats::Node::total
virtual Result total() const =0
Return the total of the result vector.
Stats::Info::storageParams
const StorageParams * storageParams
Definition: info.hh:92
Stats::HistStor::squares
Counter squares
The sum of squares.
Definition: statistics.hh:1596
Stats::ScalarStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2172
Stats::DataWrapVec2d::ysubnames
Derived & ysubnames(const char **names)
Definition: statistics.hh:449
Stats::ScalarInfo::total
virtual Result total() const =0
str.hh
Stats::DistBase::DistBase
DistBase(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:1912
Stats::Formula::total
Result total() const
Return the total Formula result.
Definition: statistics.cc:475
Stats::AvgSampleStor::reset
void reset(Info *info)
Reset stat value to default.
Definition: statistics.hh:1860
Stats::DistStor::bucket_size
Counter bucket_size
The number of entries in each bucket.
Definition: statistics.hh:1445
Stats::VectorDistInfo
Definition: info.hh:200
Stats::SumNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2508
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
ArmISA::n
Bitfield< 31 > n
Definition: miscregs_types.hh:450
Stats::StatStor::StatStor
StatStor(Info *info)
Builds this storage element and calls the base constructor of the datatype.
Definition: statistics.hh:503
Stats::InfoProxy::zero
bool zero() const
Definition: statistics.hh:108
Stats::InfoAccess
Definition: statistics.hh:181
Stats::DistBase::doInit
void doInit()
Definition: statistics.hh:1905
Stats::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2689
Stats::SampleStor::samples
Counter samples
The number of samples.
Definition: statistics.hh:1732
Stats::VectorProxy::operator[]
ScalarProxy< Stat > operator[](off_type index)
Definition: statistics.hh:1264
Stats::VectorProxy::data
const Stat::Storage * data(off_type index) const
Definition: statistics.hh:1216
Stats::DistStor::Params
The parameters for a distribution stat.
Definition: statistics.hh:1424
info.hh
Stats::BinaryNode::l
NodePtr l
Definition: statistics.hh:2373
Stats::DistProxy::size
size_type size() const
Definition: statistics.hh:2099
Stats::DistData
Definition: info.hh:175
Stats::DistInfo
Definition: info.hh:193
Stats::Vector2dBase::~Vector2dBase
~Vector2dBase()
Definition: statistics.hh:1302
Stats::VectorInfoProxy::value
VCounter & value() const
Definition: statistics.hh:135
Stats::ScalarInfo::value
virtual Counter value() const =0
Stats::ValueBase
Definition: statistics.hh:848
Stats::ScalarInfoProxy
Definition: statistics.hh:112
Stats::Temp
Helper class to construct formula node trees.
Definition: statistics.hh:3142
Stats::DistStor::sample
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Definition: statistics.hh:1477
Stats::SparseHistStor::cmap
MCounter cmap
Counter for each bucket.
Definition: statistics.hh:2948
Stats::enabled
bool enabled()
Definition: statistics.cc:545
Stats::DistStor::Params::Params
Params()
Definition: statistics.hh:1435
Stats::Node::result
virtual const VResult & result() const =0
Return the result vector of this subtree.
Stats::InfoProxy::reset
void reset()
Definition: statistics.hh:102
Stats::DistStor::squares
Counter squares
The sum of squares.
Definition: statistics.hh:1458
Stats::FormulaInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:2819
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
Stats::DistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:1889
Stats::ScalarBase::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:698
Stats::validateStatName
bool validateStatName(const string &name)
Definition: statistics.cc:172
Stats::nameMap
NameMapType & nameMap()
Definition: statistics.cc:149
Stats::Temp::Temp
Temp(const AverageVector &s)
Definition: statistics.hh:3203
Stats::DataWrap::prereq
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
Definition: statistics.hh:345
Stats::VectorDistInfoProxy::VectorDistInfoProxy
VectorDistInfoProxy(Stat &stat)
Definition: statistics.hh:162
Stats::DataWrapVec
Definition: statistics.hh:353
Stats::Vector2dBase::Params
Stor::Params Params
Definition: statistics.hh:1279
Stats::InfoAccess::setInfo
void setInfo(Group *parent, Info *info)
Set up an info class for this statistic.
Definition: statistics.cc:81
Stats::ScalarBase::__attribute__
char storage[sizeof(Storage)] __attribute__((aligned(8)))
The storage of this stat.
Stats::ScalarStatNode::ScalarStatNode
ScalarStatNode(const ScalarInfo *d)
Definition: statistics.hh:2163
Stats::Temp::Temp
Temp(const ScalarProxy< Stat > &p)
Create a new ScalarProxyNode.
Definition: statistics.hh:3219
Stats::StatStor::zero
bool zero() const
Definition: statistics.hh:544
Stats::VectorDistBase::prepare
void prepare()
Definition: statistics.hh:2046
Stats::VectorDistBase::zero
bool zero() const
Definition: statistics.hh:2037
Stats::Handler
void(* Handler)()
Register reset and dump handlers.
Definition: statistics.hh:3387
Stats::resolve
const Info * resolve(const std::string &name)
Definition: statistics.cc:578
Stats::AvgSampleStor::prepare
void prepare(Info *info, DistData &data)
Definition: statistics.hh:1845
Stats::SparseHistBase::doInit
void doInit()
Definition: statistics.hh:2883
Stats::SparseHistBase::Params
Stor::Params Params
Definition: statistics.hh:2855
Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::FunctorProxy
FunctorProxy(const T &func)
Definition: statistics.hh:822
Stats::FormulaNode::FormulaNode
FormulaNode(const Formula &f)
Definition: statistics.hh:3130
Stats::ScalarProxy::stat
Stat & stat
Pointer to the parent Vector.
Definition: statistics.hh:932
Stats::HistStor::zero
bool zero() const
Returns true if any calls to sample have been made.
Definition: statistics.hh:1662
Stats::sum
Temp sum(Temp val)
Definition: statistics.hh:3370
ArmISA::d
Bitfield< 9 > d
Definition: miscregs_types.hh:60
Stats::registerResetCallback
void registerResetCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are reset.
Definition: statistics.cc:537
Stats::ScalarProxy::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:997
Stats::Formula::root
NodePtr root
The root of the tree which represents the Formula.
Definition: statistics.hh:3041
Stats::DistProxy::data
Stat::Storage * data()
Definition: statistics.hh:2070
Stats::ValueProxy::total
Result total() const
Definition: statistics.hh:791
Stats::ProxyInfo::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:775
Stats::ConstVectorNode::vresult
VResult vresult
Definition: statistics.hh:2256
Stats::VectorInfo::total
virtual Result total() const =0
Stats::MethodProxy::value
Counter value() const
Definition: statistics.hh:842
Stats::DataWrap::setSeparator
const std::string & setSeparator() const
Definition: statistics.hh:295
Stats::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2792
Stats::Vector2dBase::data
Storage * data(off_type index)
Definition: statistics.hh:1293
Stats::DistStor::max_track
Counter max_track
The maximum value to track.
Definition: statistics.hh:1443
Stats::DataWrap::operator=
DataWrap & operator=(const DataWrap &)=delete
MipsISA::r
r
Definition: pra_constants.hh:95
Stats::ValueBase::reset
void reset()
Definition: statistics.hh:914
Stats::Temp::Temp
Temp(signed long value)
Create a ConstNode.
Definition: statistics.hh:3275
Stats::DistProxy::zero
bool zero() const
Definition: statistics.hh:2105
Stats::AvgSampleStor::squares
Counter squares
Current sum of squares.
Definition: statistics.hh:1809
Stats::Vector2dInfoProxy
Definition: statistics.hh:168
Stats::ConstNode::vresult
VResult vresult
Definition: statistics.hh:2242
Stats::SparseHistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:2913
Stats::DistBase::prepare
void prepare()
Definition: statistics.hh:1938
Stats::ConstVectorNode::ConstVectorNode
ConstVectorNode(const T &s)
Definition: statistics.hh:2259
Stats::HistStor::sum
Counter sum
The current sum.
Definition: statistics.hh:1592
Stats::SumNode::SumNode
SumNode(NodePtr &p)
Definition: statistics.hh:2474
Stats::SparseHistStor
Templatized storage and interface for a sparse histogram stat.
Definition: statistics.hh:2935
Stats::VectorInfoProxy::total
Result total() const
Definition: statistics.hh:148
Stats::SumNode
Definition: statistics.hh:2467
Stats::InfoAccess::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:206
Stats::operator-
Temp operator-(Temp l, Temp r)
Definition: statistics.hh:3332
Stats::ScalarProxyNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2195
Stats::InfoAccess::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:219
Stats::VectorInfo::result
virtual const VResult & result() const =0
Stats::SparseHistBase::SparseHistBase
SparseHistBase(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:2890
Stats::HistStor::HistStor
HistStor(Info *info)
Definition: statistics.hh:1603
Stats::DistStor::reset
void reset(Info *info)
Reset stat value to default.
Definition: statistics.hh:1546
Stats::BinaryNode::result
const VResult & result() const override
Return the result vector of this subtree.
Definition: statistics.hh:2381
Stats::Node::str
virtual std::string str() const =0
Stats::ScalarBase::ScalarBase
ScalarBase(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:701
Stats::VectorProxy::VectorProxy
VectorProxy(Stat &s, off_type o, size_type l)
Definition: statistics.hh:1244
Stats::Formula::Formula
Formula(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Create and initialize thie formula, and register it with the database.
Definition: statistics.cc:417
Stats::Node::~Node
virtual ~Node()
Definition: statistics.hh:2150
Stats::ScalarBase::prepare
void prepare()
Definition: statistics.hh:765
Stats::DataWrapVec::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:356
Stats::DataWrapVec::subdesc
Derived & subdesc(off_type index, const std::string &desc)
Set the subfield description for the given index and marks this stat to print at the end of simulatio...
Definition: statistics.hh:398
cprintf.hh
Stats::Vector2dBase::Info
Vector2dInfoProxy< Derived > Info
Definition: statistics.hh:1277
Stats::ScalarBase::Params
Stor::Params Params
Definition: statistics.hh:656
Stats::Vector2d::Vector2d
Vector2d(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2606
Stats::VectorBase::result
void result(VResult &vec) const
Copy the values to a local vector and return a reference to it.
Definition: statistics.hh:1115
Stats::DistStor::cvec
VCounter cvec
Counter for each bucket.
Definition: statistics.hh:1462
Stats::FunctorProxy::functor
T * functor
Definition: statistics.hh:798
Stats::Vector2dInfo::x
size_type x
Definition: info.hh:226
Stats::SparseHistBase::Info
SparseHistInfoProxy< Derived > Info
Definition: statistics.hh:2853
Stats::BinaryNode::r
NodePtr r
Definition: statistics.hh:2374
Stats::SparseHistStor::Params
The parameters for a sparse histogram stat.
Definition: statistics.hh:2939
Stats::ScalarBase::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:714
Stats::StandardDeviation
Calculates the mean and variance of all the samples.
Definition: statistics.hh:2683
Stats::MethodProxy
A proxy similar to the FunctorProxy, but allows calling a method of a bound object,...
Definition: statistics.hh:833
Stats::SparseHistInfo
Definition: info.hh:251
Stats::InfoAccess::info
Info * info()
Grab the information class for this statistic.
Definition: statistics.cc:117
Stats::AvgSampleStor
Templatized storage for distribution that calculates per tick mean and variance.
Definition: statistics.hh:1797
Stats::Temp::Temp
Temp(const Vector &s)
Create a new VectorStatNode.
Definition: statistics.hh:3199
Stats::BinaryNode::BinaryNode
BinaryNode(NodePtr &a, NodePtr &b)
Definition: statistics.hh:2378
Stats::OpString< std::plus< Result > >::str
static std::string str()
Definition: statistics.hh:2291
Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::result
Result result() const
Definition: statistics.hh:824
Stats::VectorDistBase::storage
Storage * storage
Definition: statistics.hh:1975
Stats::DataWrap::setSeparator
Derived & setSeparator(const std::string &_sep)
Set the character(s) used between the name and vector number on vectors, dist, etc.
Definition: statistics.hh:290
Stats::statsList
list< Info * > & statsList()
Definition: statistics.cc:67
Stats::AvgStor::current
Counter current
The current count.
Definition: statistics.hh:558
Stats::VectorDistBase::Storage
Stor Storage
Definition: statistics.hh:1968
Stats::DistStor::DistStor
DistStor(Info *info)
Definition: statistics.hh:1465
Stats::AvgSampleStor::size
size_type size() const
Return the number of entries, in this case 1.
Definition: statistics.hh:1836
Stats::Output
Definition: output.hh:58
Stats::HistStor::grow_up
void grow_up()
Definition: statistics.cc:375
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
Stats::ScalarInfoProxy::total
Result total() const
Definition: statistics.hh:119
Stats::SparseHistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:2867
Stats::SampleStor
Templatized storage and interface for a distribution that calculates mean and variance.
Definition: statistics.hh:1718
ArmISA::sp
Bitfield< 0 > sp
Definition: miscregs_types.hh:71
Stats::Vector2dBase::Proxy
VectorProxy< Derived > Proxy
Definition: statistics.hh:1280
Stats::OpString< std::negate< Result > >::str
static std::string str()
Definition: statistics.hh:2321
Stats::VectorStandardDeviation::init
VectorStandardDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2775
Stats::ValueBase::value
Counter value()
Definition: statistics.hh:905
Stats::DistStor::max_val
Counter max_val
The largest value sampled.
Definition: statistics.hh:1450
Stats::VectorInfo::size
virtual size_type size() const =0
Stats::VectorDistInfo::data
std::vector< DistData > data
Definition: info.hh:203
Stats::Distribution
A simple distribution stat.
Definition: statistics.hh:2617
Stats::DataWrap::name
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Definition: statistics.hh:274
Stats::constantVector
Temp constantVector(T val)
Definition: statistics.hh:3364
Stats::ScalarInfoProxy::value
Counter value() const
Definition: statistics.hh:117
Stats::DataWrap::DataWrap
DataWrap()=delete
name
const std::string & name()
Definition: trace.cc:50
Stats::Formula::operator=
const Formula & operator=(const T &v)
Definition: statistics.hh:3062
Stats::VectorBase::init
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1177
Stats::DistInfoProxy::DistInfoProxy
DistInfoProxy(Stat &stat)
Definition: statistics.hh:155
Stats::StatStor::dec
void dec(Counter val)
Decrement the stat by the given value.
Definition: statistics.hh:521
Stats::ScalarStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2166
Stats::HistStor::grow_convert
void grow_convert()
Definition: statistics.cc:353
Stats::Vector2dBase
Definition: statistics.hh:1274
Stats::VectorInfoProxy::rvec
VResult rvec
Definition: statistics.hh:127
Stats::SparseHistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:2877
Stats::DistParams::type
const DistType type
Definition: statistics.hh:1413
Stats::DataWrapVec2d::ysubname
std::string ysubname(off_type i) const
Definition: statistics.hh:473
Stats::StatStor::reset
void reset(Info *info)
Reset stat value to default.
Definition: statistics.hh:539
Stats::SparseHistStor::SparseHistStor
SparseHistStor(Info *info)
Definition: statistics.hh:2951
Stats::DataWrap::info
const Info * info() const
Definition: statistics.hh:240
Stats::VectorDistBase::check
bool check() const
Definition: statistics.hh:2056
Stats::Node::size
virtual size_type size() const =0
Return the number of nodes in the subtree starting at this node.
Stats::ScalarBase::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:740
Stats::Info
Definition: info.hh:69
Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::total
Result total() const
Definition: statistics.hh:825
Stats::VectorBase::~VectorBase
~VectorBase()
Definition: statistics.hh:1161
Stats::HistStor::bucket_size
Counter bucket_size
The number of entries in each bucket.
Definition: statistics.hh:1589
Stats::ScalarProxyNode
Definition: statistics.hh:2183
Stats::DistBase
Implementation of a distribution stat.
Definition: statistics.hh:1872
Stats::FormulaNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:3132
Stats::Result
double Result
All results are doubles.
Definition: types.hh:50
Stats::ScalarProxy::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:1018
Stats::Output::visit
virtual void visit(const ScalarInfo &info)=0
Stats::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2762
Stats::DistStor::underflow
Counter underflow
The number of values sampled less than min.
Definition: statistics.hh:1452
Stats::ProxyInfo::zero
bool zero() const
Definition: statistics.hh:776
Stats::ScalarStatNode::vresult
VResult vresult
Definition: statistics.hh:2160
Stats::StatStor::inc
void inc(Counter val)
Increment the stat by the given value.
Definition: statistics.hh:516
Stats::DataWrapVec2d
Definition: statistics.hh:434
Stats::operator/
Temp operator/(Temp l, Temp r)
Definition: statistics.hh:3344
Stats::FormulaNode::vec
VResult vec
Definition: statistics.hh:3127
Stats::AvgStor::total
Result total
The total count for all tick.
Definition: statistics.hh:562
Stats::Average
A stat that calculates the per tick average of a value.
Definition: statistics.hh:2549
Stats::SparseHistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:2902
Stats::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:41
Stats::Temp::Temp
Temp(unsigned long value)
Create a ConstNode.
Definition: statistics.hh:3283
Stats::ConstVectorNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2272
Stats::DistProxy::index
off_type index
Definition: statistics.hh:2067
Stats::ScalarBase::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:719
Stats::ValueProxy
Definition: statistics.hh:782
Stats::ProxyInfo::str
std::string str() const
Definition: statistics.hh:771
Stats::VectorDistBase
Definition: statistics.hh:1964
Stats::ValueBase::proxy
ProxyInfo * proxy
Definition: statistics.hh:851
Stats::AvgSampleStor::Params::Params
Params()
Definition: statistics.hh:1802
Stats::VectorBase::Proxy
ScalarProxy< Derived > Proxy
Proxy type.
Definition: statistics.hh:1061
Stats::FunctorProxy::FunctorProxy
FunctorProxy(T &func)
Definition: statistics.hh:801
Stats::DistStor::zero
bool zero() const
Returns true if any calls to sample have been made.
Definition: statistics.hh:1512
Stats::StatStor
Templatized storage and interface for a simple scalar stat.
Definition: statistics.hh:489
Stats::Vector2dBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1390
Stats::ScalarBase::reset
void reset()
Definition: statistics.hh:764
Stats::FormulaInfo
Definition: info.hh:237
Stats::AvgStor::inc
void inc(Counter val)
Increment the current count by the provided value, calls set.
Definition: statistics.hh:594
Stats::StatStor::data
Counter data
The statistic value.
Definition: statistics.hh:493
Stats::VectorProxy::len
size_type len
Definition: statistics.hh:1203
Stats::SparseHistInfoProxy::SparseHistInfoProxy
SparseHistInfoProxy(Stat &stat)
Definition: statistics.hh:2842
Stats::InfoAccess::setInit
void setInit()
Save Storage class parameters if any.
Definition: statistics.cc:111
Stats::FormulaInfoProxy
Definition: statistics.hh:2815
Stats::StorageParams::~StorageParams
virtual ~StorageParams()
Definition: statistics.cc:144
Stats::ValueBase::functor
Derived & functor(T &func)
Definition: statistics.hh:882
Stats::DistProxy::sample
void sample(const U &v, int n=1)
Definition: statistics.hh:2093
Stats::Vector2dBase::_size
size_type _size
Definition: statistics.hh:1289
Stats::DataWrap::info
Info * info()
Definition: statistics.hh:233
Stats::VectorProxy::result
const VResult & result() const
Definition: statistics.hh:1224
Stats::StatStor::result
Result result() const
Return the value of this stat as a result type.
Definition: statistics.hh:531
Stats::Vector2dBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1294
Stats::processDumpQueue
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
Definition: statistics.cc:531
Stats::ScalarProxy::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:992
Stats::ValueBase::prepare
void prepare()
Definition: statistics.hh:913
Stats::Vector2d
A 2-Dimensional vecto of scalar stats.
Definition: statistics.hh:2603
Stats::operator*
Temp operator*(Temp l, Temp r)
Definition: statistics.hh:3338
Stats::Info::setName
void setName(const std::string &name)
Set the name of this statistic.
Stats::InfoProxy::InfoProxy
InfoProxy(Stat &stat)
Definition: statistics.hh:98
Stats::Temp::Temp
Temp(const Value &s)
Create a new ScalarStatNode.
Definition: statistics.hh:3183
Stats::ConstNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2246
ArmISA::b
Bitfield< 7 > b
Definition: miscregs_types.hh:376
Stats::ValueProxy::result
Result result() const
Definition: statistics.hh:790
Stats::SparseHistStor::sample
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Definition: statistics.hh:2962
Stats::ScalarProxyNode::str
std::string str() const
Definition: statistics.hh:2217
Stats::ConstNode
Definition: statistics.hh:2239
Stats::VectorDistBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1986
Stats::ScalarBase::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:732
Stats::FunctorProxy::result
Result result() const
Definition: statistics.hh:803
Stats::SparseHistStor::zero
bool zero() const
Returns true if any calls to sample have been made.
Definition: statistics.hh:2979
std
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
Stats::VectorBase::_size
size_type _size
Definition: statistics.hh:1068
Stats::DataWrap::precision
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
Definition: statistics.hh:319
Stats::SumNode::l
NodePtr l
Definition: statistics.hh:2470
types.hh
Stats::Vector2dInfo::y
size_type y
Definition: info.hh:227
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
Stats::Distribution::init
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
Definition: statistics.hh:2634
Stats::StatStor::prepare
void prepare(Info *info)
Prepare stat data for dumping or serialization.
Definition: statistics.hh:535
Stats::Vector2dBase::Storage
Stor Storage
Definition: statistics.hh:1278
Stats::dump
void dump()
Dump all statistics data to the registered outputs.
Definition: statistics.cc:560
Stats::SampleStor::sum
Counter sum
The current sum.
Definition: statistics.hh:1728
Stats::AverageVector
A vector of Average stats.
Definition: statistics.hh:2589
Stats::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:3037
Stats::Temp::Temp
Temp(const Formula &f)
Definition: statistics.hh:3210
Stats::Group
Statistics container.
Definition: group.hh:83
Stats::ScalarBase::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:724
Stats::DistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1948
Stats::OpString< std::modulus< Result > >::str
static std::string str()
Definition: statistics.hh:2315
Stats::UnaryNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2351
Stats::Info::name
std::string name
The name of the stat.
Definition: info.hh:73
Stats::SparseHistBase::storage
char storage[sizeof(Storage)]
The storage for this stat.
Definition: statistics.hh:2859
Stats::MethodProxy::result
Result result() const
Definition: statistics.hh:843
Stats::DistBase::add
void add(DistBase &d)
Add the argument distribution to the this distribution.
Definition: statistics.hh:1956
Stats::DistStor::sum
Counter sum
The current sum.
Definition: statistics.hh:1456
Stats::Temp::Temp
Temp(signed int value)
Create a ConstNode.
Definition: statistics.hh:3259
Stats::Temp::Temp
Temp(signed short value)
Create a ConstNode.
Definition: statistics.hh:3243
Stats::DistBase::Params
Stor::Params Params
Definition: statistics.hh:1877
Stats::DistInfo::data
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:197
Stats::VectorDistribution::init
VectorDistribution & init(size_type size, Counter min, Counter max, Counter bkt)
Initialize storage and parameters for this distribution.
Definition: statistics.hh:2741
Stats::UnaryNode
Definition: statistics.hh:2325
Stats::Formula::prepare
void prepare()
Definition: statistics.hh:3108
debugDumpStats
void debugDumpStats()
Definition: statistics.cc:597
Stats::DistProxy::operator=
const DistProxy & operator=(const DistProxy &sp)
Definition: statistics.hh:2083
Stats::ConstNode::str
std::string str() const
Definition: statistics.hh:2249
Stats::Vector2dBase::init
Derived & init(size_type _x, size_type _y)
Definition: statistics.hh:1313
output.hh
Stats::ScalarStatNode::str
std::string str() const
Definition: statistics.hh:2179
Stats::ScalarBase::total
Result total()
Definition: statistics.hh:760
ArmISA::rs
Bitfield< 9, 8 > rs
Definition: miscregs_types.hh:372
Stats::ValueBase::size
size_type size() const
Definition: statistics.hh:908
Stats::DistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:1924
Stats::StatStor::set
void set(Counter val)
The the stat to the given value.
Definition: statistics.hh:511
Stats::DistProxy::reset
void reset()
Proxy has no state.
Definition: statistics.hh:2113
Stats::ScalarInfo
Definition: info.hh:148
Stats::VectorDistBase::VectorDistBase
VectorDistBase(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:2009
Stats::DataWrap::name
const std::string & name() const
Definition: statistics.hh:281
Stats::SparseHistInfo::data
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:255
safe_cast
T safe_cast(U ptr)
Definition: cast.hh:59
Stats::Temp::Temp
Temp(NodePtr &&n)
Definition: statistics.hh:3157
Stats::ValueBase::~ValueBase
~ValueBase()
Definition: statistics.hh:860
Stats::VectorInfoProxy
Definition: statistics.hh:123
Stats::SparseHistBase::Storage
Stor Storage
Definition: statistics.hh:2854
Stats::VectorInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:126
Stats::DataWrapVec2d::DataWrapVec2d
DataWrapVec2d(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:439
Stats::UnaryNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2360
Stats::FormulaNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:3133
Stats::DistProxy
Definition: statistics.hh:1961
Stats::DataWrapVec::subname
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation.
Definition: statistics.hh:374
Stats::Formula::result
void result(VResult &vec) const
Return the result of the Fomula in a vector.
Definition: statistics.cc:468
Stats::SparseHistogram
Definition: statistics.hh:3007
Stats::DistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:1935
Stats
Definition: statistics.cc:61
Stats::ConstVectorNode
Definition: statistics.hh:2253
Stats::AverageVector::AverageVector
AverageVector(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2592
Stats::ValueBase::total
Result total() const
Definition: statistics.hh:907
Stats::InfoAccess::setParams
void setParams(const StorageParams *params)
Save Storage class parameters if any.
Definition: statistics.cc:105
Stats::DistBase::Info
DistInfoProxy< Derived > Info
Definition: statistics.hh:1875
Stats::Vector2dBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:1364
Stats::Group::addStat
void addStat(Stats::Info *info)
Register a stat with this group.
Definition: group.cc:105
Stats::ScalarProxyNode::ScalarProxyNode
ScalarProxyNode(const ScalarProxy< Stat > &p)
Definition: statistics.hh:2190
Stats::ScalarStatNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2174
Stats::VectorStatNode::str
std::string str() const
Definition: statistics.hh:2235
Stats::Formula::operator/=
const Formula & operator/=(Temp r)
Divide the existing tree by the given one.
Definition: statistics.cc:457
Stats::Vector::Vector
Vector(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2578
Stats::SparseHistogram::init
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:3022
Stats::VectorBase::VectorBase
VectorBase(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:1156
Stats::ConstVectorNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2260
Stats::size_type
unsigned int size_type
Definition: types.hh:54
Stats::Vector2dBase::zero
bool zero() const
Definition: statistics.hh:1354
Stats::Histogram::init
Histogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2669
Stats::HistStor::size
size_type size() const
Return the number of buckets in this distribution.
Definition: statistics.hh:1655
Stats::ScalarProxyNode::proxy
const ScalarProxy< Stat > proxy
Definition: statistics.hh:2186
Stats::ValueBase::check
bool check() const
Definition: statistics.hh:912
Stats::FormulaInfoProxy::size
size_type size() const
Definition: statistics.hh:2824
Stats::FunctorProxy
Definition: statistics.hh:795
Stats::VectorProxy
Definition: statistics.hh:1198
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Stats::Scalar::Scalar
Scalar(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2538
Stats::MapType
std::map< const void *, Info * > MapType
Definition: statistics.hh:3415
std::list
STL list class.
Definition: stl.hh:51
Stats::HistStor::grow_out
void grow_out()
Definition: statistics.cc:314
Stats::StatStor::value
Counter value() const
Return the value of this stat as its base type.
Definition: statistics.hh:526
intmath.hh
Stats::InfoAccess::InfoAccess
InfoAccess()
Definition: statistics.hh:200
Stats::VectorDistBase::_size
size_type _size
Definition: statistics.hh:1976
Stats::VectorStatNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2233
ArmISA::s
Bitfield< 4 > s
Definition: miscregs_types.hh:556
Stats::MethodProxy::MethodProxy
MethodProxy(T *obj, MethodPointer meth)
Definition: statistics.hh:841
Stats::ScalarProxy::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:1030
Stats::Vector2dInfoProxy::Vector2dInfoProxy
Vector2dInfoProxy(Stat &stat)
Definition: statistics.hh:171
Stats::Formula::size
size_type size() const
Return the number of elements in the tree.
Definition: statistics.cc:481
Stats::registerHandlers
void registerHandlers(Handler reset_handler, Handler dump_handler)
Definition: statistics.cc:515
Stats::HistStor::prepare
void prepare(Info *info, DistData &data)
Definition: statistics.hh:1668
Stats::VectorStatNode::data
const VectorInfo * data
Definition: statistics.hh:2226
Stats::SparseHistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:2926
MipsISA::l
Bitfield< 5 > l
Definition: pra_constants.hh:320
Stats::FormulaInfoProxy::result
const VResult & result() const
Definition: statistics.hh:2827
Stats::FormulaInfoProxy::total
Result total() const
Definition: statistics.hh:2832
Stats::ScalarProxy::ScalarProxy
ScalarProxy(const ScalarProxy &sp)
Create a copy of the provided ScalarProxy.
Definition: statistics.hh:964
Stats::VectorBase::value
void value(VCounter &vec) const
Definition: statistics.hh:1103
Stats::Average::Average
Average(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2554
Stats::VectorDistBase::size
size_type size() const
Definition: statistics.hh:2031
Stats::SparseHistStor::size
size_type size() const
Return the number of buckets in this distribution.
Definition: statistics.hh:2972
Stats::Distribution::Distribution
Distribution(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2620
Stats::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2709
Stats::DataWrap::desc
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Definition: statistics.hh:307
Stats::SparseHistStor::prepare
void prepare(Info *info, SparseHistData &data)
Definition: statistics.hh:2985
Stats::DistProxy::DistProxy
DistProxy(const DistProxy &sp)
Definition: statistics.hh:2078
Stats::VectorProxy::stat
Stat & stat
Definition: statistics.hh:1201
Stats::ScalarProxy::str
std::string str() const
Definition: statistics.hh:1043
Stats::VectorDistInfoProxy
Definition: statistics.hh:159
Stats::VectorInfoProxy::VectorInfoProxy
VectorInfoProxy(Stat &stat)
Definition: statistics.hh:130
Stats::VectorProxy::data
Stat::Storage * data(off_type index)
Definition: statistics.hh:1209
Stats::InfoProxy::s
Stat & s
Definition: statistics.hh:95
Stats::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Definition: statistics.hh:2726
Stats::DistBase::Storage
Stor Storage
Definition: statistics.hh:1876
Stats::VectorStandardDeviation
This is a vector of StandardDeviation stats.
Definition: statistics.hh:2758
Stats::MethodProxy::method
MethodPointer method
Definition: statistics.hh:838
Stats::HistStor::sample
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Definition: statistics.hh:1620
Stats::HistStor::reset
void reset(Info *info)
Reset stat value to default.
Definition: statistics.hh:1696
Stats::FormulaInfoProxy::str
std::string str() const
Definition: statistics.hh:2835
Stats::BinaryNode::vresult
VResult vresult
Definition: statistics.hh:2375
Stats::Temp::Temp
Temp(unsigned char value)
Create a ConstNode.
Definition: statistics.hh:3235
Stats::AvgStor::set
void set(Counter val)
Set the current count to the one provided, update the total and last set values.
Definition: statistics.hh:583
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
Stats::Temp::Temp
Temp(const Average &s)
Create a new ScalarStatNode.
Definition: statistics.hh:3191
Stats::VectorBase::check
bool check() const
Definition: statistics.hh:1150
Stats::Vector2dBase::prepare
void prepare()
Definition: statistics.hh:1373
Stats::SparseHistStor::reset
void reset(Info *info)
Reset stat value to default.
Definition: statistics.hh:3000
ArmISA::v
Bitfield< 28 > v
Definition: miscregs_types.hh:51
Stats::ScalarProxy::index
off_type index
The index to access in the parent VectorBase.
Definition: statistics.hh:935
Stats::SampleStor::sample
void sample(Counter val, int number)
Add a value the given number of times to this running average.
Definition: statistics.hh:1750
Stats::VectorBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:1127
Stats::Temp::Temp
Temp(unsigned long long value)
Create a ConstNode.
Definition: statistics.hh:3299
Stats::ConstNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2248
Stats::DistStor::Params::bucket_size
Counter bucket_size
The number of entries in each bucket.
Definition: statistics.hh:1431
Stats::SumNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2477
Stats::AvgSampleStor::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:1842
Stats::Vector2dBase::y
size_type y
Definition: statistics.hh:1288
Stats::NodePtr
std::shared_ptr< Node > NodePtr
Shared pointer to a function Node.
Definition: statistics.hh:2154
Stats::ScalarStatNode::data
const ScalarInfo * data
Definition: statistics.hh:2159
Stats::Vector2dBase::Vector2dBase
Vector2dBase(Group *parent, const char *name, const char *desc)
Definition: statistics.hh:1297
Stats::InfoAccess::zero
bool zero() const
Definition: statistics.hh:212
Stats::DataWrapVec2d::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:437
Stats::DistStor::Params::buckets
size_type buckets
The number of buckets.
Definition: statistics.hh:1433
Stats::constant
Temp constant(T val)
Definition: statistics.hh:3357
Stats::VectorBase::size
size_type size() const
Definition: statistics.hh:1138
Stats::ProxyInfo::size
size_type size() const
Definition: statistics.hh:772
Stats::ProxyInfo::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:773
Stats::ScalarBase::zero
bool zero()
Definition: statistics.hh:762
ArmISA::f
Bitfield< 6 > f
Definition: miscregs_types.hh:64
Stats::HistStor::samples
Counter samples
The number of samples.
Definition: statistics.hh:1598
Stats::DistStor::overflow
Counter overflow
The number of values sampled more than max.
Definition: statistics.hh:1454
curTick
Tick curTick()
The current simulated tick.
Definition: core.hh:45
ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:153
Stats::VectorDistBase::data
Storage * data(off_type index)
Definition: statistics.hh:1980
Stats::ConstNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2247
Stats::ScalarProxyNode::vresult
VResult vresult
Definition: statistics.hh:2187
Stats::AvgSampleStor::sample
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Definition: statistics.hh:1826
Stats::ProxyInfo
Definition: statistics.hh:768
Stats::FormulaNode
Definition: statistics.hh:3123

Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17