gem5  v22.0.0.2
statistics.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Inria
3  * Copyright (c) 2019-2020 Arm Limited
4  * All rights reserved.
5  *
6  * The license below extends only to copyright in the software and shall
7  * not be construed as granting a license to any other intellectual
8  * property including but not limited to intellectual property relating
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Copyright (c) 2003-2005 The Regents of The University of Michigan
16  * Copyright (c) 2017, Centre National de la Recherche Scientifique
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are
21  * met: redistributions of source code must retain the above copyright
22  * notice, this list of conditions and the following disclaimer;
23  * redistributions in binary form must reproduce the above copyright
24  * notice, this list of conditions and the following disclaimer in the
25  * documentation and/or other materials provided with the distribution;
26  * neither the name of the copyright holders nor the names of its
27  * contributors may be used to endorse or promote products derived from
28  * this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  */
42 
59 #ifndef __BASE_STATISTICS_HH__
60 #define __BASE_STATISTICS_HH__
61 
62 #include <algorithm>
63 #include <cassert>
64 #ifdef __SUNPRO_CC
65 #include <math.h>
66 #endif
67 #include <cmath>
68 #include <functional>
69 #include <iosfwd>
70 #include <list>
71 #include <map>
72 #include <memory>
73 #include <string>
74 #include <vector>
75 
76 #include "base/cast.hh"
77 #include "base/compiler.hh"
78 #include "base/cprintf.hh"
79 #include "base/intmath.hh"
80 #include "base/logging.hh"
81 #include "base/stats/group.hh"
82 #include "base/stats/info.hh"
83 #include "base/stats/output.hh"
84 #include "base/stats/storage.hh"
85 #include "base/stats/types.hh"
86 #include "base/stats/units.hh"
87 #include "base/str.hh"
88 #include "base/types.hh"
89 
90 namespace gem5
91 {
92 
93 /* A namespace for all of the Statistics */
94 GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
95 namespace statistics
96 {
97 
98 template <class Stat, class Base>
99 class InfoProxy : public Base
100 {
101  protected:
102  Stat &s;
103 
104  public:
105  InfoProxy(Stat &stat) : s(stat) {}
106 
107  bool check() const { return s.check(); }
108  void prepare() { s.prepare(); }
109  void reset() { s.reset(); }
110  void
111  visit(Output &visitor)
112  {
113  visitor.visit(*static_cast<Base *>(this));
114  }
115  bool zero() const { return s.zero(); }
116 };
117 
118 template <class Stat>
119 class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo>
120 {
121  public:
122  ScalarInfoProxy(Stat &stat) : InfoProxy<Stat, ScalarInfo>(stat) {}
123 
124  Counter value() const { return this->s.value(); }
125  Result result() const { return this->s.result(); }
126  Result total() const { return this->s.total(); }
127 };
128 
129 template <class Stat>
130 class VectorInfoProxy : public InfoProxy<Stat, VectorInfo>
131 {
132  protected:
133  mutable VCounter cvec;
134  mutable VResult rvec;
135 
136  public:
137  VectorInfoProxy(Stat &stat) : InfoProxy<Stat, VectorInfo>(stat) {}
138 
139  size_type size() const { return this->s.size(); }
140 
141  VCounter &
142  value() const
143  {
144  this->s.value(cvec);
145  return cvec;
146  }
147 
148  const VResult &
149  result() const
150  {
151  this->s.result(rvec);
152  return rvec;
153  }
154 
155  Result total() const { return this->s.total(); }
156 };
157 
158 template <class Stat>
159 class DistInfoProxy : public InfoProxy<Stat, DistInfo>
160 {
161  public:
162  DistInfoProxy(Stat &stat) : InfoProxy<Stat, DistInfo>(stat) {}
163 };
164 
165 template <class Stat>
166 class VectorDistInfoProxy : public InfoProxy<Stat, VectorDistInfo>
167 {
168  public:
169  VectorDistInfoProxy(Stat &stat) : InfoProxy<Stat, VectorDistInfo>(stat) {}
170 
171  size_type size() const { return this->s.size(); }
172 };
173 
174 template <class Stat>
175 class Vector2dInfoProxy : public InfoProxy<Stat, Vector2dInfo>
176 {
177  public:
178  Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {}
179 
180  Result total() const { return this->s.total(); }
181 };
182 
184 {
185  private:
187 
188  protected:
190  void setInfo(Group *parent, Info *info);
192  void setParams(const StorageParams *params);
194  void setInit();
195 
197  Info *info();
199  const Info *info() const;
200 
202  bool newStyleStats() const;
203 
204  public:
206  : _info(nullptr) {};
207 
211  void reset() { }
212 
217  bool zero() const { return true; }
218 
224  bool check() const { return true; }
225 };
226 
227 template <class Derived, template <class> class InfoProxyType>
228 class DataWrap : public InfoAccess
229 {
230  public:
231  typedef InfoProxyType<Derived> Info;
232 
233  protected:
234  Derived &self() { return *static_cast<Derived *>(this); }
235 
236  protected:
237  Info *
239  {
240  return safe_cast<Info *>(InfoAccess::info());
241  }
242 
243  public:
244  const Info *
245  info() const
246  {
247  return safe_cast<const Info *>(InfoAccess::info());
248  }
249 
250  public:
251  DataWrap() = delete;
252  DataWrap(const DataWrap &) = delete;
253  DataWrap &operator=(const DataWrap &) = delete;
254 
255  DataWrap(Group *parent, const char *name, const units::Base *unit,
256  const char *desc)
257  {
258  auto info = new Info(self());
259  this->setInfo(parent, info);
260 
261  if (parent)
262  parent->addStat(info);
263 
264  if (name) {
265  info->setName(name, !newStyleStats());
266  info->flags.set(display);
267  }
268 
269  info->unit = unit;
270 
271  if (desc)
272  info->desc = desc;
273 
274  // Stat that does not belong to any statistics::Group is a legacy stat
275  std::string common_message = "Legacy stat is a stat that does not "
276  "belong to any statistics::Group. Legacy stat is deprecated.";
277  if (parent == nullptr && name != nullptr)
278  warn(csprintf("`%s` is a legacy stat. %s", name, common_message));
279  else if (parent == nullptr)
280  warn_once("One of the stats is a legacy stat. " + common_message);
281  }
282 
288  Derived &
289  name(const std::string &name)
290  {
291  Info *info = this->info();
292  info->setName(name, !newStyleStats());
293  info->flags.set(display);
294  return this->self();
295  }
296  const std::string &name() const { return this->info()->name; }
297 
304  Derived &
305  setSeparator(const std::string &_sep)
306  {
307  this->info()->setSeparator(_sep);
308  return this->self();
309  }
310  const std::string &setSeparator() const
311  {
312  return this->info()->separatorString;
313  }
314 
320  Derived &
321  unit(const units::Base *_unit)
322  {
323  this->info()->unit = _unit;
324  return this->self();
325  }
326 
333  Derived &
334  desc(const std::string &_desc)
335  {
336  this->info()->desc = _desc;
337  return this->self();
338  }
339 
345  Derived &
346  precision(int _precision)
347  {
348  this->info()->precision = _precision;
349  return this->self();
350  }
351 
357  Derived &
358  flags(Flags _flags)
359  {
360  this->info()->flags.set(_flags);
361  return this->self();
362  }
363 
370  template <class Stat>
371  Derived &
372  prereq(const Stat &prereq)
373  {
374  this->info()->prereq = prereq.info();
375  return this->self();
376  }
377 };
378 
379 template <class Derived, template <class> class InfoProxyType>
380 class DataWrapVec : public DataWrap<Derived, InfoProxyType>
381 {
382  public:
383  typedef InfoProxyType<Derived> Info;
384 
385  DataWrapVec(Group *parent = nullptr, const char *name = nullptr,
387  const char *desc = nullptr)
388  : DataWrap<Derived, InfoProxyType>(parent, name, unit, desc)
389  {}
390 
391  // The following functions are specific to vectors. If you use them
392  // in a non vector context, you will get a nice compiler error!
393 
401  Derived &
402  subname(off_type index, const std::string &name)
403  {
404  Derived &self = this->self();
405  Info *info = self.info();
406 
407  std::vector<std::string> &subn = info->subnames;
408  if (subn.size() <= index)
409  subn.resize(index + 1);
410  subn[index] = name;
411  return self;
412  }
413 
414  // The following functions are specific to 2d vectors. If you use
415  // them in a non vector context, you will get a nice compiler
416  // error because info doesn't have the right variables.
417 
425  Derived &
426  subdesc(off_type index, const std::string &desc)
427  {
428  Info *info = this->info();
429 
430  std::vector<std::string> &subd = info->subdescs;
431  if (subd.size() <= index)
432  subd.resize(index + 1);
433  subd[index] = desc;
434 
435  return this->self();
436  }
437 
438  void
440  {
441  Derived &self = this->self();
442  Info *info = this->info();
443 
444  size_t size = self.size();
445  for (off_type i = 0; i < size; ++i)
446  self.data(i)->prepare(info->getStorageParams());
447  }
448 
449  void
451  {
452  Derived &self = this->self();
453  Info *info = this->info();
454 
455  size_t size = self.size();
456  for (off_type i = 0; i < size; ++i)
457  self.data(i)->reset(info->getStorageParams());
458  }
459 };
460 
461 template <class Derived, template <class> class InfoProxyType>
462 class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType>
463 {
464  public:
465  typedef InfoProxyType<Derived> Info;
466 
467  DataWrapVec2d(Group *parent, const char *name,
468  const units::Base *unit, const char *desc)
469  : DataWrapVec<Derived, InfoProxyType>(parent, name, unit, desc)
470  {
471  }
472 
477  Derived &
478  ysubnames(const char **names)
479  {
480  Derived &self = this->self();
481  Info *info = this->info();
482 
483  info->y_subnames.resize(self.y);
484  for (off_type i = 0; i < self.y; ++i)
485  info->y_subnames[i] = names[i];
486  return self;
487  }
488 
489  Derived &
490  ysubname(off_type index, const std::string &subname)
491  {
492  Derived &self = this->self();
493  Info *info = this->info();
494 
495  assert(index < self.y);
496  info->y_subnames.resize(self.y);
497  info->y_subnames[index] = subname.c_str();
498  return self;
499  }
500 
501  std::string
503  {
504  return this->info()->y_subnames[i];
505  }
506 
507 };
508 
510 //
511 // Simple Statistics
512 //
514 
519 template <class Derived, class Stor>
520 class ScalarBase : public DataWrap<Derived, ScalarInfoProxy>
521 {
522  public:
523  typedef Stor Storage;
524  typedef typename Stor::Params Params;
525 
526  protected:
528  GEM5_ALIGNED(8) char storage[sizeof(Storage)];
529 
530  protected:
536  Storage *
538  {
539  return reinterpret_cast<Storage *>(storage);
540  }
541 
548  const Storage *
549  data() const
550  {
551  return reinterpret_cast<const Storage *>(storage);
552  }
553 
554  void
556  {
557  new (storage) Storage(this->info()->getStorageParams());
558  this->setInit();
559  }
560 
561  public:
562  ScalarBase(Group *parent = nullptr, const char *name = nullptr,
564  const char *desc = nullptr)
565  : DataWrap<Derived, ScalarInfoProxy>(parent, name, unit, desc)
566  {
567  this->doInit();
568  }
569 
570  public:
571  // Common operators for stats
576  void operator++() { data()->inc(1); }
581  void operator--() { data()->dec(1); }
582 
584  void operator++(int) { ++*this; }
586  void operator--(int) { --*this; }
587 
593  template <typename U>
594  void operator=(const U &v) { data()->set(v); }
595 
601  template <typename U>
602  void operator+=(const U &v) { data()->inc(v); }
603 
609  template <typename U>
610  void operator-=(const U &v) { data()->dec(v); }
611 
616  size_type size() const { return 1; }
617 
622  Counter value() const { return data()->value(); }
623 
624  Result result() const { return data()->result(); }
625 
626  Result total() const { return result(); }
627 
628  bool zero() const { return result() == 0.0; }
629 
630  void reset() { data()->reset(this->info()->getStorageParams()); }
631  void prepare() { data()->prepare(this->info()->getStorageParams()); }
632 };
633 
634 class ProxyInfo : public ScalarInfo
635 {
636  public:
637  std::string str() const { return std::to_string(value()); }
638  size_type size() const { return 1; }
639  bool check() const { return true; }
640  void prepare() { }
641  void reset() { }
642  bool zero() const { return value() == 0; }
643 
644  void visit(Output &visitor) { visitor.visit(*this); }
645 };
646 
647 template <class T>
648 class ValueProxy : public ProxyInfo
649 {
650  private:
651  T *scalar;
652 
653  public:
655  Counter value() const { return *scalar; }
656  Result result() const { return *scalar; }
657  Result total() const { return *scalar; }
658 };
659 
660 template <class T, class Enabled=void>
661 class FunctorProxy : public ProxyInfo
662 {
663  private:
665 
666  public:
667  FunctorProxy(T &func) : functor(&func) {}
668  Counter value() const { return (*functor)(); }
669  Result result() const { return (*functor)(); }
670  Result total() const { return (*functor)(); }
671 };
672 
679 template <class T>
680 class FunctorProxy<T,
681  typename std::enable_if_t<std::is_constructible_v<std::function<Result()>,
682  const T &>>> : public ProxyInfo
683 {
684  private:
685  std::function<Result()> functor;
686 
687  public:
688  FunctorProxy(const T &func) : functor(func) {}
689  Counter value() const { return functor(); }
690  Result result() const { return functor(); }
691  Result total() const { return functor(); }
692 };
693 
698 template <class T, class V>
699 class MethodProxy : public ProxyInfo
700 {
701  private:
702  T *object;
703  typedef V (T::*MethodPointer) () const;
705 
706  public:
707  MethodProxy(T *obj, MethodPointer meth) : object(obj), method(meth) {}
708  Counter value() const { return (object->*method)(); }
709  Result result() const { return (object->*method)(); }
710  Result total() const { return (object->*method)(); }
711 };
712 
713 template <class Derived>
714 class ValueBase : public DataWrap<Derived, ScalarInfoProxy>
715 {
716  private:
718 
719  public:
720  ValueBase(Group *parent, const char *name,
721  const units::Base *unit,
722  const char *desc)
723  : DataWrap<Derived, ScalarInfoProxy>(parent, name, unit, desc),
724  proxy(NULL)
725  {
726  }
727 
728  ~ValueBase() { if (proxy) delete proxy; }
729 
730  template <class T>
731  Derived &
733  {
734  proxy = new ValueProxy<T>(value);
735  this->setInit();
736  return this->self();
737  }
738 
739  template <class T>
740  Derived &
741  functor(const T &func)
742  {
743  proxy = new FunctorProxy<T>(func);
744  this->setInit();
745  return this->self();
746  }
747 
748  template <class T>
749  Derived &
750  functor(T &func)
751  {
752  proxy = new FunctorProxy<T>(func);
753  this->setInit();
754  return this->self();
755  }
756 
764  template <class T, class V>
765  Derived &
766  method(T *obj, V (T::*method)() const)
767  {
768  proxy = new MethodProxy<T,V>(obj, method);
769  this->setInit();
770  return this->self();
771  }
772 
773  Counter value() { return proxy->value(); }
774  Result result() const { return proxy->result(); }
775  Result total() const { return proxy->total(); };
776  size_type size() const { return proxy->size(); }
777 
778  std::string str() const { return proxy->str(); }
779  bool zero() const { return proxy->zero(); }
780  bool check() const { return proxy != NULL; }
781  void prepare() { }
782  void reset() { }
783 };
784 
786 //
787 // Vector Statistics
788 //
790 
795 template <class Stat>
797 {
798  private:
800  Stat &stat;
801 
804 
805  public:
810  Counter value() const { return stat.data(index)->value(); }
811 
816  Result result() const { return stat.data(index)->result(); }
817 
818  public:
824  : stat(s), index(i)
825  {
826  }
827 
833  : stat(sp.stat), index(sp.index)
834  {}
835 
841  const ScalarProxy &
843  {
844  stat = sp.stat;
845  index = sp.index;
846  return *this;
847  }
848 
849  public:
850  // Common operators for stats
855  void operator++() { stat.data(index)->inc(1); }
860  void operator--() { stat.data(index)->dec(1); }
861 
863  void operator++(int) { ++*this; }
865  void operator--(int) { --*this; }
866 
872  template <typename U>
873  void
874  operator=(const U &v)
875  {
876  stat.data(index)->set(v);
877  }
878 
884  template <typename U>
885  void
886  operator+=(const U &v)
887  {
888  stat.data(index)->inc(v);
889  }
890 
896  template <typename U>
897  void
898  operator-=(const U &v)
899  {
900  stat.data(index)->dec(v);
901  }
902 
907  size_type size() const { return 1; }
908 
909  public:
910  std::string
911  str() const
912  {
913  return csprintf("%s[%d]", stat.info()->name, index);
914  }
915 };
916 
921 template <class Derived, class Stor>
922 class VectorBase : public DataWrapVec<Derived, VectorInfoProxy>
923 {
924  public:
925  typedef Stor Storage;
926  typedef typename Stor::Params Params;
927 
930  friend class ScalarProxy<Derived>;
931  friend class DataWrapVec<Derived, VectorInfoProxy>;
932 
933  protected:
936 
937  protected:
944 
950  const Storage *data(off_type index) const { return storage[index]; }
951 
952  void
954  {
955  fatal_if(s <= 0, "Storage size must be positive");
956  fatal_if(check(), "Stat has already been initialized");
957 
958  storage.reserve(s);
959  for (size_type i = 0; i < s; ++i)
960  storage.push_back(new Storage(this->info()->getStorageParams()));
961 
962  this->setInit();
963  }
964 
965  public:
966  void
968  {
969  vec.resize(size());
970  for (off_type i = 0; i < size(); ++i)
971  vec[i] = data(i)->value();
972  }
973 
978  void
980  {
981  vec.resize(size());
982  for (off_type i = 0; i < size(); ++i)
983  vec[i] = data(i)->result();
984  }
985 
990  Result
991  total() const
992  {
993  Result total = 0.0;
994  for (off_type i = 0; i < size(); ++i)
995  total += data(i)->result();
996  return total;
997  }
998 
1002  size_type size() const { return storage.size(); }
1003 
1004  bool
1005  zero() const
1006  {
1007  for (off_type i = 0; i < size(); ++i)
1008  if (data(i)->zero())
1009  return false;
1010  return true;
1011  }
1012 
1013  bool
1014  check() const
1015  {
1016  return size() > 0;
1017  }
1018 
1019  public:
1020  VectorBase(Group *parent, const char *name,
1021  const units::Base *unit,
1022  const char *desc)
1023  : DataWrapVec<Derived, VectorInfoProxy>(parent, name, unit, desc),
1024  storage()
1025  {}
1026 
1028  {
1029  for (auto& stor : storage) {
1030  delete stor;
1031  }
1032  }
1033 
1039  Derived &
1041  {
1042  Derived &self = this->self();
1043  self.doInit(size);
1044  return self;
1045  }
1046 
1052  Proxy
1054  {
1055  assert (index < size());
1056  return Proxy(this->self(), index);
1057  }
1058 };
1059 
1060 template <class Stat>
1062 {
1063  private:
1064  Stat &stat;
1067 
1068  private:
1069  mutable VResult vec;
1070 
1071  typename Stat::Storage *
1073  {
1074  assert(index < len);
1075  return stat.data(offset + index);
1076  }
1077 
1078  const typename Stat::Storage *
1080  {
1081  assert(index < len);
1082  return stat.data(offset + index);
1083  }
1084 
1085  public:
1086  const VResult &
1087  result() const
1088  {
1089  vec.resize(size());
1090 
1091  for (off_type i = 0; i < size(); ++i)
1092  vec[i] = data(i)->result();
1093 
1094  return vec;
1095  }
1096 
1097  Result
1098  total() const
1099  {
1100  Result total = 0.0;
1101  for (off_type i = 0; i < size(); ++i)
1102  total += data(i)->result();
1103  return total;
1104  }
1105 
1106  public:
1108  : stat(s), offset(o), len(l)
1109  {
1110  }
1111 
1113  : stat(sp.stat), offset(sp.offset), len(sp.len)
1114  {
1115  }
1116 
1117  const VectorProxy &
1119  {
1120  stat = sp.stat;
1121  offset = sp.offset;
1122  len = sp.len;
1123  return *this;
1124  }
1125 
1128  {
1129  assert (index < size());
1130  return ScalarProxy<Stat>(stat, offset + index);
1131  }
1132 
1133  size_type size() const { return len; }
1134 };
1135 
1136 template <class Derived, class Stor>
1137 class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
1138 {
1139  public:
1141  typedef Stor Storage;
1142  typedef typename Stor::Params Params;
1144  friend class ScalarProxy<Derived>;
1145  friend class VectorProxy<Derived>;
1146  friend class DataWrapVec<Derived, Vector2dInfoProxy>;
1147  friend class DataWrapVec2d<Derived, Vector2dInfoProxy>;
1148 
1149  protected:
1153 
1154  protected:
1156  const Storage *data(off_type index) const { return storage[index]; }
1157 
1158  public:
1159  Vector2dBase(Group *parent, const char *name,
1160  const units::Base *unit,
1161  const char *desc)
1162  : DataWrapVec2d<Derived, Vector2dInfoProxy>(parent, name, unit, desc),
1163  x(0), y(0), storage()
1164  {}
1165 
1167  {
1168  for (auto& stor : storage) {
1169  delete stor;
1170  }
1171  }
1172 
1173  Derived &
1175  {
1176  fatal_if((_x <= 0) || (_y <= 0), "Storage sizes must be positive");
1177  fatal_if(check(), "Stat has already been initialized");
1178 
1179  Derived &self = this->self();
1180  Info *info = this->info();
1181 
1182  x = _x;
1183  y = _y;
1184  info->x = _x;
1185  info->y = _y;
1186 
1187  storage.reserve(x * y);
1188  for (size_type i = 0; i < x * y; ++i)
1189  storage.push_back(new Storage(this->info()->getStorageParams()));
1190 
1191  this->setInit();
1192 
1193  return self;
1194  }
1195 
1196  Proxy
1198  {
1199  off_type offset = index * y;
1200  assert (offset + y <= size());
1201  return Proxy(this->self(), offset, y);
1202  }
1203 
1204 
1205  size_type
1206  size() const
1207  {
1208  return storage.size();
1209  }
1210 
1211  bool
1212  zero() const
1213  {
1214  return data(0)->zero();
1215  }
1216 
1221  Result
1222  total() const
1223  {
1224  Result total = 0.0;
1225  for (off_type i = 0; i < size(); ++i)
1226  total += data(i)->result();
1227  return total;
1228  }
1229 
1230  void
1232  {
1233  Info *info = this->info();
1234  size_type size = this->size();
1235 
1236  for (off_type i = 0; i < size; ++i)
1237  data(i)->prepare(info->getStorageParams());
1238 
1239  info->cvec.resize(size);
1240  for (off_type i = 0; i < size; ++i)
1241  info->cvec[i] = data(i)->value();
1242  }
1243 
1247  void
1249  {
1250  Info *info = this->info();
1251  size_type size = this->size();
1252  for (off_type i = 0; i < size; ++i)
1253  data(i)->reset(info->getStorageParams());
1254  }
1255 
1256  bool
1257  check() const
1258  {
1259  return size() > 0;
1260  }
1261 };
1262 
1264 //
1265 // Non formula statistics
1266 //
1268 
1273 template <class Derived, class Stor>
1274 class DistBase : public DataWrap<Derived, DistInfoProxy>
1275 {
1276  public:
1278  typedef Stor Storage;
1279  typedef typename Stor::Params Params;
1280 
1281  protected:
1283  GEM5_ALIGNED(8) char storage[sizeof(Storage)];
1284 
1285  protected:
1290  Storage *
1292  {
1293  return reinterpret_cast<Storage *>(storage);
1294  }
1295 
1300  const Storage *
1301  data() const
1302  {
1303  return reinterpret_cast<const Storage *>(storage);
1304  }
1305 
1306  void
1308  {
1309  new (storage) Storage(this->info()->getStorageParams());
1310  this->setInit();
1311  }
1312 
1313  public:
1314  DistBase(Group *parent, const char *name,
1315  const units::Base *unit,
1316  const char *desc)
1317  : DataWrap<Derived, DistInfoProxy>(parent, name, unit, desc)
1318  {
1319  }
1320 
1327  template <typename U>
1328  void sample(const U &v, int n = 1) { data()->sample(v, n); }
1329 
1334  size_type size() const { return data()->size(); }
1339  bool zero() const { return data()->zero(); }
1340 
1341  void
1343  {
1344  Info *info = this->info();
1345  data()->prepare(info->getStorageParams(), info->data);
1346  }
1347 
1351  void
1353  {
1354  data()->reset(this->info()->getStorageParams());
1355  }
1356 
1360  void add(DistBase &d) { data()->add(d.data()); }
1361 };
1362 
1363 template <class Stat>
1365 
1366 template <class Derived, class Stor>
1367 class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy>
1368 {
1369  public:
1371  typedef Stor Storage;
1372  typedef typename Stor::Params Params;
1374  friend class DistProxy<Derived>;
1375  friend class DataWrapVec<Derived, VectorDistInfoProxy>;
1376 
1377  protected:
1379 
1380  protected:
1381  Storage *
1383  {
1384  return storage[index];
1385  }
1386 
1387  const Storage *
1389  {
1390  return storage[index];
1391  }
1392 
1393  void
1395  {
1396  fatal_if(s <= 0, "Storage size must be positive");
1397  fatal_if(check(), "Stat has already been initialized");
1398 
1399  storage.reserve(s);
1400  for (size_type i = 0; i < s; ++i)
1401  storage.push_back(new Storage(this->info()->getStorageParams()));
1402 
1403  this->setInit();
1404  }
1405 
1406  public:
1407  VectorDistBase(Group *parent, const char *name,
1408  const units::Base *unit,
1409  const char *desc)
1410  : DataWrapVec<Derived, VectorDistInfoProxy>(parent, name, unit, desc),
1411  storage()
1412  {}
1413 
1415  {
1416  for (auto& stor : storage) {
1417  delete stor;
1418  }
1419  }
1420 
1422  {
1423  assert(index < size());
1424  return Proxy(this->self(), index);
1425  }
1426 
1427  size_type
1428  size() const
1429  {
1430  return storage.size();
1431  }
1432 
1433  bool
1434  zero() const
1435  {
1436  for (off_type i = 0; i < size(); ++i)
1437  if (!data(i)->zero())
1438  return false;
1439  return true;
1440  }
1441 
1442  void
1444  {
1445  Info *info = this->info();
1446  size_type size = this->size();
1447  info->data.resize(size);
1448  for (off_type i = 0; i < size; ++i)
1449  data(i)->prepare(info->getStorageParams(), info->data[i]);
1450  }
1451 
1452  bool
1453  check() const
1454  {
1455  return size() > 0;
1456  }
1457 };
1458 
1459 template <class Stat>
1460 class DistProxy
1461 {
1462  private:
1463  Stat &stat;
1465 
1466  protected:
1467  typename Stat::Storage *data() { return stat.data(index); }
1468  const typename Stat::Storage *data() const { return stat.data(index); }
1469 
1470  public:
1472  : stat(s), index(i)
1473  {}
1474 
1476  : stat(sp.stat), index(sp.index)
1477  {}
1478 
1479  const DistProxy &
1481  {
1482  stat = sp.stat;
1483  index = sp.index;
1484  return *this;
1485  }
1486 
1487  public:
1488  template <typename U>
1489  void
1490  sample(const U &v, int n = 1)
1491  {
1492  data()->sample(v, n);
1493  }
1494 
1495  size_type
1496  size() const
1497  {
1498  return 1;
1499  }
1500 
1501  bool
1502  zero() const
1503  {
1504  return data()->zero();
1505  }
1506 
1510  void reset() { }
1511 };
1512 
1514 //
1515 // Formula Details
1516 //
1518 
1523 class Node
1524 {
1525  public:
1530  virtual size_type size() const = 0;
1535  virtual const VResult &result() const = 0;
1540  virtual Result total() const = 0;
1541 
1545  virtual std::string str() const = 0;
1546 
1547  virtual ~Node() {};
1548 };
1549 
1551 typedef std::shared_ptr<Node> NodePtr;
1552 
1553 class ScalarStatNode : public Node
1554 {
1555  private:
1557  mutable VResult vresult;
1558 
1559  public:
1561 
1562  const VResult &
1563  result() const
1564  {
1565  vresult[0] = data->result();
1566  return vresult;
1567  }
1568 
1569  Result total() const { return data->result(); };
1570 
1571  size_type size() const { return 1; }
1572 
1576  std::string str() const { return data->name; }
1577 };
1578 
1579 template <class Stat>
1580 class ScalarProxyNode : public Node
1581 {
1582  private:
1584  mutable VResult vresult;
1585 
1586  public:
1588  : proxy(p), vresult(1)
1589  { }
1590 
1591  const VResult &
1592  result() const
1593  {
1594  vresult[0] = proxy.result();
1595  return vresult;
1596  }
1597 
1598  Result
1599  total() const
1600  {
1601  return proxy.result();
1602  }
1603 
1604  size_type
1605  size() const
1606  {
1607  return 1;
1608  }
1609 
1613  std::string
1614  str() const
1615  {
1616  return proxy.str();
1617  }
1618 };
1619 
1620 class VectorStatNode : public Node
1621 {
1622  private:
1624 
1625  public:
1627  const VResult &result() const { return data->result(); }
1628  Result total() const { return data->total(); };
1629 
1630  size_type size() const { return data->size(); }
1631 
1632  std::string str() const { return data->name; }
1633 };
1634 
1635 template <class T>
1636 class ConstNode : public Node
1637 {
1638  private:
1640 
1641  public:
1642  ConstNode(T s) : vresult(1, (Result)s) {}
1643  const VResult &result() const { return vresult; }
1644  Result total() const { return vresult[0]; };
1645  size_type size() const { return 1; }
1646  std::string str() const { return std::to_string(vresult[0]); }
1647 };
1648 
1649 template <class T>
1650 class ConstVectorNode : public Node
1651 {
1652  private:
1654 
1655  public:
1656  ConstVectorNode(const T &s) : vresult(s.begin(), s.end()) {}
1657  const VResult &result() const { return vresult; }
1658 
1659  Result
1660  total() const
1661  {
1662  size_type size = this->size();
1663  Result tmp = 0;
1664  for (off_type i = 0; i < size; i++)
1665  tmp += vresult[i];
1666  return tmp;
1667  }
1668 
1669  size_type size() const { return vresult.size(); }
1670  std::string
1671  str() const
1672  {
1673  size_type size = this->size();
1674  std::string tmp = "(";
1675  for (off_type i = 0; i < size; i++)
1676  tmp += csprintf("%s ", std::to_string(vresult[i]));
1677  tmp += ")";
1678  return tmp;
1679  }
1680 };
1681 
1682 template <class Op>
1683 struct OpString;
1684 
1685 template<>
1686 struct OpString<std::plus<Result> >
1687 {
1688  static std::string str() { return "+"; }
1689 };
1690 
1691 template<>
1692 struct OpString<std::minus<Result> >
1693 {
1694  static std::string str() { return "-"; }
1695 };
1696 
1697 template<>
1698 struct OpString<std::multiplies<Result> >
1699 {
1700  static std::string str() { return "*"; }
1701 };
1702 
1703 template<>
1704 struct OpString<std::divides<Result> >
1705 {
1706  static std::string str() { return "/"; }
1707 };
1708 
1709 template<>
1710 struct OpString<std::modulus<Result> >
1711 {
1712  static std::string str() { return "%"; }
1713 };
1714 
1715 template<>
1716 struct OpString<std::negate<Result> >
1717 {
1718  static std::string str() { return "-"; }
1719 };
1720 
1721 template <class Op>
1722 class UnaryNode : public Node
1723 {
1724  public:
1726  mutable VResult vresult;
1727 
1728  public:
1730 
1731  const VResult &
1732  result() const
1733  {
1734  const VResult &lvec = l->result();
1735  size_type size = lvec.size();
1736 
1737  assert(size > 0);
1738 
1739  vresult.resize(size);
1740  Op op;
1741  for (off_type i = 0; i < size; ++i)
1742  vresult[i] = op(lvec[i]);
1743 
1744  return vresult;
1745  }
1746 
1747  Result
1748  total() const
1749  {
1750  const VResult &vec = this->result();
1751  Result total = 0.0;
1752  for (off_type i = 0; i < size(); i++)
1753  total += vec[i];
1754  return total;
1755  }
1756 
1757  size_type size() const { return l->size(); }
1758 
1759  std::string
1760  str() const
1761  {
1762  return OpString<Op>::str() + l->str();
1763  }
1764 };
1765 
1766 template <class Op>
1767 class BinaryNode : public Node
1768 {
1769  public:
1772  mutable VResult vresult;
1773 
1774  public:
1776 
1777  const VResult &
1778  result() const override
1779  {
1780  Op op;
1781  const VResult &lvec = l->result();
1782  const VResult &rvec = r->result();
1783 
1784  assert(lvec.size() > 0 && rvec.size() > 0);
1785 
1786  if (lvec.size() == 1 && rvec.size() == 1) {
1787  vresult.resize(1);
1788  vresult[0] = op(lvec[0], rvec[0]);
1789  } else if (lvec.size() == 1) {
1790  size_type size = rvec.size();
1791  vresult.resize(size);
1792  for (off_type i = 0; i < size; ++i)
1793  vresult[i] = op(lvec[0], rvec[i]);
1794  } else if (rvec.size() == 1) {
1795  size_type size = lvec.size();
1796  vresult.resize(size);
1797  for (off_type i = 0; i < size; ++i)
1798  vresult[i] = op(lvec[i], rvec[0]);
1799  } else if (rvec.size() == lvec.size()) {
1800  size_type size = rvec.size();
1801  vresult.resize(size);
1802  for (off_type i = 0; i < size; ++i)
1803  vresult[i] = op(lvec[i], rvec[i]);
1804  }
1805 
1806  return vresult;
1807  }
1808 
1809  Result
1810  total() const override
1811  {
1812  const VResult &vec = this->result();
1813  const VResult &lvec = l->result();
1814  const VResult &rvec = r->result();
1815  Result total = 0.0;
1816  Result lsum = 0.0;
1817  Result rsum = 0.0;
1818  Op op;
1819 
1820  assert(lvec.size() > 0 && rvec.size() > 0);
1821  assert(lvec.size() == rvec.size() ||
1822  lvec.size() == 1 || rvec.size() == 1);
1823 
1825  if (lvec.size() == rvec.size() && lvec.size() > 1) {
1826  for (off_type i = 0; i < size(); ++i) {
1827  lsum += lvec[i];
1828  rsum += rvec[i];
1829  }
1830  return op(lsum, rsum);
1831  }
1832 
1834  for (off_type i = 0; i < size(); ++i) {
1835  total += vec[i];
1836  }
1837 
1838  return total;
1839  }
1840 
1841  size_type
1842  size() const override
1843  {
1844  size_type ls = l->size();
1845  size_type rs = r->size();
1846  if (ls == 1) {
1847  return rs;
1848  } else if (rs == 1) {
1849  return ls;
1850  } else {
1851  assert(ls == rs && "Node vector sizes are not equal");
1852  return ls;
1853  }
1854  }
1855 
1856  std::string
1857  str() const override
1858  {
1859  return csprintf("(%s %s %s)", l->str(), OpString<Op>::str(), r->str());
1860  }
1861 };
1862 
1863 template <class Op>
1864 class SumNode : public Node
1865 {
1866  public:
1868  mutable VResult vresult;
1869 
1870  public:
1871  SumNode(NodePtr &p) : l(p), vresult(1) {}
1872 
1873  const VResult &
1874  result() const
1875  {
1876  const VResult &lvec = l->result();
1877  size_type size = lvec.size();
1878  assert(size > 0);
1879 
1880  vresult[0] = 0.0;
1881 
1882  Op op;
1883  for (off_type i = 0; i < size; ++i)
1884  vresult[0] = op(vresult[0], lvec[i]);
1885 
1886  return vresult;
1887  }
1888 
1889  Result
1890  total() const
1891  {
1892  const VResult &lvec = l->result();
1893  size_type size = lvec.size();
1894  assert(size > 0);
1895 
1896  Result result = 0.0;
1897 
1898  Op op;
1899  for (off_type i = 0; i < size; ++i)
1900  result = op(result, lvec[i]);
1901 
1902  return result;
1903  }
1904 
1905  size_type size() const { return 1; }
1906 
1907  std::string
1908  str() const
1909  {
1910  return csprintf("total(%s)", l->str());
1911  }
1912 };
1913 
1914 
1916 //
1917 // Visible Statistics Types
1918 //
1920 
1930 class Scalar : public ScalarBase<Scalar, StatStor>
1931 {
1932  public:
1934 
1935  Scalar(Group *parent = nullptr)
1937  parent, nullptr, units::Unspecified::get(), nullptr)
1938  {
1939  }
1940 
1941  Scalar(Group *parent, const char *name, const char *desc = nullptr)
1943  parent, name, units::Unspecified::get(), desc)
1944  {
1945  }
1946 
1947  Scalar(Group *parent, const char *name, const units::Base *unit,
1948  const char *desc = nullptr)
1949  : ScalarBase<Scalar, StatStor>(parent, name, unit, desc)
1950  {
1951  }
1952 };
1953 
1958 class Average : public ScalarBase<Average, AvgStor>
1959 {
1960  public:
1962 
1963  Average(Group *parent = nullptr)
1965  parent, nullptr, units::Unspecified::get(), nullptr)
1966  {
1967  }
1968 
1969  Average(Group *parent, const char *name, const char *desc = nullptr)
1971  parent, name, units::Unspecified::get(), desc)
1972  {
1973  }
1974 
1975  Average(Group *parent, const char *name, const units::Base *unit,
1976  const char *desc = nullptr)
1977  : ScalarBase<Average, AvgStor>(parent, name, unit, desc)
1978  {
1979  }
1980 };
1981 
1982 class Value : public ValueBase<Value>
1983 {
1984  public:
1985  Value(Group *parent = nullptr)
1986  : ValueBase<Value>(parent, nullptr, units::Unspecified::get(), nullptr)
1987  {
1988  }
1989 
1990  Value(Group *parent, const char *name, const char *desc = nullptr)
1991  : ValueBase<Value>(parent, name, units::Unspecified::get(), desc)
1992  {
1993  }
1994 
1995  Value(Group *parent, const char *name, const units::Base *unit,
1996  const char *desc = nullptr)
1997  : ValueBase<Value>(parent, name, unit, desc)
1998  {
1999  }
2000 };
2001 
2006 class Vector : public VectorBase<Vector, StatStor>
2007 {
2008  public:
2009  Vector(Group *parent = nullptr)
2011  parent, nullptr, units::Unspecified::get(), nullptr)
2012  {
2013  }
2014 
2015  Vector(Group *parent, const char *name, const char *desc = nullptr)
2017  parent, name, units::Unspecified::get(), desc)
2018  {
2019  }
2020 
2021  Vector(Group *parent, const char *name, const units::Base *unit,
2022  const char *desc = nullptr)
2023  : VectorBase<Vector, StatStor>(parent, name, unit, desc)
2024  {
2025  }
2026 };
2027 
2032 class AverageVector : public VectorBase<AverageVector, AvgStor>
2033 {
2034  public:
2035  AverageVector(Group *parent = nullptr)
2037  parent, nullptr, units::Unspecified::get(), nullptr)
2038  {
2039  }
2040 
2041  AverageVector(Group *parent, const char *name, const char *desc = nullptr)
2043  parent, name, units::Unspecified::get(), desc)
2044  {
2045  }
2046 
2047  AverageVector(Group *parent, const char *name, const units::Base *unit,
2048  const char *desc = nullptr)
2049  : VectorBase<AverageVector, AvgStor>(parent, name, unit, desc)
2050  {
2051  }
2052 };
2053 
2058 class Vector2d : public Vector2dBase<Vector2d, StatStor>
2059 {
2060  public:
2061  Vector2d(Group *parent = nullptr)
2063  parent, nullptr, units::Unspecified::get(), nullptr)
2064  {
2065  }
2066 
2067  Vector2d(Group *parent, const char *name, const char *desc = nullptr)
2069  parent, name, units::Unspecified::get(), desc)
2070  {
2071  }
2072 
2073  Vector2d(Group *parent, const char *name, const units::Base *unit,
2074  const char *desc = nullptr)
2075  : Vector2dBase<Vector2d, StatStor>(parent, name, unit, desc)
2076  {
2077  }
2078 };
2079 
2084 class Distribution : public DistBase<Distribution, DistStor>
2085 {
2086  public:
2087  Distribution(Group *parent = nullptr)
2089  parent, nullptr, units::Unspecified::get(), nullptr)
2090  {
2091  }
2092 
2093  Distribution(Group *parent, const char *name, const char *desc = nullptr)
2095  parent, name, units::Unspecified::get(), desc)
2096  {
2097  }
2098 
2099  Distribution(Group *parent, const char *name, const units::Base *unit,
2100  const char *desc = nullptr)
2101  : DistBase<Distribution, DistStor>(parent, name, unit, desc)
2102  {
2103  }
2104 
2112  Distribution &
2113  init(Counter min, Counter max, Counter bkt)
2114  {
2115  DistStor::Params *params = new DistStor::Params(min, max, bkt);
2116  this->setParams(params);
2117  this->doInit();
2118  return this->self();
2119  }
2120 };
2121 
2126 class Histogram : public DistBase<Histogram, HistStor>
2127 {
2128  public:
2129  Histogram(Group *parent = nullptr)
2131  parent, nullptr, units::Unspecified::get(), nullptr)
2132  {
2133  }
2134 
2135  Histogram(Group *parent, const char *name,
2136  const char *desc = nullptr)
2138  parent, name, units::Unspecified::get(), desc)
2139  {
2140  }
2141 
2142  Histogram(Group *parent, const char *name, const units::Base *unit,
2143  const char *desc = nullptr)
2144  : DistBase<Histogram, HistStor>(parent, name, unit, desc)
2145  {
2146  }
2147 
2153  Histogram &
2155  {
2156  HistStor::Params *params = new HistStor::Params(size);
2157  this->setParams(params);
2158  this->doInit();
2159  return this->self();
2160  }
2161 };
2162 
2167 class StandardDeviation : public DistBase<StandardDeviation, SampleStor>
2168 {
2169  public:
2173  StandardDeviation(Group *parent = nullptr)
2175  parent, nullptr, units::Unspecified::get(), nullptr)
2176  {
2177  SampleStor::Params *params = new SampleStor::Params;
2178  this->doInit();
2179  this->setParams(params);
2180  }
2181 
2182  StandardDeviation(Group *parent, const char *name,
2183  const char *desc = nullptr)
2185  parent, name, units::Unspecified::get(), desc)
2186  {
2187  SampleStor::Params *params = new SampleStor::Params;
2188  this->doInit();
2189  this->setParams(params);
2190  }
2191 
2192  StandardDeviation(Group *parent, const char *name, const units::Base *unit,
2193  const char *desc = nullptr)
2195  {
2196  SampleStor::Params *params = new SampleStor::Params;
2197  this->doInit();
2198  this->setParams(params);
2199  }
2200 };
2201 
2206 class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor>
2207 {
2208  public:
2212  AverageDeviation(Group *parent = nullptr)
2214  parent, nullptr, units::Unspecified::get(), nullptr)
2215  {
2217  this->doInit();
2218  this->setParams(params);
2219  }
2220 
2221  AverageDeviation(Group *parent, const char *name,
2222  const char *desc = nullptr)
2224  parent, name, units::Unspecified::get(), desc)
2225  {
2227  this->doInit();
2228  this->setParams(params);
2229  }
2230 
2231  AverageDeviation(Group *parent, const char *name, const units::Base *unit,
2232  const char *desc = nullptr)
2234  {
2236  this->doInit();
2237  this->setParams(params);
2238  }
2239 };
2240 
2245 class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor>
2246 {
2247  public:
2248  VectorDistribution(Group *parent = nullptr)
2249  : VectorDistBase<VectorDistribution, DistStor>(parent, nullptr,
2250  units::Unspecified::get(), nullptr)
2251  {
2252  }
2253 
2254  VectorDistribution(Group *parent, const char *name,
2255  const char *desc = nullptr)
2257  parent, name, units::Unspecified::get(), desc)
2258  {
2259  }
2260 
2261  VectorDistribution(Group *parent, const char *name,
2262  const units::Base *unit,
2263  const char *desc = nullptr)
2265  desc)
2266  {
2267  }
2268 
2279  {
2280  DistStor::Params *params = new DistStor::Params(min, max, bkt);
2281  this->setParams(params);
2282  this->doInit(size);
2283  return this->self();
2284  }
2285 };
2286 
2292  : public VectorDistBase<VectorStandardDeviation, SampleStor>
2293 {
2294  public:
2295  VectorStandardDeviation(Group *parent = nullptr)
2297  units::Unspecified::get(), nullptr)
2298  {
2299  }
2300 
2301  VectorStandardDeviation(Group *parent, const char *name,
2302  const char *desc = nullptr)
2304  units::Unspecified::get(), desc)
2305  {
2306  }
2307 
2308  VectorStandardDeviation(Group *parent, const char *name,
2309  const units::Base *unit,
2310  const char *desc = nullptr)
2312  unit, desc)
2313  {
2314  }
2315 
2323  {
2324  SampleStor::Params *params = new SampleStor::Params;
2325  this->doInit(size);
2326  this->setParams(params);
2327  return this->self();
2328  }
2329 };
2330 
2336  : public VectorDistBase<VectorAverageDeviation, AvgSampleStor>
2337 {
2338  public:
2339  VectorAverageDeviation(Group *parent = nullptr)
2341  nullptr, units::Unspecified::get(), nullptr)
2342  {
2343  }
2344 
2345  VectorAverageDeviation(Group *parent, const char *name,
2346  const char *desc = nullptr)
2348  units::Unspecified::get(), desc)
2349  {
2350  }
2351 
2352  VectorAverageDeviation(Group *parent, const char *name,
2353  const units::Base *unit,
2354  const char *desc = nullptr)
2356  unit, desc)
2357  {
2358  }
2359 
2367  {
2369  this->doInit(size);
2370  this->setParams(params);
2371  return this->self();
2372  }
2373 };
2374 
2375 template <class Stat>
2376 class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo>
2377 {
2378  protected:
2379  mutable VResult vec;
2380  mutable VCounter cvec;
2381 
2382  public:
2383  FormulaInfoProxy(Stat &stat) : InfoProxy<Stat, FormulaInfo>(stat) {}
2384 
2385  size_type size() const { return this->s.size(); }
2386 
2387  const VResult &
2388  result() const
2389  {
2390  this->s.result(vec);
2391  return vec;
2392  }
2393  Result total() const { return this->s.total(); }
2394  VCounter &value() const { return cvec; }
2395 
2396  std::string str() const { return this->s.str(); }
2397 };
2398 
2399 template <class Stat>
2400 class SparseHistInfoProxy : public InfoProxy<Stat, SparseHistInfo>
2401 {
2402  public:
2403  SparseHistInfoProxy(Stat &stat) : InfoProxy<Stat, SparseHistInfo>(stat) {}
2404 };
2405 
2410 template <class Derived, class Stor>
2411 class SparseHistBase : public DataWrap<Derived, SparseHistInfoProxy>
2412 {
2413  public:
2415  typedef Stor Storage;
2416  typedef typename Stor::Params Params;
2417 
2418  protected:
2420  char storage[sizeof(Storage)];
2421 
2422  protected:
2427  Storage *
2429  {
2430  return reinterpret_cast<Storage *>(storage);
2431  }
2432 
2437  const Storage *
2438  data() const
2439  {
2440  return reinterpret_cast<const Storage *>(storage);
2441  }
2442 
2443  void
2445  {
2446  new (storage) Storage(this->info()->getStorageParams());
2447  this->setInit();
2448  }
2449 
2450  public:
2451  SparseHistBase(Group *parent, const char *name,
2452  const units::Base *unit,
2453  const char *desc)
2454  : DataWrap<Derived, SparseHistInfoProxy>(parent, name, unit, desc)
2455  {
2456  }
2457 
2464  template <typename U>
2465  void sample(const U &v, int n = 1) { data()->sample(v, n); }
2466 
2471  size_type size() const { return data()->size(); }
2476  bool zero() const { return data()->zero(); }
2477 
2478  void
2480  {
2481  Info *info = this->info();
2482  data()->prepare(info->getStorageParams(), info->data);
2483  }
2484 
2488  void
2490  {
2491  data()->reset(this->info()->getStorageParams());
2492  }
2493 };
2494 
2495 class SparseHistogram : public SparseHistBase<SparseHistogram, SparseHistStor>
2496 {
2497  public:
2498  SparseHistogram(Group *parent = nullptr)
2499  : SparseHistBase<SparseHistogram, SparseHistStor>(parent, nullptr,
2500  units::Unspecified::get(), nullptr)
2501  {
2502  }
2503 
2504  SparseHistogram(Group *parent, const char *name,
2505  const char *desc = nullptr)
2507  units::Unspecified::get(), desc)
2508  {
2509  }
2510 
2511  SparseHistogram(Group *parent, const char *name, const units::Base *unit,
2512  const char *desc = nullptr)
2514  desc)
2515  {
2516  }
2517 
2523  SparseHistogram &
2525  {
2527  this->setParams(params);
2528  this->doInit();
2529  return this->self();
2530  }
2531 };
2532 
2533 class Temp;
2539 class Formula : public DataWrapVec<Formula, FormulaInfoProxy>
2540 {
2541  protected:
2544  friend class Temp;
2545 
2546  public:
2550  Formula(Group *parent = nullptr, const char *name = nullptr,
2551  const char *desc = nullptr);
2552 
2553  Formula(Group *parent, const char *name, const units::Base *unit,
2554  const char *desc = nullptr);
2555 
2556  Formula(Group *parent, const char *name, const char *desc,
2557  const Temp &r);
2558 
2559  Formula(Group *parent, const char *name, const units::Base *unit,
2560  const char *desc, const Temp &r);
2561 
2567  const Formula &operator=(const Temp &r);
2568 
2569  template<typename T>
2570  const Formula &operator=(const T &v)
2571  {
2572  *this = Temp(v);
2573  return *this;
2574  }
2575 
2581  const Formula &operator+=(Temp r);
2582 
2588  const Formula &operator/=(Temp r);
2589 
2597  void result(VResult &vec) const;
2598 
2609  Result total() const;
2610 
2614  size_type size() const;
2615 
2616  void prepare() { }
2617 
2621  void reset();
2622 
2626  bool zero() const;
2627 
2628  std::string str() const;
2629 };
2630 
2631 class FormulaNode : public Node
2632 {
2633  private:
2635  mutable VResult vec;
2636 
2637  public:
2639 
2640  size_type size() const { return formula.size(); }
2641  const VResult &result() const { formula.result(vec); return vec; }
2642  Result total() const { return formula.total(); }
2643 
2644  std::string str() const { return formula.str(); }
2645 };
2646 
2650 class Temp
2651 {
2652  protected:
2657 
2658  public:
2663  Temp(const NodePtr &n) : node(n) { }
2664 
2665  Temp(NodePtr &&n) : node(std::move(n)) { }
2666 
2671  operator NodePtr&() { return node; }
2672 
2676  NodePtr getNodePtr() const { return node; }
2677 
2678  public:
2683  Temp(const Scalar &s)
2684  : node(new ScalarStatNode(s.info()))
2685  { }
2686 
2691  Temp(const Value &s)
2692  : node(new ScalarStatNode(s.info()))
2693  { }
2694 
2699  Temp(const Average &s)
2700  : node(new ScalarStatNode(s.info()))
2701  { }
2702 
2707  Temp(const Vector &s)
2708  : node(new VectorStatNode(s.info()))
2709  { }
2710 
2712  : node(new VectorStatNode(s.info()))
2713  { }
2714 
2718  Temp(const Formula &f)
2719  : node(new FormulaNode(f))
2720  { }
2721 
2726  template <class Stat>
2728  : node(new ScalarProxyNode<Stat>(p))
2729  { }
2730 
2735  Temp(signed char value)
2736  : node(new ConstNode<signed char>(value))
2737  { }
2738 
2743  Temp(unsigned char value)
2744  : node(new ConstNode<unsigned char>(value))
2745  { }
2746 
2751  Temp(signed short value)
2752  : node(new ConstNode<signed short>(value))
2753  { }
2754 
2759  Temp(unsigned short value)
2760  : node(new ConstNode<unsigned short>(value))
2761  { }
2762 
2767  Temp(signed int value)
2768  : node(new ConstNode<signed int>(value))
2769  { }
2770 
2775  Temp(unsigned int value)
2776  : node(new ConstNode<unsigned int>(value))
2777  { }
2778 
2783  Temp(signed long value)
2784  : node(new ConstNode<signed long>(value))
2785  { }
2786 
2791  Temp(unsigned long value)
2792  : node(new ConstNode<unsigned long>(value))
2793  { }
2794 
2799  Temp(signed long long value)
2800  : node(new ConstNode<signed long long>(value))
2801  { }
2802 
2807  Temp(unsigned long long value)
2808  : node(new ConstNode<unsigned long long>(value))
2809  { }
2810 
2815  Temp(float value)
2816  : node(new ConstNode<float>(value))
2817  { }
2818 
2823  Temp(double value)
2824  : node(new ConstNode<double>(value))
2825  { }
2826 };
2827 
2828 
2833 inline Temp
2835 {
2836  return Temp(std::make_shared<BinaryNode<std::plus<Result> > >(l, r));
2837 }
2838 
2839 inline Temp
2841 {
2842  return Temp(std::make_shared<BinaryNode<std::minus<Result> > >(l, r));
2843 }
2844 
2845 inline Temp
2847 {
2848  return Temp(std::make_shared<BinaryNode<std::multiplies<Result> > >(l, r));
2849 }
2850 
2851 inline Temp
2853 {
2854  return Temp(std::make_shared<BinaryNode<std::divides<Result> > >(l, r));
2855 }
2856 
2857 inline Temp
2859 {
2860  return Temp(std::make_shared<UnaryNode<std::negate<Result> > >(l));
2861 }
2862 
2863 template <typename T>
2864 inline Temp
2866 {
2867  return Temp(std::make_shared<ConstNode<T> >(val));
2868 }
2869 
2870 template <typename T>
2871 inline Temp
2873 {
2874  return Temp(std::make_shared<ConstVectorNode<T> >(val));
2875 }
2876 
2877 inline Temp
2879 {
2880  return Temp(std::make_shared<SumNode<std::plus<Result> > >(val));
2881 }
2882 
2884 void dump();
2885 void reset();
2886 void enable();
2887 bool enabled();
2888 const Info* resolve(const std::string &name);
2889 
2895 typedef void (*Handler)();
2896 
2897 void registerHandlers(Handler reset_handler, Handler dump_handler);
2898 
2903 void registerResetCallback(const std::function<void()> &callback);
2904 
2909 void registerDumpCallback(const std::function<void()> &callback);
2910 
2914 void processResetQueue();
2915 
2919 void processDumpQueue();
2920 
2922 
2923 typedef std::map<const void *, Info *> MapType;
2924 MapType &statsMap();
2925 
2926 } // namespace statistics
2927 
2928 void debugDumpStats();
2929 
2930 } // namespace gem5
2931 
2932 #endif // __BASE_STATISTICS_HH__
gem5::statistics::ValueBase::zero
bool zero() const
Definition: statistics.hh:779
gem5::statistics::ProxyInfo::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:639
gem5::statistics::OpString< std::negate< Result > >::str
static std::string str()
Definition: statistics.hh:1718
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1930
gem5::statistics::DistInfoProxy
Definition: statistics.hh:159
gem5::statistics::DistProxy
Definition: statistics.hh:1364
gem5::statistics::DistBase
Implementation of a distribution stat.
Definition: statistics.hh:1274
gem5::statistics::BinaryNode::result
const VResult & result() const override
Return the result vector of this subtree.
Definition: statistics.hh:1778
gem5::statistics::SampleStor::Params
Definition: storage.hh:571
gem5::statistics::ScalarProxy::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:863
gem5::statistics::DistStor
Templatized storage and interface for a distribution stat.
Definition: storage.hh:233
gem5::VegaISA::s
Bitfield< 1 > s
Definition: pagetable.hh:64
gem5::statistics::Temp::Temp
Temp(unsigned long long value)
Create a ConstNode.
Definition: statistics.hh:2807
gem5::statistics::SparseHistInfoProxy
Definition: statistics.hh:2400
gem5::statistics::Vector2dBase::check
bool check() const
Definition: statistics.hh:1257
gem5::statistics::DataWrapVec2d::ysubname
Derived & ysubname(off_type index, const std::string &subname)
Definition: statistics.hh:490
gem5::statistics::DataWrap::DataWrap
DataWrap()=delete
gem5::statistics::FormulaInfoProxy::vec
VResult vec
Definition: statistics.hh:2379
gem5::statistics::ScalarBase::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:602
gem5::statistics::SparseHistStor
Templatized storage and interface for a sparse histogram stat.
Definition: storage.hh:714
gem5::VegaISA::f
Bitfield< 56 > f
Definition: pagetable.hh:53
gem5::statistics::FormulaNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2641
gem5::statistics::Node::total
virtual Result total() const =0
Return the total of the result vector.
gem5::statistics::Formula::reset
void reset()
Formulas don't need to be reset.
Definition: statistics.cc:231
gem5::statistics::DistBase::Params
Stor::Params Params
Definition: statistics.hh:1279
types.hh
gem5::statistics::DistBase::add
void add(DistBase &d)
Add the argument distribution to the this distribution.
Definition: statistics.hh:1360
gem5::statistics::UnaryNode::str
std::string str() const
Definition: statistics.hh:1760
gem5::statistics::BinaryNode::vresult
VResult vresult
Definition: statistics.hh:1772
gem5::statistics::operator+
Temp operator+(Temp l, Temp r)
Definition: statistics.hh:2834
gem5::statistics::InfoAccess::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:211
gem5::statistics::ScalarStatNode
Definition: statistics.hh:1553
gem5::statistics::VectorProxy::VectorProxy
VectorProxy(Stat &s, off_type o, size_type l)
Definition: statistics.hh:1107
gem5::statistics::SparseHistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:2438
warn
#define warn(...)
Definition: logging.hh:246
gem5::statistics::DistInfo
Definition: info.hh:201
gem5::statistics::Histogram::Histogram
Histogram(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2142
gem5::statistics::AvgSampleStor
Templatized storage for distribution that calculates per tick mean and variance.
Definition: storage.hh:638
gem5::statistics::OpString< std::modulus< Result > >::str
static std::string str()
Definition: statistics.hh:1712
gem5::statistics::units::Base
The Base class is the parent class of all unit classes.
Definition: units.hh:122
gem5::statistics::Vector2dBase::y
size_type y
Definition: statistics.hh:1151
gem5::statistics::VectorDistInfo::data
std::vector< DistData > data
Definition: info.hh:211
gem5::statistics::VectorDistBase::Proxy
DistProxy< Derived > Proxy
Definition: statistics.hh:1373
gem5::statistics::FormulaNode::str
std::string str() const
Definition: statistics.hh:2644
gem5::statistics::Distribution
A simple distribution stat.
Definition: statistics.hh:2084
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent=nullptr)
Definition: statistics.hh:2498
gem5::statistics::Result
double Result
All results are doubles.
Definition: types.hh:56
gem5::statistics::FormulaNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2640
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2192
gem5::statistics::ValueProxy::value
Counter value() const
Definition: statistics.hh:655
gem5::statistics::ConstVectorNode::vresult
VResult vresult
Definition: statistics.hh:1653
gem5::statistics::SparseHistBase::storage
char storage[sizeof(Storage)]
The storage for this stat.
Definition: statistics.hh:2420
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::statistics::SampleStor
Templatized storage and interface for a distribution that calculates mean and variance.
Definition: storage.hh:560
gem5::statistics::DistBase::doInit
void doInit()
Definition: statistics.hh:1307
gem5::statistics::ConstNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1645
gem5::statistics::SparseHistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:2476
gem5::statistics::SparseHistBase::Params
Stor::Params Params
Definition: statistics.hh:2416
group.hh
gem5::statistics::Vector::Vector
Vector(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2021
gem5::statistics::sum
Temp sum(Temp val)
Definition: statistics.hh:2878
gem5::statistics::VectorDistBase::storage
std::vector< Storage * > storage
Definition: statistics.hh:1378
gem5::statistics::MethodProxy
A proxy similar to the FunctorProxy, but allows calling a method of a bound object,...
Definition: statistics.hh:699
gem5::statistics::UnaryNode
Definition: statistics.hh:1722
gem5::statistics::ConstNode
Definition: statistics.hh:1636
gem5::statistics::Formula::Temp
friend class Temp
Definition: statistics.hh:2544
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible_v< std::function< Result()>, const T & > > >::value
Counter value() const
Definition: statistics.hh:689
gem5::statistics::VectorBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:991
gem5::statistics::VectorInfo
Definition: info.hh:184
gem5::statistics::resolve
const Info * resolve(const std::string &name)
Definition: statistics.cc:319
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
gem5::statistics::ScalarProxyNode::vresult
VResult vresult
Definition: statistics.hh:1584
gem5::statistics::Vector2dBase::Vector2dBase
Vector2dBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1159
warn_once
#define warn_once(...)
Definition: logging.hh:250
gem5::statistics::Vector2dBase::init
Derived & init(size_type _x, size_type _y)
Definition: statistics.hh:1174
gem5::statistics::AvgSampleStor::Params
Definition: storage.hh:647
gem5::statistics::InfoProxy
Definition: statistics.hh:99
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible_v< std::function< Result()>, const T & > > >::result
Result result() const
Definition: statistics.hh:690
gem5::statistics::DistBase::GEM5_ALIGNED
GEM5_ALIGNED(8) char storage[sizeof(Storage)]
The storage for this stat.
gem5::statistics::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2352
gem5::statistics::OpString< std::minus< Result > >::str
static std::string str()
Definition: statistics.hh:1694
gem5::statistics::ValueProxy::ValueProxy
ValueProxy(T &val)
Definition: statistics.hh:654
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2182
gem5::statistics::Temp::Temp
Temp(const NodePtr &n)
Copy the given pointer to this class.
Definition: statistics.hh:2663
gem5::statistics::FormulaInfoProxy::size
size_type size() const
Definition: statistics.hh:2385
gem5::statistics::ScalarBase::reset
void reset()
Definition: statistics.hh:630
gem5::statistics::Temp::Temp
Temp(const Scalar &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2683
gem5::statistics::VectorStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1628
gem5::statistics::InfoAccess::_info
Info * _info
Definition: statistics.hh:186
gem5::statistics::VectorDistInfoProxy::VectorDistInfoProxy
VectorDistInfoProxy(Stat &stat)
Definition: statistics.hh:169
gem5::statistics::ConstVectorNode::ConstVectorNode
ConstVectorNode(const T &s)
Definition: statistics.hh:1656
gem5::statistics::ScalarBase::result
Result result() const
Definition: statistics.hh:624
gem5::statistics::Temp::Temp
Temp(double value)
Create a ConstNode.
Definition: statistics.hh:2823
gem5::statistics::InfoProxy::prepare
void prepare()
Definition: statistics.hh:108
gem5::statistics::VectorInfo::result
virtual const VResult & result() const =0
gem5::statistics::ProxyInfo::zero
bool zero() const
Definition: statistics.hh:642
gem5::statistics::BinaryNode::r
NodePtr r
Definition: statistics.hh:1771
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2308
gem5::statistics::SparseHistBase::doInit
void doInit()
Definition: statistics.hh:2444
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2212
gem5::statistics::DistProxy::size
size_type size() const
Definition: statistics.hh:1496
sc_dt::to_string
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:91
gem5::statistics::VectorBase::data
const Storage * data(off_type index) const
Retrieve a const pointer to the storage.
Definition: statistics.hh:950
gem5::statistics::VectorStatNode::data
const VectorInfo * data
Definition: statistics.hh:1623
gem5::statistics::Temp
Helper class to construct formula node trees.
Definition: statistics.hh:2650
gem5::statistics::ScalarProxy::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:810
gem5::statistics::ValueBase::size
size_type size() const
Definition: statistics.hh:776
gem5::statistics::BinaryNode::l
NodePtr l
Definition: statistics.hh:1770
gem5::statistics::Temp::Temp
Temp(const Vector &s)
Create a new VectorStatNode.
Definition: statistics.hh:2707
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2221
gem5::statistics::DistProxy::data
Stat::Storage * data()
Definition: statistics.hh:1467
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
gem5::statistics::ScalarBase::total
Result total() const
Definition: statistics.hh:626
gem5::statistics::ConstNode::str
std::string str() const
Definition: statistics.hh:1646
gem5::ArmISA::a
Bitfield< 8 > a
Definition: misc_types.hh:66
gem5::statistics::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:402
gem5::statistics::Average
A stat that calculates the per tick average of a value.
Definition: statistics.hh:1958
gem5::statistics::InfoAccess::InfoAccess
InfoAccess()
Definition: statistics.hh:205
cast.hh
gem5::statistics::StandardDeviation
Calculates the mean and variance of all the samples.
Definition: statistics.hh:2167
gem5::statistics::Vector2d
A 2-Dimensional vecto of scalar stats.
Definition: statistics.hh:2058
gem5::statistics::Temp::Temp
Temp(signed long long value)
Create a ConstNode.
Definition: statistics.hh:2799
gem5::statistics::ScalarProxy::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:855
gem5::statistics::VectorStandardDeviation::init
VectorStandardDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2322
gem5::statistics::Vector2dBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1248
gem5::statistics::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:232
gem5::statistics::UnaryNode::UnaryNode
UnaryNode(NodePtr &p)
Definition: statistics.hh:1729
gem5::statistics::VectorInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:133
gem5::statistics::Vector
A vector of scalar stats.
Definition: statistics.hh:2006
gem5::statistics::ScalarInfo
Definition: info.hh:176
gem5::statistics::ScalarStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1563
gem5::statistics::VectorDistBase::Info
VectorDistInfoProxy< Derived > Info
Definition: statistics.hh:1370
gem5::statistics::ScalarProxyNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1592
gem5::statistics::VectorDistBase::~VectorDistBase
~VectorDistBase()
Definition: statistics.hh:1414
gem5::statistics::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2539
gem5::statistics::Distribution::Distribution
Distribution(Group *parent=nullptr)
Definition: statistics.hh:2087
std::vector< Counter >
gem5::statistics::Temp::Temp
Temp(const Value &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2691
gem5::statistics::DistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:1291
gem5::statistics::DistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:1301
gem5::statistics::ScalarStatNode::vresult
VResult vresult
Definition: statistics.hh:1557
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
gem5::statistics::Temp::Temp
Temp(unsigned short value)
Create a ConstNode.
Definition: statistics.hh:2759
gem5::VegaISA::r
Bitfield< 5 > r
Definition: pagetable.hh:60
gem5::statistics::ScalarBase
Implementation of a scalar stat.
Definition: statistics.hh:520
gem5::statistics::Vector2dBase::prepare
void prepare()
Definition: statistics.hh:1231
gem5::statistics::ValueBase::method
Derived & method(T *obj, V(T::*method)() const)
Extended functor that calls the specified method of the provided object.
Definition: statistics.hh:766
gem5::statistics::VectorDistBase::prepare
void prepare()
Definition: statistics.hh:1443
gem5::statistics::DataWrap
Definition: statistics.hh:228
gem5::statistics::FormulaNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2642
gem5::statistics::DataWrapVec2d::DataWrapVec2d
DataWrapVec2d(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:467
gem5::statistics::units::Unspecified::get
static Unspecified * get()
Definition: units.hh:329
gem5::statistics::ScalarProxyNode::proxy
const ScalarProxy< Stat > proxy
Definition: statistics.hh:1583
gem5::statistics::ScalarProxy::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:898
gem5::statistics::ScalarProxy::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:907
gem5::statistics::ValueBase::total
Result total() const
Definition: statistics.hh:775
gem5::statistics::Temp::Temp
Temp(unsigned long value)
Create a ConstNode.
Definition: statistics.hh:2791
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
gem5::statistics::Node::str
virtual std::string str() const =0
gem5::statistics::Formula::operator/=
const Formula & operator/=(Temp r)
Divide the existing tree by the given one.
Definition: statistics.cc:198
gem5::statistics::DistProxy::index
off_type index
Definition: statistics.hh:1464
gem5::statistics::ScalarProxyNode::ScalarProxyNode
ScalarProxyNode(const ScalarProxy< Stat > &p)
Definition: statistics.hh:1587
gem5::statistics::Temp::Temp
Temp(const ScalarProxy< Stat > &p)
Create a new ScalarProxyNode.
Definition: statistics.hh:2727
gem5::statistics::Formula::result
void result(VResult &vec) const
Return the result of the Fomula in a vector.
Definition: statistics.cc:209
gem5::statistics::VectorAverageDeviation
This is a vector of AverageDeviation stats.
Definition: statistics.hh:2335
gem5::statistics::VectorStatNode::VectorStatNode
VectorStatNode(const VectorInfo *d)
Definition: statistics.hh:1626
gem5::statistics::InfoProxy::s
Stat & s
Definition: statistics.hh:102
gem5::statistics::HistStor::Params
The parameters for a distribution stat.
Definition: storage.hh:460
gem5::statistics::SumNode::str
std::string str() const
Definition: statistics.hh:1908
gem5::statistics::SparseHistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:2471
gem5::statistics::VectorDistInfoProxy
Definition: statistics.hh:166
gem5::statistics::DistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:1328
gem5::statistics::ValueProxy
Definition: statistics.hh:648
gem5::statistics::FormulaNode::formula
const Formula & formula
Definition: statistics.hh:2634
gem5::statistics::SumNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1905
gem5::statistics::UnaryNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1748
gem5::statistics::Temp::Temp
Temp(float value)
Create a ConstNode.
Definition: statistics.hh:2815
gem5::statistics::VectorBase
Implementation of a vector of stats.
Definition: statistics.hh:922
gem5::statistics::Temp::Temp
Temp(const Average &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2699
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible_v< std::function< Result()>, const T & > > >::total
Result total() const
Definition: statistics.hh:691
storage.hh
gem5::statistics::Vector2dBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1156
gem5::statistics::ProxyInfo::str
std::string str() const
Definition: statistics.hh:637
gem5::statistics::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2345
gem5::statistics::constant
Temp constant(T val)
Definition: statistics.hh:2865
gem5::statistics::ScalarInfo::result
virtual Result result() const =0
gem5::statistics::registerHandlers
void registerHandlers(Handler reset_handler, Handler dump_handler)
Definition: statistics.cc:256
gem5::statistics::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:330
gem5::statistics::VectorBase::value
void value(VCounter &vec) const
Definition: statistics.hh:967
gem5::statistics::InfoAccess::newStyleStats
bool newStyleStats() const
Check if the info is new style stats.
Definition: statistics.cc:140
gem5::statistics::FunctorProxy::total
Result total() const
Definition: statistics.hh:670
gem5::statistics::Vector2dInfoProxy
Definition: statistics.hh:175
str.hh
gem5::statistics::ScalarStatNode::data
const ScalarInfo * data
Definition: statistics.hh:1556
gem5::statistics::Average::Average
Average(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1975
gem5::statistics::Histogram::Histogram
Histogram(Group *parent=nullptr)
Definition: statistics.hh:2129
gem5::statistics::DistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:1334
gem5::statistics::ProxyInfo::size
size_type size() const
Definition: statistics.hh:638
gem5::statistics::Scalar::Scalar
Scalar(Group *parent=nullptr)
Definition: statistics.hh:1935
gem5::statistics::VectorStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1627
gem5::statistics::Node::~Node
virtual ~Node()
Definition: statistics.hh:1547
gem5::statistics::FunctorProxy::FunctorProxy
FunctorProxy(T &func)
Definition: statistics.hh:667
gem5::statistics::ScalarProxy::stat
Stat & stat
Pointer to the parent Vector.
Definition: statistics.hh:800
gem5::statistics::Histogram
A simple histogram stat.
Definition: statistics.hh:2126
gem5::statistics::operator/
Temp operator/(Temp l, Temp r)
Definition: statistics.hh:2852
gem5::auxv::Base
@ Base
Definition: aux_vector.hh:74
info.hh
gem5::statistics::ScalarProxy::ScalarProxy
ScalarProxy(const ScalarProxy &sp)
Create a copy of the provided ScalarProxy.
Definition: statistics.hh:832
gem5::statistics::FunctorProxy::value
Counter value() const
Definition: statistics.hh:668
gem5::statistics::Vector2dBase::Params
Stor::Params Params
Definition: statistics.hh:1142
gem5::statistics::BinaryNode::size
size_type size() const override
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1842
gem5::statistics::DataWrap::operator=
DataWrap & operator=(const DataWrap &)=delete
gem5::statistics::ScalarBase::Storage
Stor Storage
Definition: statistics.hh:523
gem5::statistics::Node
Base class for formula statistic node.
Definition: statistics.hh:1523
gem5::Flags< FlagsType >
gem5::statistics::DataWrap::info
Info * info()
Definition: statistics.hh:238
gem5::statistics::OpString< std::plus< Result > >::str
static std::string str()
Definition: statistics.hh:1688
gem5::statistics::ScalarBase::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:586
gem5::statistics::Vector2dBase::Proxy
VectorProxy< Derived > Proxy
Definition: statistics.hh:1143
gem5::statistics::DistBase::Storage
Stor Storage
Definition: statistics.hh:1278
gem5::statistics::VectorStatNode::str
std::string str() const
Definition: statistics.hh:1632
gem5::statistics::ScalarInfo::total
virtual Result total() const =0
gem5::statistics::InfoAccess::info
Info * info()
Grab the information class for this statistic.
Definition: statistics.cc:112
gem5::statistics::VectorDistribution::init
VectorDistribution & init(size_type size, Counter min, Counter max, Counter bkt)
Initialize storage and parameters for this distribution.
Definition: statistics.hh:2278
gem5::statistics::ScalarProxy::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:865
gem5::statistics::SparseHistogram::init
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2524
gem5::statistics::AverageVector
A vector of Average stats.
Definition: statistics.hh:2032
gem5::statistics::SparseHistBase::Info
SparseHistInfoProxy< Derived > Info
Definition: statistics.hh:2414
gem5::statistics::off_type
unsigned int off_type
Definition: types.hh:61
gem5::statistics::Temp::Temp
Temp(unsigned int value)
Create a ConstNode.
Definition: statistics.hh:2775
gem5::ArmISA::b
Bitfield< 7 > b
Definition: misc_types.hh:382
gem5::statistics::Vector2dInfo::cvec
VCounter cvec
Local storage for the entry values, used for printing.
Definition: info.hh:238
gem5::statistics::Output
Definition: output.hh:65
gem5::statistics::VectorStandardDeviation
This is a vector of StandardDeviation stats.
Definition: statistics.hh:2291
gem5::statistics::ScalarBase::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:584
gem5::statistics::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:289
gem5::statistics::Distribution::init
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
Definition: statistics.hh:2113
gem5::statistics::DistProxy::data
const Stat::Storage * data() const
Definition: statistics.hh:1468
gem5::statistics::FunctorProxy::functor
T * functor
Definition: statistics.hh:664
gem5::statistics::Vector2dBase::size
size_type size() const
Definition: statistics.hh:1206
gem5::statistics::Vector2dInfoProxy::total
Result total() const
Definition: statistics.hh:180
gem5::statistics::Value::Value
Value(Group *parent=nullptr)
Definition: statistics.hh:1985
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible_v< std::function< Result()>, const T & > > >::functor
std::function< Result()> functor
Definition: statistics.hh:685
gem5::statistics::MethodProxy::value
Counter value() const
Definition: statistics.hh:708
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::statistics::DataWrapVec2d::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:465
gem5::statistics::VectorProxy::result
const VResult & result() const
Definition: statistics.hh:1087
gem5::ArmISA::cc_reg::V
constexpr RegId V(CCRegClass, _VIdx)
gem5::statistics::VectorBase::doInit
void doInit(size_type s)
Definition: statistics.hh:953
gem5::statistics::SparseHistInfo
Definition: info.hh:251
gem5::statistics::ScalarBase::GEM5_ALIGNED
GEM5_ALIGNED(8) char storage[sizeof(Storage)]
The storage of this stat.
gem5::statistics::VectorInfoProxy::rvec
VResult rvec
Definition: statistics.hh:134
gem5::statistics::VectorDistBase::doInit
void doInit(size_type s)
Definition: statistics.hh:1394
gem5::statistics::Vector2dBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:1222
gem5::statistics::statsMap
MapType & statsMap()
Definition: statistics.cc:69
gem5::statistics::VectorBase::Proxy
ScalarProxy< Derived > Proxy
Proxy type.
Definition: statistics.hh:929
gem5::statistics::Vector2dBase::data
Storage * data(off_type index)
Definition: statistics.hh:1155
gem5::statistics::enable
void enable()
Definition: statistics.cc:292
gem5::statistics::ScalarBase::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:610
gem5::statistics::ValueBase::prepare
void prepare()
Definition: statistics.hh:781
gem5::statistics::DataWrap::unit
Derived & unit(const units::Base *_unit)
Set the unit of the stat.
Definition: statistics.hh:321
gem5::statistics::ValueBase
Definition: statistics.hh:714
gem5::statistics::ConstVectorNode
Definition: statistics.hh:1650
gem5::statistics::DataWrapVec::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:383
gem5::ArmISA::d
Bitfield< 9 > d
Definition: misc_types.hh:64
gem5::statistics::VectorProxy
Definition: statistics.hh:1061
gem5::statistics::ValueBase::result
Result result() const
Definition: statistics.hh:774
gem5::statistics::UnaryNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1757
gem5::statistics::VectorBase::result
void result(VResult &vec) const
Copy the values to a local vector and return a reference to it.
Definition: statistics.hh:979
gem5::statistics::VectorDistBase::Storage
Stor Storage
Definition: statistics.hh:1371
gem5::statistics::FormulaInfoProxy
Definition: statistics.hh:2376
gem5::statistics::ValueBase::check
bool check() const
Definition: statistics.hh:780
gem5::statistics::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:426
gem5::statistics::VectorProxy::operator[]
ScalarProxy< Stat > operator[](off_type index)
Definition: statistics.hh:1127
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2073
gem5::statistics::ScalarProxy::operator=
const ScalarProxy & operator=(const ScalarProxy &sp)
Set this proxy equal to the provided one.
Definition: statistics.hh:842
gem5::statistics::SumNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1890
gem5::statistics::ConstVectorNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1669
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible_v< std::function< Result()>, const T & > > >::FunctorProxy
FunctorProxy(const T &func)
Definition: statistics.hh:688
gem5::statistics::DistProxy::reset
void reset()
Proxy has no state.
Definition: statistics.hh:1510
gem5::statistics::OpString
Definition: statistics.hh:1683
gem5::statistics::InfoAccess::zero
bool zero() const
Definition: statistics.hh:217
gem5::statistics::Temp::Temp
Temp(unsigned char value)
Create a ConstNode.
Definition: statistics.hh:2743
gem5::statistics::ScalarBase::Params
Stor::Params Params
Definition: statistics.hh:524
gem5::statistics::OpString< std::divides< Result > >::str
static std::string str()
Definition: statistics.hh:1706
gem5::statistics::Vector2dBase::zero
bool zero() const
Definition: statistics.hh:1212
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2504
gem5::statistics::reset
void reset()
Definition: statistics.cc:310
gem5::statistics::dump
void dump()
Dump all statistics data to the registered outputs.
Definition: statistics.cc:301
gem5::statistics::ValueProxy::result
Result result() const
Definition: statistics.hh:656
gem5::statistics::Value::Value
Value(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1990
gem5::statistics::display
const FlagsType display
Print this stat.
Definition: info.hh:58
gem5::statistics::DistInfo::data
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:205
gem5::statistics::ConstVectorNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1657
gem5::statistics::SparseHistBase::prepare
void prepare()
Definition: statistics.hh:2479
gem5::statistics::Temp::Temp
Temp(signed long value)
Create a ConstNode.
Definition: statistics.hh:2783
gem5::statistics::VectorStatNode
Definition: statistics.hh:1620
gem5::statistics::ValueProxy::scalar
T * scalar
Definition: statistics.hh:651
gem5::statistics::DistBase::DistBase
DistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1314
gem5::statistics::ScalarInfoProxy::total
Result total() const
Definition: statistics.hh:126
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2261
gem5::statistics::VectorBase::operator[]
Proxy operator[](off_type index)
Return a reference (ScalarProxy) to the stat at the given index.
Definition: statistics.hh:1053
gem5::statistics::VectorDistBase::size
size_type size() const
Definition: statistics.hh:1428
gem5::statistics::DistProxy::DistProxy
DistProxy(const DistProxy &sp)
Definition: statistics.hh:1475
gem5::statistics::ScalarBase::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:594
gem5::statistics::DataWrapVec2d::ysubname
std::string ysubname(off_type i) const
Definition: statistics.hh:502
gem5::statistics::InfoAccess::setInit
void setInit()
Save Storage class parameters if any.
Definition: statistics.cc:106
gem5::ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:144
gem5::statistics::VectorStatNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1630
gem5::statistics::registerResetCallback
void registerResetCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are reset.
Definition: statistics.cc:278
gem5::statistics::Node::result
virtual const VResult & result() const =0
Return the result vector of this subtree.
gem5::statistics::ValueBase::str
std::string str() const
Definition: statistics.hh:778
gem5::statistics::ScalarProxy::ScalarProxy
ScalarProxy(Stat &s, off_type i)
Create and initialize this proxy, do not register it with the database.
Definition: statistics.hh:823
cprintf.hh
gem5::statistics::processDumpQueue
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
Definition: statistics.cc:272
gem5::statistics::ScalarBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:549
gem5::statistics::ValueBase::proxy
ProxyInfo * proxy
Definition: statistics.hh:717
gem5::statistics::ConstVectorNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1660
gem5::statistics::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:305
compiler.hh
gem5::statistics::SumNode
Definition: statistics.hh:1864
gem5::statistics::ValueBase::functor
Derived & functor(const T &func)
Definition: statistics.hh:741
gem5::statistics::Temp::Temp
Temp(const AverageVector &s)
Definition: statistics.hh:2711
gem5::statistics::Vector2dBase
Definition: statistics.hh:1137
gem5::statistics::SparseHistBase::Storage
Stor Storage
Definition: statistics.hh:2415
gem5::statistics::DataWrapVec2d
Definition: statistics.hh:462
gem5::statistics::VectorProxy::operator=
const VectorProxy & operator=(const VectorProxy &sp)
Definition: statistics.hh:1118
gem5::statistics::VectorProxy::offset
off_type offset
Definition: statistics.hh:1065
gem5::X86ISA::delivery_mode::names
static const char *const names[NumModes]
Definition: intmessage.hh:70
gem5::statistics::InfoProxy::zero
bool zero() const
Definition: statistics.hh:115
gem5::statistics::ScalarInfoProxy::ScalarInfoProxy
ScalarInfoProxy(Stat &stat)
Definition: statistics.hh:122
gem5::statistics::ScalarProxy::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:860
gem5::statistics::VectorProxy::stat
Stat & stat
Definition: statistics.hh:1064
gem5::statistics::Vector2dBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:1197
gem5::statistics::ScalarBase::zero
bool zero() const
Definition: statistics.hh:628
gem5::statistics::ProxyInfo::prepare
void prepare()
Prepare the stat for dumping.
Definition: statistics.hh:640
gem5::statistics::VectorDistBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:1421
gem5::statistics::DataWrap::precision
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
Definition: statistics.hh:346
gem5::statistics::size_type
unsigned int size_type
Definition: types.hh:60
gem5::statistics::Formula::root
NodePtr root
The root of the tree which represents the Formula.
Definition: statistics.hh:2543
gem5::statistics::Temp::node
NodePtr node
Pointer to a Node object.
Definition: statistics.hh:2656
gem5::statistics::SparseHistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:2465
gem5::statistics::Output::visit
virtual void visit(const ScalarInfo &info)=0
gem5::statistics::FormulaInfoProxy::total
Result total() const
Definition: statistics.hh:2393
gem5::statistics::UnaryNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1732
gem5::debugDumpStats
void debugDumpStats()
Definition: statistics.cc:338
gem5::statistics::SparseHistInfoProxy::SparseHistInfoProxy
SparseHistInfoProxy(Stat &stat)
Definition: statistics.hh:2403
gem5::statistics::Scalar::Scalar
Scalar(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1941
gem5::statistics::VectorInfo::total
virtual Result total() const =0
gem5::statistics::BinaryNode::str
std::string str() const override
Definition: statistics.hh:1857
gem5::statistics::InfoAccess
Definition: statistics.hh:183
gem5::statistics::Temp::Temp
Temp(const Formula &f)
Definition: statistics.hh:2718
gem5::statistics::VectorBase::VectorBase
VectorBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1020
gem5::statistics::Average::Average
Average(Group *parent=nullptr)
Definition: statistics.hh:1963
gem5::statistics::FormulaInfoProxy::str
std::string str() const
Definition: statistics.hh:2396
gem5::statistics::DistProxy::operator=
const DistProxy & operator=(const DistProxy &sp)
Definition: statistics.hh:1480
gem5::statistics::SumNode::SumNode
SumNode(NodePtr &p)
Definition: statistics.hh:1871
gem5::statistics::DistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:1339
gem5::statistics::Histogram::init
Histogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2154
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::statistics::Distribution::Distribution
Distribution(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2099
gem5::statistics::VectorBase::~VectorBase
~VectorBase()
Definition: statistics.hh:1027
gem5::statistics::ScalarStatNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1571
gem5::statistics::Vector2dInfo::y
size_type y
Definition: info.hh:235
name
const std::string & name()
Definition: trace.cc:49
gem5::statistics::VectorBase::zero
bool zero() const
Definition: statistics.hh:1005
gem5::statistics::FormulaNode::FormulaNode
FormulaNode(const Formula &f)
Definition: statistics.hh:2638
gem5::statistics::FormulaNode
Definition: statistics.hh:2631
gem5::statistics::Temp::getNodePtr
NodePtr getNodePtr() const
Makde gcc < 4.6.3 happy and explicitly get the underlying node.
Definition: statistics.hh:2676
gem5::statistics::Handler
void(* Handler)()
Register reset and dump handlers.
Definition: statistics.hh:2895
gem5::statistics::ValueBase::functor
Derived & functor(T &func)
Definition: statistics.hh:750
gem5::statistics::ConstNode::ConstNode
ConstNode(T s)
Definition: statistics.hh:1642
gem5::statistics::Value::Value
Value(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1995
gem5::statistics::ScalarProxyNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1605
gem5::statistics::MethodProxy::MethodPointer
V(T::* MethodPointer)() const
Definition: statistics.hh:703
gem5::statistics::VectorProxy::data
const Stat::Storage * data(off_type index) const
Definition: statistics.hh:1079
gem5::statistics::DataWrap::DataWrap
DataWrap(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:255
gem5::statistics::Vector2dBase::~Vector2dBase
~Vector2dBase()
Definition: statistics.hh:1166
gem5::statistics::DataWrapVec::DataWrapVec
DataWrapVec(Group *parent=nullptr, const char *name=nullptr, const units::Base *unit=units::Unspecified::get(), const char *desc=nullptr)
Definition: statistics.hh:385
gem5::statistics::enabled
bool enabled()
Definition: statistics.cc:286
gem5::statistics::VectorDistBase::zero
bool zero() const
Definition: statistics.hh:1434
gem5::statistics::statsList
std::list< Info * > & statsList()
Definition: statistics.cc:62
gem5::statistics::VectorDistBase
Definition: statistics.hh:1367
gem5::statistics::ScalarBase::doInit
void doInit()
Definition: statistics.hh:555
gem5::statistics::Scalar::Scalar
Scalar(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1947
gem5::statistics::VectorDistBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1388
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2301
gem5::statistics::ScalarStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1569
gem5::statistics::Vector2dInfoProxy::Vector2dInfoProxy
Vector2dInfoProxy(Stat &stat)
Definition: statistics.hh:178
gem5::statistics::Info::setName
void setName(const std::string &name, bool old_style=true)
Set the name of this statistic.
Definition: info.cc:128
gem5::statistics::BinaryNode::total
Result total() const override
Return the total of the result vector.
Definition: statistics.hh:1810
gem5::statistics::ScalarBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:537
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2041
gem5::statistics::Vector::Vector
Vector(Group *parent=nullptr)
Definition: statistics.hh:2009
gem5::VegaISA::v
Bitfield< 0 > v
Definition: pagetable.hh:65
gem5::statistics::Formula::str
std::string str() const
Definition: statistics.cc:247
gem5::statistics::BinaryNode::BinaryNode
BinaryNode(NodePtr &a, NodePtr &b)
Definition: statistics.hh:1775
gem5::statistics::ConstNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1644
gem5::statistics::SumNode::vresult
VResult vresult
Definition: statistics.hh:1868
gem5::statistics::ValueBase::ValueBase
ValueBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:720
gem5::statistics::DistInfoProxy::DistInfoProxy
DistInfoProxy(Stat &stat)
Definition: statistics.hh:162
gem5::statistics::DataWrap::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:231
gem5::statistics::InfoAccess::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:224
units.hh
gem5::statistics::SumNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1874
gem5::statistics::VectorInfoProxy::total
Result total() const
Definition: statistics.hh:155
gem5::statistics::ScalarInfoProxy
Definition: statistics.hh:119
gem5::statistics::DataWrapVec::reset
void reset()
Definition: statistics.hh:450
gem5::statistics::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:334
gem5::statistics::ConstNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1643
gem5::statistics::SparseHistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:2489
gem5::statistics::MethodProxy::result
Result result() const
Definition: statistics.hh:709
gem5::statistics::SparseHistBase::SparseHistBase
SparseHistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:2451
gem5::statistics::ScalarInfoProxy::value
Counter value() const
Definition: statistics.hh:124
gem5::statistics::Temp::Temp
Temp(signed int value)
Create a ConstNode.
Definition: statistics.hh:2767
gem5::statistics::VectorProxy::data
Stat::Storage * data(off_type index)
Definition: statistics.hh:1072
gem5::statistics::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:372
gem5::statistics::UnaryNode::l
NodePtr l
Definition: statistics.hh:1725
gem5::statistics::StorageParams
Definition: storage.hh:49
gem5::statistics::VectorDistInfo
Definition: info.hh:208
std
Overload hash function for BasicBlockRange type.
Definition: misc.hh:2388
gem5::statistics::VectorInfo::size
virtual size_type size() const =0
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:456
types.hh
gem5::statistics::VectorProxy::VectorProxy
VectorProxy(const VectorProxy &sp)
Definition: statistics.hh:1112
gem5::statistics::VectorDistInfoProxy::size
size_type size() const
Definition: statistics.hh:171
gem5::statistics::processResetQueue
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
Definition: statistics.cc:266
gem5::statistics::VectorInfoProxy
Definition: statistics.hh:130
gem5::statistics::constantVector
Temp constantVector(T val)
Definition: statistics.hh:2872
gem5::statistics::DistBase::prepare
void prepare()
Definition: statistics.hh:1342
gem5::statistics::VectorDistBase::Params
Stor::Params Params
Definition: statistics.hh:1372
gem5::statistics::Formula::operator=
const Formula & operator=(const Temp &r)
Set an unitialized Formula to the given root.
Definition: statistics.cc:174
gem5::statistics::FormulaInfoProxy::value
VCounter & value() const
Definition: statistics.hh:2394
gem5::statistics::VectorDistBase::VectorDistBase
VectorDistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1407
gem5::statistics::ScalarProxy
A proxy class to access the stat at a given index in a VectorBase stat.
Definition: statistics.hh:796
gem5::statistics::MapType
std::map< const void *, Info * > MapType
Definition: statistics.hh:2923
gem5::PowerISA::vec
Bitfield< 25 > vec
Definition: misc.hh:108
gem5::statistics::Vector2dInfo::x
size_type x
Definition: info.hh:234
gem5::statistics::SparseHistInfo::data
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:255
gem5::statistics::VectorDistBase::data
Storage * data(off_type index)
Definition: statistics.hh:1382
gem5::statistics::Value
Definition: statistics.hh:1982
gem5::statistics::SparseHistStor::Params
The parameters for a sparse histogram stat.
Definition: storage.hh:724
gem5::statistics::Node::size
virtual size_type size() const =0
Return the number of nodes in the subtree starting at this node.
gem5::statistics::VectorBase::Params
Stor::Params Params
Definition: statistics.hh:926
gem5::statistics::DataWrap::info
const Info * info() const
Definition: statistics.hh:245
gem5::statistics::DistProxy::sample
void sample(const U &v, int n=1)
Definition: statistics.hh:1490
gem5::statistics::NodePtr
std::shared_ptr< Node > NodePtr
Shared pointer to a function Node.
Definition: statistics.hh:1551
gem5::statistics::VectorAverageDeviation::init
VectorAverageDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2366
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
gem5::statistics::SparseHistogram
Definition: statistics.hh:2495
output.hh
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2047
gem5::statistics::ScalarInfo::value
virtual Counter value() const =0
gem5::statistics::ScalarBase::ScalarBase
ScalarBase(Group *parent=nullptr, const char *name=nullptr, const units::Base *unit=units::Unspecified::get(), const char *desc=nullptr)
Definition: statistics.hh:562
gem5::statistics::InfoProxy::visit
void visit(Output &visitor)
Definition: statistics.hh:111
gem5::statistics::ValueBase::reset
void reset()
Definition: statistics.hh:782
logging.hh
gem5::statistics::ScalarInfoProxy::result
Result result() const
Definition: statistics.hh:125
gem5::statistics::OpString< std::multiplies< Result > >::str
static std::string str()
Definition: statistics.hh:1700
gem5::statistics::VectorBase::size
size_type size() const
Definition: statistics.hh:1002
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::statistics::Group::addStat
void addStat(statistics::Info *info)
Register a stat with this group.
Definition: group.cc:109
gem5::statistics::FunctorProxy
Definition: statistics.hh:661
gem5::statistics::ValueBase::scalar
Derived & scalar(T &value)
Definition: statistics.hh:732
gem5::statistics::DataWrap::name
const std::string & name() const
Definition: statistics.hh:296
gem5::statistics::DataWrapVec2d::ysubnames
Derived & ysubnames(const char **names)
Definition: statistics.hh:478
gem5::statistics::DataWrapVec::prepare
void prepare()
Definition: statistics.hh:439
gem5::statistics::Formula::prepare
void prepare()
Definition: statistics.hh:2616
gem5::statistics::HistStor
Templatized storage and interface for a histogram stat.
Definition: storage.hh:399
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent=nullptr)
Definition: statistics.hh:2035
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2511
gem5::statistics::InfoProxy::reset
void reset()
Definition: statistics.hh:109
gem5::VegaISA::l
Bitfield< 55 > l
Definition: pagetable.hh:54
gem5::statistics::ConstVectorNode::str
std::string str() const
Definition: statistics.hh:1671
gem5::statistics::FunctorProxy::result
Result result() const
Definition: statistics.hh:669
gem5::statistics::FormulaInfoProxy::FormulaInfoProxy
FormulaInfoProxy(Stat &stat)
Definition: statistics.hh:2383
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2231
gem5::statistics::DataWrap::setSeparator
const std::string & setSeparator() const
Definition: statistics.hh:310
gem5::statistics::ScalarBase::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:581
gem5::statistics::BinaryNode
Definition: statistics.hh:1767
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent=nullptr)
Definition: statistics.hh:2061
gem5::statistics::ValueBase::value
Counter value()
Definition: statistics.hh:773
gem5::statistics::MethodProxy::object
T * object
Definition: statistics.hh:702
gem5::statistics::MethodProxy::method
MethodPointer method
Definition: statistics.hh:704
gem5::statistics::StatStor
Templatized storage and interface for a simple scalar stat.
Definition: storage.hh:57
gem5::statistics::FormulaInfoProxy::result
const VResult & result() const
Definition: statistics.hh:2388
gem5::statistics::ScalarBase::prepare
void prepare()
Definition: statistics.hh:631
gem5::statistics::ScalarStatNode::str
std::string str() const
Definition: statistics.hh:1576
gem5::statistics::DistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1352
gem5::statistics::ScalarProxy::str
std::string str() const
Definition: statistics.hh:911
gem5::statistics::DistProxy::DistProxy
DistProxy(Stat &s, off_type i)
Definition: statistics.hh:1471
gem5::statistics::SumNode::l
NodePtr l
Definition: statistics.hh:1867
gem5::statistics::ScalarProxy::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:874
gem5::statistics::VectorDistribution
A vector of distributions.
Definition: statistics.hh:2245
gem5::statistics::VectorBase::check
bool check() const
Definition: statistics.hh:1014
gem5::statistics::DataWrap::flags
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:358
gem5::statistics::Average::Average
Average(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1969
gem5::statistics::VectorProxy::len
size_type len
Definition: statistics.hh:1066
gem5::statistics::Vector::Vector
Vector(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2015
gem5::statistics::Vector2dBase::Storage
Stor Storage
Definition: statistics.hh:1141
gem5::statistics::InfoAccess::setInfo
void setInfo(Group *parent, Info *info)
Set up an info class for this statistic.
Definition: statistics.cc:76
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2067
gem5::statistics::VectorInfoProxy::value
VCounter & value() const
Definition: statistics.hh:142
gem5::statistics::FormulaInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:2380
std::list
STL list class.
Definition: stl.hh:51
gem5::ArmISA::sp
Bitfield< 0 > sp
Definition: misc_types.hh:75
gem5::statistics::Formula::operator+=
const Formula & operator+=(Temp r)
Add the given tree to the existing one.
Definition: statistics.cc:184
gem5::statistics::Vector2dBase::storage
std::vector< Storage * > storage
Definition: statistics.hh:1152
intmath.hh
gem5::statistics::DistProxy::stat
Stat & stat
Definition: statistics.hh:1463
gem5::statistics::Temp::Temp
Temp(NodePtr &&n)
Definition: statistics.hh:2665
gem5::statistics::SparseHistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:2428
gem5::statistics::ScalarProxyNode::str
std::string str() const
Definition: statistics.hh:1614
gem5::statistics::VectorProxy::vec
VResult vec
Definition: statistics.hh:1069
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent=nullptr)
Definition: statistics.hh:2248
gem5::statistics::Temp::Temp
Temp(signed short value)
Create a ConstNode.
Definition: statistics.hh:2751
gem5::statistics::ScalarBase::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:576
gem5::statistics::ValueBase::~ValueBase
~ValueBase()
Definition: statistics.hh:728
fatal_if
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition: logging.hh:226
gem5::statistics::ValueProxy::total
Result total() const
Definition: statistics.hh:657
gem5::statistics::DistBase::Info
DistInfoProxy< Derived > Info
Definition: statistics.hh:1277
gem5::statistics::ProxyInfo
Definition: statistics.hh:634
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::statistics::DistStor::Params
The parameters for a distribution stat.
Definition: storage.hh:262
gem5::statistics::Formula::total
Result total() const
Return the total Formula result.
Definition: statistics.cc:216
gem5::statistics::VectorInfoProxy::size
size_type size() const
Definition: statistics.hh:139
gem5::statistics::DataWrapVec
Definition: statistics.hh:380
gem5::statistics::ScalarProxy::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:886
gem5::statistics::SparseHistBase
Implementation of a sparse histogram stat.
Definition: statistics.hh:2411
gem5::statistics::VectorBase::init
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1040
gem5::statistics::InfoAccess::setParams
void setParams(const StorageParams *params)
Save Storage class parameters if any.
Definition: statistics.cc:100
gem5::statistics::operator*
Temp operator*(Temp l, Temp r)
Definition: statistics.hh:2846
gem5::statistics::VectorProxy::total
Result total() const
Definition: statistics.hh:1098
gem5::statistics::ScalarBase::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:616
gem5::statistics::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent=nullptr)
Definition: statistics.hh:2339
gem5::statistics::VectorInfoProxy::VectorInfoProxy
VectorInfoProxy(Stat &stat)
Definition: statistics.hh:137
gem5::statistics::ScalarProxyNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1599
gem5::statistics::MethodProxy::MethodProxy
MethodProxy(T *obj, MethodPointer meth)
Definition: statistics.hh:707
gem5::statistics::AverageDeviation
Calculates the per tick mean and variance of the samples.
Definition: statistics.hh:2206
gem5::statistics::Info::getStorageParams
StorageParams const * getStorageParams() const
Getter for the storage params.
Definition: info.cc:85
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent=nullptr)
Definition: statistics.hh:2295
gem5::statistics::FormulaNode::vec
VResult vec
Definition: statistics.hh:2635
gem5::statistics::ScalarProxy::result
Result result() const
Return the current value of this statas a result type.
Definition: statistics.hh:816
gem5::statistics::ProxyInfo::visit
void visit(Output &visitor)
Visitor entry for outputing statistics data.
Definition: statistics.hh:644
gem5::X86ISA::op
Bitfield< 4 > op
Definition: types.hh:83
gem5::statistics::VectorProxy::size
size_type size() const
Definition: statistics.hh:1133
gem5::statistics::Formula::size
size_type size() const
Return the number of elements in the tree.
Definition: statistics.cc:222
gem5::statistics::ScalarProxyNode
Definition: statistics.hh:1580
gem5::statistics::Vector2dBase::Info
Vector2dInfoProxy< Derived > Info
Definition: statistics.hh:1140
gem5::statistics::VectorDistBase::check
bool check() const
Definition: statistics.hh:1453
gem5::statistics::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:145
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2254
gem5::statistics::InfoProxy::InfoProxy
InfoProxy(Stat &stat)
Definition: statistics.hh:105
gem5::statistics::VectorBase::Storage
Stor Storage
Definition: statistics.hh:925
gem5::statistics::Formula::operator=
const Formula & operator=(const T &v)
Definition: statistics.hh:2570
gem5::ArmISA::rs
Bitfield< 9, 8 > rs
Definition: misc_types.hh:377
gem5::statistics::Histogram::Histogram
Histogram(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2135
gem5::statistics::DistProxy::zero
bool zero() const
Definition: statistics.hh:1502
gem5::statistics::ScalarStatNode::ScalarStatNode
ScalarStatNode(const ScalarInfo *d)
Definition: statistics.hh:1560
gem5::statistics::Distribution::Distribution
Distribution(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2093
gem5::statistics::Info::name
std::string name
The name of the stat.
Definition: info.hh:84
gem5::statistics::UnaryNode::vresult
VResult vresult
Definition: statistics.hh:1726
gem5::statistics::FormulaInfo
Definition: info.hh:245
gem5::statistics::VectorBase::data
Storage * data(off_type index)
Retrieve the storage.
Definition: statistics.hh:943
gem5::statistics::Vector2dInfo
Definition: info.hh:226
gem5::statistics::Temp::Temp
Temp(signed char value)
Create a ConstNode.
Definition: statistics.hh:2735
gem5::statistics::Formula::zero
bool zero() const
Definition: statistics.cc:236
gem5::statistics::Vector2dBase::x
size_type x
Definition: statistics.hh:1150
gem5::statistics::InfoProxy::check
bool check() const
Definition: statistics.hh:107
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2173
gem5::statistics::ScalarProxy::index
off_type index
The index to access in the parent VectorBase.
Definition: statistics.hh:803
gem5::statistics::Info
Definition: info.hh:80
gem5::statistics::MethodProxy::total
Result total() const
Definition: statistics.hh:710
gem5::statistics::ConstNode::vresult
VResult vresult
Definition: statistics.hh:1639
gem5::statistics::ProxyInfo::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:641
gem5::statistics::operator-
Temp operator-(Temp l, Temp r)
Definition: statistics.hh:2840
gem5::statistics::AvgStor
Templatized storage and interface to a per-tick average stat.
Definition: storage.hh:127
gem5::statistics::ScalarBase::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:622
gem5::statistics::VectorBase::storage
std::vector< Storage * > storage
The storage of this stat.
Definition: statistics.hh:935
gem5::statistics::VectorInfoProxy::result
const VResult & result() const
Definition: statistics.hh:149

Generated on Thu Jul 28 2022 13:32:27 for gem5 by doxygen 1.8.17