gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 namespace statistics
95 {
96 
97 template <class Stat, class Base>
98 class InfoProxy : public Base
99 {
100  protected:
101  Stat &s;
102 
103  public:
104  InfoProxy(Stat &stat) : s(stat) {}
105 
106  bool check() const { return s.check(); }
107  void prepare() { s.prepare(); }
108  void reset() { s.reset(); }
109  void
110  visit(Output &visitor)
111  {
112  visitor.visit(*static_cast<Base *>(this));
113  }
114  bool zero() const { return s.zero(); }
115 };
116 
117 template <class Stat>
118 class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo>
119 {
120  public:
121  ScalarInfoProxy(Stat &stat) : InfoProxy<Stat, ScalarInfo>(stat) {}
122 
123  Counter value() const { return this->s.value(); }
124  Result result() const { return this->s.result(); }
125  Result total() const { return this->s.total(); }
126 };
127 
128 template <class Stat>
129 class VectorInfoProxy : public InfoProxy<Stat, VectorInfo>
130 {
131  protected:
132  mutable VCounter cvec;
133  mutable VResult rvec;
134 
135  public:
136  VectorInfoProxy(Stat &stat) : InfoProxy<Stat, VectorInfo>(stat) {}
137 
138  size_type size() const { return this->s.size(); }
139 
140  VCounter &
141  value() const
142  {
143  this->s.value(cvec);
144  return cvec;
145  }
146 
147  const VResult &
148  result() const
149  {
150  this->s.result(rvec);
151  return rvec;
152  }
153 
154  Result total() const { return this->s.total(); }
155 };
156 
157 template <class Stat>
158 class DistInfoProxy : public InfoProxy<Stat, DistInfo>
159 {
160  public:
161  DistInfoProxy(Stat &stat) : InfoProxy<Stat, DistInfo>(stat) {}
162 };
163 
164 template <class Stat>
165 class VectorDistInfoProxy : public InfoProxy<Stat, VectorDistInfo>
166 {
167  public:
168  VectorDistInfoProxy(Stat &stat) : InfoProxy<Stat, VectorDistInfo>(stat) {}
169 
170  size_type size() const { return this->s.size(); }
171 };
172 
173 template <class Stat>
174 class Vector2dInfoProxy : public InfoProxy<Stat, Vector2dInfo>
175 {
176  public:
177  Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {}
178 
179  Result total() const { return this->s.total(); }
180 };
181 
183 {
184  private:
186 
187  protected:
189  void setInfo(Group *parent, Info *info);
191  void setParams(const StorageParams *params);
193  void setInit();
194 
196  Info *info();
198  const Info *info() const;
199 
201  bool newStyleStats() const;
202 
203  public:
205  : _info(nullptr) {};
206 
210  void reset() { }
211 
216  bool zero() const { return true; }
217 
223  bool check() const { return true; }
224 };
225 
226 template <class Derived, template <class> class InfoProxyType>
227 class DataWrap : public InfoAccess
228 {
229  public:
230  typedef InfoProxyType<Derived> Info;
231 
232  protected:
233  Derived &self() { return *static_cast<Derived *>(this); }
234 
235  protected:
236  Info *
238  {
239  return safe_cast<Info *>(InfoAccess::info());
240  }
241 
242  public:
243  const Info *
244  info() const
245  {
246  return safe_cast<const Info *>(InfoAccess::info());
247  }
248 
249  public:
250  DataWrap() = delete;
251  DataWrap(const DataWrap &) = delete;
252  DataWrap &operator=(const DataWrap &) = delete;
253 
254  DataWrap(Group *parent, const char *name, const units::Base *unit,
255  const char *desc)
256  {
257  auto info = new Info(self());
258  this->setInfo(parent, info);
259 
260  if (parent)
261  parent->addStat(info);
262 
263  if (name) {
264  info->setName(name, !newStyleStats());
265  info->flags.set(display);
266  }
267 
268  info->unit = unit;
269 
270  if (desc)
271  info->desc = desc;
272 
273  // Stat that does not belong to any statistics::Group is a legacy stat
274  std::string common_message = "Legacy stat is a stat that does not "
275  "belong to any statistics::Group. Legacy stat is deprecated.";
276  if (parent == nullptr && name != nullptr)
277  warn(csprintf("`%s` is a legacy stat. %s", name, common_message));
278  else if (parent == nullptr)
279  warn_once("One of the stats is a legacy stat. " + common_message);
280  }
281 
287  Derived &
288  name(const std::string &name)
289  {
290  Info *info = this->info();
291  info->setName(name, !newStyleStats());
292  info->flags.set(display);
293  return this->self();
294  }
295  const std::string &name() const { return this->info()->name; }
296 
303  Derived &
304  setSeparator(const std::string &_sep)
305  {
306  this->info()->setSeparator(_sep);
307  return this->self();
308  }
309  const std::string &setSeparator() const
310  {
311  return this->info()->separatorString;
312  }
313 
319  Derived &
320  unit(const units::Base *_unit)
321  {
322  this->info()->unit = _unit;
323  return this->self();
324  }
325 
332  Derived &
333  desc(const std::string &_desc)
334  {
335  this->info()->desc = _desc;
336  return this->self();
337  }
338 
344  Derived &
345  precision(int _precision)
346  {
347  this->info()->precision = _precision;
348  return this->self();
349  }
350 
356  Derived &
357  flags(Flags _flags)
358  {
359  this->info()->flags.set(_flags);
360  return this->self();
361  }
362 
369  template <class Stat>
370  Derived &
371  prereq(const Stat &prereq)
372  {
373  this->info()->prereq = prereq.info();
374  return this->self();
375  }
376 };
377 
378 template <class Derived, template <class> class InfoProxyType>
379 class DataWrapVec : public DataWrap<Derived, InfoProxyType>
380 {
381  public:
382  typedef InfoProxyType<Derived> Info;
383 
384  DataWrapVec(Group *parent = nullptr, const char *name = nullptr,
386  const char *desc = nullptr)
387  : DataWrap<Derived, InfoProxyType>(parent, name, unit, desc)
388  {}
389 
390  // The following functions are specific to vectors. If you use them
391  // in a non vector context, you will get a nice compiler error!
392 
400  Derived &
401  subname(off_type index, const std::string &name)
402  {
403  Derived &self = this->self();
404  Info *info = self.info();
405 
406  std::vector<std::string> &subn = info->subnames;
407  if (subn.size() <= index)
408  subn.resize(index + 1);
409  subn[index] = name;
410  return self;
411  }
412 
413  // The following functions are specific to 2d vectors. If you use
414  // them in a non vector context, you will get a nice compiler
415  // error because info doesn't have the right variables.
416 
424  Derived &
425  subdesc(off_type index, const std::string &desc)
426  {
427  Info *info = this->info();
428 
429  std::vector<std::string> &subd = info->subdescs;
430  if (subd.size() <= index)
431  subd.resize(index + 1);
432  subd[index] = desc;
433 
434  return this->self();
435  }
436 
437  void
439  {
440  Derived &self = this->self();
441  Info *info = this->info();
442 
443  size_t size = self.size();
444  for (off_type i = 0; i < size; ++i)
445  self.data(i)->prepare(info->getStorageParams());
446  }
447 
448  void
450  {
451  Derived &self = this->self();
452  Info *info = this->info();
453 
454  size_t size = self.size();
455  for (off_type i = 0; i < size; ++i)
456  self.data(i)->reset(info->getStorageParams());
457  }
458 };
459 
460 template <class Derived, template <class> class InfoProxyType>
461 class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType>
462 {
463  public:
464  typedef InfoProxyType<Derived> Info;
465 
466  DataWrapVec2d(Group *parent, const char *name,
467  const units::Base *unit, const char *desc)
468  : DataWrapVec<Derived, InfoProxyType>(parent, name, unit, desc)
469  {
470  }
471 
476  Derived &
477  ysubnames(const char **names)
478  {
479  Derived &self = this->self();
480  Info *info = this->info();
481 
482  info->y_subnames.resize(self.y);
483  for (off_type i = 0; i < self.y; ++i)
484  info->y_subnames[i] = names[i];
485  return self;
486  }
487 
488  Derived &
489  ysubname(off_type index, const std::string &subname)
490  {
491  Derived &self = this->self();
492  Info *info = this->info();
493 
494  assert(index < self.y);
495  info->y_subnames.resize(self.y);
496  info->y_subnames[index] = subname.c_str();
497  return self;
498  }
499 
500  std::string
502  {
503  return this->info()->y_subnames[i];
504  }
505 
506 };
507 
509 //
510 // Simple Statistics
511 //
513 
518 template <class Derived, class Stor>
519 class ScalarBase : public DataWrap<Derived, ScalarInfoProxy>
520 {
521  public:
522  typedef Stor Storage;
523  typedef typename Stor::Params Params;
524 
525  protected:
527  GEM5_ALIGNED(8) char storage[sizeof(Storage)];
528 
529  protected:
535  Storage *
537  {
538  return reinterpret_cast<Storage *>(storage);
539  }
540 
547  const Storage *
548  data() const
549  {
550  return reinterpret_cast<const Storage *>(storage);
551  }
552 
553  void
555  {
556  new (storage) Storage(this->info()->getStorageParams());
557  this->setInit();
558  }
559 
560  public:
561  ScalarBase(Group *parent = nullptr, const char *name = nullptr,
563  const char *desc = nullptr)
564  : DataWrap<Derived, ScalarInfoProxy>(parent, name, unit, desc)
565  {
566  this->doInit();
567  }
568 
569  public:
570  // Common operators for stats
575  void operator++() { data()->inc(1); }
580  void operator--() { data()->dec(1); }
581 
583  void operator++(int) { ++*this; }
585  void operator--(int) { --*this; }
586 
592  template <typename U>
593  void operator=(const U &v) { data()->set(v); }
594 
600  template <typename U>
601  void operator+=(const U &v) { data()->inc(v); }
602 
608  template <typename U>
609  void operator-=(const U &v) { data()->dec(v); }
610 
615  size_type size() const { return 1; }
616 
621  Counter value() const { return data()->value(); }
622 
623  Result result() const { return data()->result(); }
624 
625  Result total() const { return result(); }
626 
627  bool zero() const { return result() == 0.0; }
628 
629  void reset() { data()->reset(this->info()->getStorageParams()); }
630  void prepare() { data()->prepare(this->info()->getStorageParams()); }
631 };
632 
633 class ProxyInfo : public ScalarInfo
634 {
635  public:
636  std::string str() const { return std::to_string(value()); }
637  size_type size() const { return 1; }
638  bool check() const { return true; }
639  void prepare() { }
640  void reset() { }
641  bool zero() const { return value() == 0; }
642 
643  void visit(Output &visitor) { visitor.visit(*this); }
644 };
645 
646 template <class T>
647 class ValueProxy : public ProxyInfo
648 {
649  private:
650  T *scalar;
651 
652  public:
654  Counter value() const { return *scalar; }
655  Result result() const { return *scalar; }
656  Result total() const { return *scalar; }
657 };
658 
659 template <class T, class Enabled=void>
660 class FunctorProxy : public ProxyInfo
661 {
662  private:
664 
665  public:
666  FunctorProxy(T &func) : functor(&func) {}
667  Counter value() const { return (*functor)(); }
668  Result result() const { return (*functor)(); }
669  Result total() const { return (*functor)(); }
670 };
671 
678 template <class T>
679 class FunctorProxy<T,
680  typename std::enable_if_t<std::is_constructible_v<std::function<Result()>,
681  const T &>>> : public ProxyInfo
682 {
683  private:
684  std::function<Result()> functor;
685 
686  public:
687  FunctorProxy(const T &func) : functor(func) {}
688  Counter value() const { return functor(); }
689  Result result() const { return functor(); }
690  Result total() const { return functor(); }
691 };
692 
697 template <class T, class V>
698 class MethodProxy : public ProxyInfo
699 {
700  private:
701  T *object;
702  typedef V (T::*MethodPointer) () const;
704 
705  public:
706  MethodProxy(T *obj, MethodPointer meth) : object(obj), method(meth) {}
707  Counter value() const { return (object->*method)(); }
708  Result result() const { return (object->*method)(); }
709  Result total() const { return (object->*method)(); }
710 };
711 
712 template <class Derived>
713 class ValueBase : public DataWrap<Derived, ScalarInfoProxy>
714 {
715  private:
717 
718  public:
719  ValueBase(Group *parent, const char *name,
720  const units::Base *unit,
721  const char *desc)
722  : DataWrap<Derived, ScalarInfoProxy>(parent, name, unit, desc),
723  proxy(NULL)
724  {
725  }
726 
727  ~ValueBase() { if (proxy) delete proxy; }
728 
729  template <class T>
730  Derived &
732  {
733  proxy = new ValueProxy<T>(value);
734  this->setInit();
735  return this->self();
736  }
737 
738  template <class T>
739  Derived &
740  functor(const T &func)
741  {
742  proxy = new FunctorProxy<T>(func);
743  this->setInit();
744  return this->self();
745  }
746 
747  template <class T>
748  Derived &
749  functor(T &func)
750  {
751  proxy = new FunctorProxy<T>(func);
752  this->setInit();
753  return this->self();
754  }
755 
763  template <class T, class V>
764  Derived &
765  method(T *obj, V (T::*method)() const)
766  {
767  proxy = new MethodProxy<T,V>(obj, method);
768  this->setInit();
769  return this->self();
770  }
771 
772  Counter value() { return proxy->value(); }
773  Result result() const { return proxy->result(); }
774  Result total() const { return proxy->total(); };
775  size_type size() const { return proxy->size(); }
776 
777  std::string str() const { return proxy->str(); }
778  bool zero() const { return proxy->zero(); }
779  bool check() const { return proxy != NULL; }
780  void prepare() { }
781  void reset() { }
782 };
783 
785 //
786 // Vector Statistics
787 //
789 
794 template <class Stat>
796 {
797  private:
799  Stat &stat;
800 
803 
804  public:
809  Counter value() const { return stat.data(index)->value(); }
810 
815  Result result() const { return stat.data(index)->result(); }
816 
817  public:
823  : stat(s), index(i)
824  {
825  }
826 
832  : stat(sp.stat), index(sp.index)
833  {}
834 
840  const ScalarProxy &
842  {
843  stat = sp.stat;
844  index = sp.index;
845  return *this;
846  }
847 
848  public:
849  // Common operators for stats
854  void operator++() { stat.data(index)->inc(1); }
859  void operator--() { stat.data(index)->dec(1); }
860 
862  void operator++(int) { ++*this; }
864  void operator--(int) { --*this; }
865 
871  template <typename U>
872  void
873  operator=(const U &v)
874  {
875  stat.data(index)->set(v);
876  }
877 
883  template <typename U>
884  void
885  operator+=(const U &v)
886  {
887  stat.data(index)->inc(v);
888  }
889 
895  template <typename U>
896  void
897  operator-=(const U &v)
898  {
899  stat.data(index)->dec(v);
900  }
901 
906  size_type size() const { return 1; }
907 
908  public:
909  std::string
910  str() const
911  {
912  return csprintf("%s[%d]", stat.info()->name, index);
913  }
914 };
915 
920 template <class Derived, class Stor>
921 class VectorBase : public DataWrapVec<Derived, VectorInfoProxy>
922 {
923  public:
924  typedef Stor Storage;
925  typedef typename Stor::Params Params;
926 
929  friend class ScalarProxy<Derived>;
930  friend class DataWrapVec<Derived, VectorInfoProxy>;
931 
932  protected:
935 
936  protected:
943 
949  const Storage *data(off_type index) const { return storage[index]; }
950 
951  void
953  {
954  fatal_if(s <= 0, "Storage size must be positive");
955  fatal_if(check(), "Stat has already been initialized");
956 
957  storage.reserve(s);
958  for (size_type i = 0; i < s; ++i)
959  storage.push_back(new Storage(this->info()->getStorageParams()));
960 
961  this->setInit();
962  }
963 
964  public:
965  void
967  {
968  vec.resize(size());
969  for (off_type i = 0; i < size(); ++i)
970  vec[i] = data(i)->value();
971  }
972 
977  void
979  {
980  vec.resize(size());
981  for (off_type i = 0; i < size(); ++i)
982  vec[i] = data(i)->result();
983  }
984 
989  Result
990  total() const
991  {
992  Result total = 0.0;
993  for (off_type i = 0; i < size(); ++i)
994  total += data(i)->result();
995  return total;
996  }
997 
1001  size_type size() const { return storage.size(); }
1002 
1003  bool
1004  zero() const
1005  {
1006  for (off_type i = 0; i < size(); ++i)
1007  if (data(i)->zero())
1008  return false;
1009  return true;
1010  }
1011 
1012  bool
1013  check() const
1014  {
1015  return size() > 0;
1016  }
1017 
1018  public:
1019  VectorBase(Group *parent, const char *name,
1020  const units::Base *unit,
1021  const char *desc)
1022  : DataWrapVec<Derived, VectorInfoProxy>(parent, name, unit, desc),
1023  storage()
1024  {}
1025 
1027  {
1028  for (auto& stor : storage) {
1029  delete stor;
1030  }
1031  }
1032 
1038  Derived &
1040  {
1041  Derived &self = this->self();
1042  self.doInit(size);
1043  return self;
1044  }
1045 
1051  Proxy
1053  {
1054  assert (index < size());
1055  return Proxy(this->self(), index);
1056  }
1057 };
1058 
1059 template <class Stat>
1061 {
1062  private:
1063  Stat &stat;
1066 
1067  private:
1068  mutable VResult vec;
1069 
1070  typename Stat::Storage *
1072  {
1073  assert(index < len);
1074  return stat.data(offset + index);
1075  }
1076 
1077  const typename Stat::Storage *
1079  {
1080  assert(index < len);
1081  return stat.data(offset + index);
1082  }
1083 
1084  public:
1085  const VResult &
1086  result() const
1087  {
1088  vec.resize(size());
1089 
1090  for (off_type i = 0; i < size(); ++i)
1091  vec[i] = data(i)->result();
1092 
1093  return vec;
1094  }
1095 
1096  Result
1097  total() const
1098  {
1099  Result total = 0.0;
1100  for (off_type i = 0; i < size(); ++i)
1101  total += data(i)->result();
1102  return total;
1103  }
1104 
1105  public:
1107  : stat(s), offset(o), len(l)
1108  {
1109  }
1110 
1112  : stat(sp.stat), offset(sp.offset), len(sp.len)
1113  {
1114  }
1115 
1116  const VectorProxy &
1118  {
1119  stat = sp.stat;
1120  offset = sp.offset;
1121  len = sp.len;
1122  return *this;
1123  }
1124 
1127  {
1128  assert (index < size());
1129  return ScalarProxy<Stat>(stat, offset + index);
1130  }
1131 
1132  size_type size() const { return len; }
1133 };
1134 
1135 template <class Derived, class Stor>
1136 class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
1137 {
1138  public:
1140  typedef Stor Storage;
1141  typedef typename Stor::Params Params;
1143  friend class ScalarProxy<Derived>;
1144  friend class VectorProxy<Derived>;
1145  friend class DataWrapVec<Derived, Vector2dInfoProxy>;
1146  friend class DataWrapVec2d<Derived, Vector2dInfoProxy>;
1147 
1148  protected:
1152 
1153  protected:
1155  const Storage *data(off_type index) const { return storage[index]; }
1156 
1157  public:
1158  Vector2dBase(Group *parent, const char *name,
1159  const units::Base *unit,
1160  const char *desc)
1161  : DataWrapVec2d<Derived, Vector2dInfoProxy>(parent, name, unit, desc),
1162  x(0), y(0), storage()
1163  {}
1164 
1166  {
1167  for (auto& stor : storage) {
1168  delete stor;
1169  }
1170  }
1171 
1172  Derived &
1174  {
1175  fatal_if((_x <= 0) || (_y <= 0), "Storage sizes must be positive");
1176  fatal_if(check(), "Stat has already been initialized");
1177 
1178  Derived &self = this->self();
1179  Info *info = this->info();
1180 
1181  x = _x;
1182  y = _y;
1183  info->x = _x;
1184  info->y = _y;
1185 
1186  storage.reserve(x * y);
1187  for (size_type i = 0; i < x * y; ++i)
1188  storage.push_back(new Storage(this->info()->getStorageParams()));
1189 
1190  this->setInit();
1191 
1192  return self;
1193  }
1194 
1195  Proxy
1197  {
1198  off_type offset = index * y;
1199  assert (offset + y <= size());
1200  return Proxy(this->self(), offset, y);
1201  }
1202 
1203 
1204  size_type
1205  size() const
1206  {
1207  return storage.size();
1208  }
1209 
1210  bool
1211  zero() const
1212  {
1213  return data(0)->zero();
1214  }
1215 
1220  Result
1221  total() const
1222  {
1223  Result total = 0.0;
1224  for (off_type i = 0; i < size(); ++i)
1225  total += data(i)->result();
1226  return total;
1227  }
1228 
1229  void
1231  {
1232  Info *info = this->info();
1233  size_type size = this->size();
1234 
1235  for (off_type i = 0; i < size; ++i)
1236  data(i)->prepare(info->getStorageParams());
1237 
1238  info->cvec.resize(size);
1239  for (off_type i = 0; i < size; ++i)
1240  info->cvec[i] = data(i)->value();
1241  }
1242 
1246  void
1248  {
1249  Info *info = this->info();
1250  size_type size = this->size();
1251  for (off_type i = 0; i < size; ++i)
1252  data(i)->reset(info->getStorageParams());
1253  }
1254 
1255  bool
1256  check() const
1257  {
1258  return size() > 0;
1259  }
1260 };
1261 
1263 //
1264 // Non formula statistics
1265 //
1267 
1272 template <class Derived, class Stor>
1273 class DistBase : public DataWrap<Derived, DistInfoProxy>
1274 {
1275  public:
1277  typedef Stor Storage;
1278  typedef typename Stor::Params Params;
1279 
1280  protected:
1282  GEM5_ALIGNED(8) char storage[sizeof(Storage)];
1283 
1284  protected:
1289  Storage *
1291  {
1292  return reinterpret_cast<Storage *>(storage);
1293  }
1294 
1299  const Storage *
1300  data() const
1301  {
1302  return reinterpret_cast<const Storage *>(storage);
1303  }
1304 
1305  void
1307  {
1308  new (storage) Storage(this->info()->getStorageParams());
1309  this->setInit();
1310  }
1311 
1312  public:
1313  DistBase(Group *parent, const char *name,
1314  const units::Base *unit,
1315  const char *desc)
1316  : DataWrap<Derived, DistInfoProxy>(parent, name, unit, desc)
1317  {
1318  }
1319 
1326  template <typename U>
1327  void sample(const U &v, int n = 1) { data()->sample(v, n); }
1328 
1333  size_type size() const { return data()->size(); }
1338  bool zero() const { return data()->zero(); }
1339 
1340  void
1342  {
1343  Info *info = this->info();
1344  data()->prepare(info->getStorageParams(), info->data);
1345  }
1346 
1350  void
1352  {
1353  data()->reset(this->info()->getStorageParams());
1354  }
1355 
1359  void add(DistBase &d) { data()->add(d.data()); }
1360 };
1361 
1362 template <class Stat>
1364 
1365 template <class Derived, class Stor>
1366 class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy>
1367 {
1368  public:
1370  typedef Stor Storage;
1371  typedef typename Stor::Params Params;
1373  friend class DistProxy<Derived>;
1374  friend class DataWrapVec<Derived, VectorDistInfoProxy>;
1375 
1376  protected:
1378 
1379  protected:
1380  Storage *
1382  {
1383  return storage[index];
1384  }
1385 
1386  const Storage *
1388  {
1389  return storage[index];
1390  }
1391 
1392  void
1394  {
1395  fatal_if(s <= 0, "Storage size must be positive");
1396  fatal_if(check(), "Stat has already been initialized");
1397 
1398  storage.reserve(s);
1399  for (size_type i = 0; i < s; ++i)
1400  storage.push_back(new Storage(this->info()->getStorageParams()));
1401 
1402  this->setInit();
1403  }
1404 
1405  public:
1406  VectorDistBase(Group *parent, const char *name,
1407  const units::Base *unit,
1408  const char *desc)
1409  : DataWrapVec<Derived, VectorDistInfoProxy>(parent, name, unit, desc),
1410  storage()
1411  {}
1412 
1414  {
1415  for (auto& stor : storage) {
1416  delete stor;
1417  }
1418  }
1419 
1421  {
1422  assert(index < size());
1423  return Proxy(this->self(), index);
1424  }
1425 
1426  size_type
1427  size() const
1428  {
1429  return storage.size();
1430  }
1431 
1432  bool
1433  zero() const
1434  {
1435  for (off_type i = 0; i < size(); ++i)
1436  if (!data(i)->zero())
1437  return false;
1438  return true;
1439  }
1440 
1441  void
1443  {
1444  Info *info = this->info();
1445  size_type size = this->size();
1446  info->data.resize(size);
1447  for (off_type i = 0; i < size; ++i)
1448  data(i)->prepare(info->getStorageParams(), info->data[i]);
1449  }
1450 
1451  bool
1452  check() const
1453  {
1454  return size() > 0;
1455  }
1456 };
1457 
1458 template <class Stat>
1459 class DistProxy
1460 {
1461  private:
1462  Stat &stat;
1464 
1465  protected:
1466  typename Stat::Storage *data() { return stat.data(index); }
1467  const typename Stat::Storage *data() const { return stat.data(index); }
1468 
1469  public:
1471  : stat(s), index(i)
1472  {}
1473 
1475  : stat(sp.stat), index(sp.index)
1476  {}
1477 
1478  const DistProxy &
1480  {
1481  stat = sp.stat;
1482  index = sp.index;
1483  return *this;
1484  }
1485 
1486  public:
1487  template <typename U>
1488  void
1489  sample(const U &v, int n = 1)
1490  {
1491  data()->sample(v, n);
1492  }
1493 
1494  size_type
1495  size() const
1496  {
1497  return 1;
1498  }
1499 
1500  bool
1501  zero() const
1502  {
1503  return data()->zero();
1504  }
1505 
1509  void reset() { }
1510 };
1511 
1513 //
1514 // Formula Details
1515 //
1517 
1522 class Node
1523 {
1524  public:
1529  virtual size_type size() const = 0;
1534  virtual const VResult &result() const = 0;
1539  virtual Result total() const = 0;
1540 
1544  virtual std::string str() const = 0;
1545 
1546  virtual ~Node() {};
1547 };
1548 
1550 typedef std::shared_ptr<Node> NodePtr;
1551 
1552 class ScalarStatNode : public Node
1553 {
1554  private:
1556  mutable VResult vresult;
1557 
1558  public:
1560 
1561  const VResult &
1562  result() const
1563  {
1564  vresult[0] = data->result();
1565  return vresult;
1566  }
1567 
1568  Result total() const { return data->result(); };
1569 
1570  size_type size() const { return 1; }
1571 
1575  std::string str() const { return data->name; }
1576 };
1577 
1578 template <class Stat>
1579 class ScalarProxyNode : public Node
1580 {
1581  private:
1583  mutable VResult vresult;
1584 
1585  public:
1587  : proxy(p), vresult(1)
1588  { }
1589 
1590  const VResult &
1591  result() const
1592  {
1593  vresult[0] = proxy.result();
1594  return vresult;
1595  }
1596 
1597  Result
1598  total() const
1599  {
1600  return proxy.result();
1601  }
1602 
1603  size_type
1604  size() const
1605  {
1606  return 1;
1607  }
1608 
1612  std::string
1613  str() const
1614  {
1615  return proxy.str();
1616  }
1617 };
1618 
1619 class VectorStatNode : public Node
1620 {
1621  private:
1623 
1624  public:
1626  const VResult &result() const { return data->result(); }
1627  Result total() const { return data->total(); };
1628 
1629  size_type size() const { return data->size(); }
1630 
1631  std::string str() const { return data->name; }
1632 };
1633 
1634 template <class T>
1635 class ConstNode : public Node
1636 {
1637  private:
1639 
1640  public:
1641  ConstNode(T s) : vresult(1, (Result)s) {}
1642  const VResult &result() const { return vresult; }
1643  Result total() const { return vresult[0]; };
1644  size_type size() const { return 1; }
1645  std::string str() const { return std::to_string(vresult[0]); }
1646 };
1647 
1648 template <class T>
1649 class ConstVectorNode : public Node
1650 {
1651  private:
1653 
1654  public:
1655  ConstVectorNode(const T &s) : vresult(s.begin(), s.end()) {}
1656  const VResult &result() const { return vresult; }
1657 
1658  Result
1659  total() const
1660  {
1661  size_type size = this->size();
1662  Result tmp = 0;
1663  for (off_type i = 0; i < size; i++)
1664  tmp += vresult[i];
1665  return tmp;
1666  }
1667 
1668  size_type size() const { return vresult.size(); }
1669  std::string
1670  str() const
1671  {
1672  size_type size = this->size();
1673  std::string tmp = "(";
1674  for (off_type i = 0; i < size; i++)
1675  tmp += csprintf("%s ", std::to_string(vresult[i]));
1676  tmp += ")";
1677  return tmp;
1678  }
1679 };
1680 
1681 template <class Op>
1682 struct OpString;
1683 
1684 template<>
1685 struct OpString<std::plus<Result> >
1686 {
1687  static std::string str() { return "+"; }
1688 };
1689 
1690 template<>
1691 struct OpString<std::minus<Result> >
1692 {
1693  static std::string str() { return "-"; }
1694 };
1695 
1696 template<>
1697 struct OpString<std::multiplies<Result> >
1698 {
1699  static std::string str() { return "*"; }
1700 };
1701 
1702 template<>
1703 struct OpString<std::divides<Result> >
1704 {
1705  static std::string str() { return "/"; }
1706 };
1707 
1708 template<>
1709 struct OpString<std::modulus<Result> >
1710 {
1711  static std::string str() { return "%"; }
1712 };
1713 
1714 template<>
1715 struct OpString<std::negate<Result> >
1716 {
1717  static std::string str() { return "-"; }
1718 };
1719 
1720 template <class Op>
1721 class UnaryNode : public Node
1722 {
1723  public:
1725  mutable VResult vresult;
1726 
1727  public:
1729 
1730  const VResult &
1731  result() const
1732  {
1733  const VResult &lvec = l->result();
1734  size_type size = lvec.size();
1735 
1736  assert(size > 0);
1737 
1738  vresult.resize(size);
1739  Op op;
1740  for (off_type i = 0; i < size; ++i)
1741  vresult[i] = op(lvec[i]);
1742 
1743  return vresult;
1744  }
1745 
1746  Result
1747  total() const
1748  {
1749  const VResult &vec = this->result();
1750  Result total = 0.0;
1751  for (off_type i = 0; i < size(); i++)
1752  total += vec[i];
1753  return total;
1754  }
1755 
1756  size_type size() const { return l->size(); }
1757 
1758  std::string
1759  str() const
1760  {
1761  return OpString<Op>::str() + l->str();
1762  }
1763 };
1764 
1765 template <class Op>
1766 class BinaryNode : public Node
1767 {
1768  public:
1771  mutable VResult vresult;
1772 
1773  public:
1775 
1776  const VResult &
1777  result() const override
1778  {
1779  Op op;
1780  const VResult &lvec = l->result();
1781  const VResult &rvec = r->result();
1782 
1783  assert(lvec.size() > 0 && rvec.size() > 0);
1784 
1785  if (lvec.size() == 1 && rvec.size() == 1) {
1786  vresult.resize(1);
1787  vresult[0] = op(lvec[0], rvec[0]);
1788  } else if (lvec.size() == 1) {
1789  size_type size = rvec.size();
1790  vresult.resize(size);
1791  for (off_type i = 0; i < size; ++i)
1792  vresult[i] = op(lvec[0], rvec[i]);
1793  } else if (rvec.size() == 1) {
1794  size_type size = lvec.size();
1795  vresult.resize(size);
1796  for (off_type i = 0; i < size; ++i)
1797  vresult[i] = op(lvec[i], rvec[0]);
1798  } else if (rvec.size() == lvec.size()) {
1799  size_type size = rvec.size();
1800  vresult.resize(size);
1801  for (off_type i = 0; i < size; ++i)
1802  vresult[i] = op(lvec[i], rvec[i]);
1803  }
1804 
1805  return vresult;
1806  }
1807 
1808  Result
1809  total() const override
1810  {
1811  const VResult &vec = this->result();
1812  const VResult &lvec = l->result();
1813  const VResult &rvec = r->result();
1814  Result total = 0.0;
1815  Result lsum = 0.0;
1816  Result rsum = 0.0;
1817  Op op;
1818 
1819  assert(lvec.size() > 0 && rvec.size() > 0);
1820  assert(lvec.size() == rvec.size() ||
1821  lvec.size() == 1 || rvec.size() == 1);
1822 
1824  if (lvec.size() == rvec.size() && lvec.size() > 1) {
1825  for (off_type i = 0; i < size(); ++i) {
1826  lsum += lvec[i];
1827  rsum += rvec[i];
1828  }
1829  return op(lsum, rsum);
1830  }
1831 
1833  for (off_type i = 0; i < size(); ++i) {
1834  total += vec[i];
1835  }
1836 
1837  return total;
1838  }
1839 
1840  size_type
1841  size() const override
1842  {
1843  size_type ls = l->size();
1844  size_type rs = r->size();
1845  if (ls == 1) {
1846  return rs;
1847  } else if (rs == 1) {
1848  return ls;
1849  } else {
1850  assert(ls == rs && "Node vector sizes are not equal");
1851  return ls;
1852  }
1853  }
1854 
1855  std::string
1856  str() const override
1857  {
1858  return csprintf("(%s %s %s)", l->str(), OpString<Op>::str(), r->str());
1859  }
1860 };
1861 
1862 template <class Op>
1863 class SumNode : public Node
1864 {
1865  public:
1867  mutable VResult vresult;
1868 
1869  public:
1870  SumNode(NodePtr &p) : l(p), vresult(1) {}
1871 
1872  const VResult &
1873  result() const
1874  {
1875  const VResult &lvec = l->result();
1876  size_type size = lvec.size();
1877  assert(size > 0);
1878 
1879  vresult[0] = 0.0;
1880 
1881  Op op;
1882  for (off_type i = 0; i < size; ++i)
1883  vresult[0] = op(vresult[0], lvec[i]);
1884 
1885  return vresult;
1886  }
1887 
1888  Result
1889  total() const
1890  {
1891  const VResult &lvec = l->result();
1892  size_type size = lvec.size();
1893  assert(size > 0);
1894 
1895  Result result = 0.0;
1896 
1897  Op op;
1898  for (off_type i = 0; i < size; ++i)
1899  result = op(result, lvec[i]);
1900 
1901  return result;
1902  }
1903 
1904  size_type size() const { return 1; }
1905 
1906  std::string
1907  str() const
1908  {
1909  return csprintf("total(%s)", l->str());
1910  }
1911 };
1912 
1913 
1915 //
1916 // Visible Statistics Types
1917 //
1919 
1929 class Scalar : public ScalarBase<Scalar, StatStor>
1930 {
1931  public:
1933 
1934  Scalar(Group *parent = nullptr)
1936  parent, nullptr, units::Unspecified::get(), nullptr)
1937  {
1938  }
1939 
1940  Scalar(Group *parent, const char *name, const char *desc = nullptr)
1942  parent, name, units::Unspecified::get(), desc)
1943  {
1944  }
1945 
1946  Scalar(Group *parent, const char *name, const units::Base *unit,
1947  const char *desc = nullptr)
1948  : ScalarBase<Scalar, StatStor>(parent, name, unit, desc)
1949  {
1950  }
1951 };
1952 
1957 class Average : public ScalarBase<Average, AvgStor>
1958 {
1959  public:
1961 
1962  Average(Group *parent = nullptr)
1964  parent, nullptr, units::Unspecified::get(), nullptr)
1965  {
1966  }
1967 
1968  Average(Group *parent, const char *name, const char *desc = nullptr)
1970  parent, name, units::Unspecified::get(), desc)
1971  {
1972  }
1973 
1974  Average(Group *parent, const char *name, const units::Base *unit,
1975  const char *desc = nullptr)
1976  : ScalarBase<Average, AvgStor>(parent, name, unit, desc)
1977  {
1978  }
1979 };
1980 
1981 class Value : public ValueBase<Value>
1982 {
1983  public:
1984  Value(Group *parent = nullptr)
1985  : ValueBase<Value>(parent, nullptr, units::Unspecified::get(), nullptr)
1986  {
1987  }
1988 
1989  Value(Group *parent, const char *name, const char *desc = nullptr)
1990  : ValueBase<Value>(parent, name, units::Unspecified::get(), desc)
1991  {
1992  }
1993 
1994  Value(Group *parent, const char *name, const units::Base *unit,
1995  const char *desc = nullptr)
1996  : ValueBase<Value>(parent, name, unit, desc)
1997  {
1998  }
1999 };
2000 
2005 class Vector : public VectorBase<Vector, StatStor>
2006 {
2007  public:
2008  Vector(Group *parent = nullptr)
2010  parent, nullptr, units::Unspecified::get(), nullptr)
2011  {
2012  }
2013 
2014  Vector(Group *parent, const char *name, const char *desc = nullptr)
2016  parent, name, units::Unspecified::get(), desc)
2017  {
2018  }
2019 
2020  Vector(Group *parent, const char *name, const units::Base *unit,
2021  const char *desc = nullptr)
2022  : VectorBase<Vector, StatStor>(parent, name, unit, desc)
2023  {
2024  }
2025 };
2026 
2031 class AverageVector : public VectorBase<AverageVector, AvgStor>
2032 {
2033  public:
2034  AverageVector(Group *parent = nullptr)
2036  parent, nullptr, units::Unspecified::get(), nullptr)
2037  {
2038  }
2039 
2040  AverageVector(Group *parent, const char *name, const char *desc = nullptr)
2042  parent, name, units::Unspecified::get(), desc)
2043  {
2044  }
2045 
2046  AverageVector(Group *parent, const char *name, const units::Base *unit,
2047  const char *desc = nullptr)
2048  : VectorBase<AverageVector, AvgStor>(parent, name, unit, desc)
2049  {
2050  }
2051 };
2052 
2057 class Vector2d : public Vector2dBase<Vector2d, StatStor>
2058 {
2059  public:
2060  Vector2d(Group *parent = nullptr)
2062  parent, nullptr, units::Unspecified::get(), nullptr)
2063  {
2064  }
2065 
2066  Vector2d(Group *parent, const char *name, const char *desc = nullptr)
2068  parent, name, units::Unspecified::get(), desc)
2069  {
2070  }
2071 
2072  Vector2d(Group *parent, const char *name, const units::Base *unit,
2073  const char *desc = nullptr)
2074  : Vector2dBase<Vector2d, StatStor>(parent, name, unit, desc)
2075  {
2076  }
2077 };
2078 
2083 class Distribution : public DistBase<Distribution, DistStor>
2084 {
2085  public:
2086  Distribution(Group *parent = nullptr)
2088  parent, nullptr, units::Unspecified::get(), nullptr)
2089  {
2090  }
2091 
2092  Distribution(Group *parent, const char *name, const char *desc = nullptr)
2094  parent, name, units::Unspecified::get(), desc)
2095  {
2096  }
2097 
2098  Distribution(Group *parent, const char *name, const units::Base *unit,
2099  const char *desc = nullptr)
2100  : DistBase<Distribution, DistStor>(parent, name, unit, desc)
2101  {
2102  }
2103 
2111  Distribution &
2112  init(Counter min, Counter max, Counter bkt)
2113  {
2114  DistStor::Params *params = new DistStor::Params(min, max, bkt);
2115  this->setParams(params);
2116  this->doInit();
2117  return this->self();
2118  }
2119 };
2120 
2125 class Histogram : public DistBase<Histogram, HistStor>
2126 {
2127  public:
2128  Histogram(Group *parent = nullptr)
2130  parent, nullptr, units::Unspecified::get(), nullptr)
2131  {
2132  }
2133 
2134  Histogram(Group *parent, const char *name,
2135  const char *desc = nullptr)
2137  parent, name, units::Unspecified::get(), desc)
2138  {
2139  }
2140 
2141  Histogram(Group *parent, const char *name, const units::Base *unit,
2142  const char *desc = nullptr)
2143  : DistBase<Histogram, HistStor>(parent, name, unit, desc)
2144  {
2145  }
2146 
2152  Histogram &
2154  {
2155  HistStor::Params *params = new HistStor::Params(size);
2156  this->setParams(params);
2157  this->doInit();
2158  return this->self();
2159  }
2160 };
2161 
2166 class StandardDeviation : public DistBase<StandardDeviation, SampleStor>
2167 {
2168  public:
2172  StandardDeviation(Group *parent = nullptr)
2174  parent, nullptr, units::Unspecified::get(), nullptr)
2175  {
2176  SampleStor::Params *params = new SampleStor::Params;
2177  this->doInit();
2178  this->setParams(params);
2179  }
2180 
2181  StandardDeviation(Group *parent, const char *name,
2182  const char *desc = nullptr)
2184  parent, name, units::Unspecified::get(), desc)
2185  {
2186  SampleStor::Params *params = new SampleStor::Params;
2187  this->doInit();
2188  this->setParams(params);
2189  }
2190 
2191  StandardDeviation(Group *parent, const char *name, const units::Base *unit,
2192  const char *desc = nullptr)
2194  {
2195  SampleStor::Params *params = new SampleStor::Params;
2196  this->doInit();
2197  this->setParams(params);
2198  }
2199 };
2200 
2205 class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor>
2206 {
2207  public:
2211  AverageDeviation(Group *parent = nullptr)
2213  parent, nullptr, units::Unspecified::get(), nullptr)
2214  {
2216  this->doInit();
2217  this->setParams(params);
2218  }
2219 
2220  AverageDeviation(Group *parent, const char *name,
2221  const char *desc = nullptr)
2223  parent, name, units::Unspecified::get(), desc)
2224  {
2226  this->doInit();
2227  this->setParams(params);
2228  }
2229 
2230  AverageDeviation(Group *parent, const char *name, const units::Base *unit,
2231  const char *desc = nullptr)
2233  {
2235  this->doInit();
2236  this->setParams(params);
2237  }
2238 };
2239 
2244 class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor>
2245 {
2246  public:
2247  VectorDistribution(Group *parent = nullptr)
2248  : VectorDistBase<VectorDistribution, DistStor>(parent, nullptr,
2249  units::Unspecified::get(), nullptr)
2250  {
2251  }
2252 
2253  VectorDistribution(Group *parent, const char *name,
2254  const char *desc = nullptr)
2256  parent, name, units::Unspecified::get(), desc)
2257  {
2258  }
2259 
2260  VectorDistribution(Group *parent, const char *name,
2261  const units::Base *unit,
2262  const char *desc = nullptr)
2264  desc)
2265  {
2266  }
2267 
2278  {
2279  DistStor::Params *params = new DistStor::Params(min, max, bkt);
2280  this->setParams(params);
2281  this->doInit(size);
2282  return this->self();
2283  }
2284 };
2285 
2291  : public VectorDistBase<VectorStandardDeviation, SampleStor>
2292 {
2293  public:
2294  VectorStandardDeviation(Group *parent = nullptr)
2296  units::Unspecified::get(), nullptr)
2297  {
2298  }
2299 
2300  VectorStandardDeviation(Group *parent, const char *name,
2301  const char *desc = nullptr)
2303  units::Unspecified::get(), desc)
2304  {
2305  }
2306 
2307  VectorStandardDeviation(Group *parent, const char *name,
2308  const units::Base *unit,
2309  const char *desc = nullptr)
2311  unit, desc)
2312  {
2313  }
2314 
2322  {
2323  SampleStor::Params *params = new SampleStor::Params;
2324  this->doInit(size);
2325  this->setParams(params);
2326  return this->self();
2327  }
2328 };
2329 
2335  : public VectorDistBase<VectorAverageDeviation, AvgSampleStor>
2336 {
2337  public:
2338  VectorAverageDeviation(Group *parent = nullptr)
2340  nullptr, units::Unspecified::get(), nullptr)
2341  {
2342  }
2343 
2344  VectorAverageDeviation(Group *parent, const char *name,
2345  const char *desc = nullptr)
2347  units::Unspecified::get(), desc)
2348  {
2349  }
2350 
2351  VectorAverageDeviation(Group *parent, const char *name,
2352  const units::Base *unit,
2353  const char *desc = nullptr)
2355  unit, desc)
2356  {
2357  }
2358 
2366  {
2368  this->doInit(size);
2369  this->setParams(params);
2370  return this->self();
2371  }
2372 };
2373 
2374 template <class Stat>
2375 class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo>
2376 {
2377  protected:
2378  mutable VResult vec;
2379  mutable VCounter cvec;
2380 
2381  public:
2382  FormulaInfoProxy(Stat &stat) : InfoProxy<Stat, FormulaInfo>(stat) {}
2383 
2384  size_type size() const { return this->s.size(); }
2385 
2386  const VResult &
2387  result() const
2388  {
2389  this->s.result(vec);
2390  return vec;
2391  }
2392  Result total() const { return this->s.total(); }
2393  VCounter &value() const { return cvec; }
2394 
2395  std::string str() const { return this->s.str(); }
2396 };
2397 
2398 template <class Stat>
2399 class SparseHistInfoProxy : public InfoProxy<Stat, SparseHistInfo>
2400 {
2401  public:
2402  SparseHistInfoProxy(Stat &stat) : InfoProxy<Stat, SparseHistInfo>(stat) {}
2403 };
2404 
2409 template <class Derived, class Stor>
2410 class SparseHistBase : public DataWrap<Derived, SparseHistInfoProxy>
2411 {
2412  public:
2414  typedef Stor Storage;
2415  typedef typename Stor::Params Params;
2416 
2417  protected:
2419  char storage[sizeof(Storage)];
2420 
2421  protected:
2426  Storage *
2428  {
2429  return reinterpret_cast<Storage *>(storage);
2430  }
2431 
2436  const Storage *
2437  data() const
2438  {
2439  return reinterpret_cast<const Storage *>(storage);
2440  }
2441 
2442  void
2444  {
2445  new (storage) Storage(this->info()->getStorageParams());
2446  this->setInit();
2447  }
2448 
2449  public:
2450  SparseHistBase(Group *parent, const char *name,
2451  const units::Base *unit,
2452  const char *desc)
2453  : DataWrap<Derived, SparseHistInfoProxy>(parent, name, unit, desc)
2454  {
2455  }
2456 
2463  template <typename U>
2464  void sample(const U &v, int n = 1) { data()->sample(v, n); }
2465 
2470  size_type size() const { return data()->size(); }
2475  bool zero() const { return data()->zero(); }
2476 
2477  void
2479  {
2480  Info *info = this->info();
2481  data()->prepare(info->getStorageParams(), info->data);
2482  }
2483 
2487  void
2489  {
2490  data()->reset(this->info()->getStorageParams());
2491  }
2492 };
2493 
2494 class SparseHistogram : public SparseHistBase<SparseHistogram, SparseHistStor>
2495 {
2496  public:
2497  SparseHistogram(Group *parent = nullptr)
2498  : SparseHistBase<SparseHistogram, SparseHistStor>(parent, nullptr,
2499  units::Unspecified::get(), nullptr)
2500  {
2501  }
2502 
2503  SparseHistogram(Group *parent, const char *name,
2504  const char *desc = nullptr)
2506  units::Unspecified::get(), desc)
2507  {
2508  }
2509 
2510  SparseHistogram(Group *parent, const char *name, const units::Base *unit,
2511  const char *desc = nullptr)
2513  desc)
2514  {
2515  }
2516 
2522  SparseHistogram &
2524  {
2526  this->setParams(params);
2527  this->doInit();
2528  return this->self();
2529  }
2530 };
2531 
2532 class Temp;
2538 class Formula : public DataWrapVec<Formula, FormulaInfoProxy>
2539 {
2540  protected:
2543  friend class Temp;
2544 
2545  public:
2549  Formula(Group *parent = nullptr, const char *name = nullptr,
2550  const char *desc = nullptr);
2551 
2552  Formula(Group *parent, const char *name, const units::Base *unit,
2553  const char *desc = nullptr);
2554 
2555  Formula(Group *parent, const char *name, const char *desc,
2556  const Temp &r);
2557 
2558  Formula(Group *parent, const char *name, const units::Base *unit,
2559  const char *desc, const Temp &r);
2560 
2566  const Formula &operator=(const Temp &r);
2567 
2568  template<typename T>
2569  const Formula &operator=(const T &v)
2570  {
2571  *this = Temp(v);
2572  return *this;
2573  }
2574 
2580  const Formula &operator+=(Temp r);
2581 
2587  const Formula &operator/=(Temp r);
2588 
2596  void result(VResult &vec) const;
2597 
2608  Result total() const;
2609 
2613  size_type size() const;
2614 
2615  void prepare() { }
2616 
2620  void reset();
2621 
2625  bool zero() const;
2626 
2627  std::string str() const;
2628 };
2629 
2630 class FormulaNode : public Node
2631 {
2632  private:
2634  mutable VResult vec;
2635 
2636  public:
2638 
2639  size_type size() const { return formula.size(); }
2640  const VResult &result() const { formula.result(vec); return vec; }
2641  Result total() const { return formula.total(); }
2642 
2643  std::string str() const { return formula.str(); }
2644 };
2645 
2649 class Temp
2650 {
2651  protected:
2656 
2657  public:
2662  Temp(const NodePtr &n) : node(n) { }
2663 
2664  Temp(NodePtr &&n) : node(std::move(n)) { }
2665 
2670  operator NodePtr&() { return node; }
2671 
2675  NodePtr getNodePtr() const { return node; }
2676 
2677  public:
2682  Temp(const Scalar &s)
2683  : node(new ScalarStatNode(s.info()))
2684  { }
2685 
2690  Temp(const Value &s)
2691  : node(new ScalarStatNode(s.info()))
2692  { }
2693 
2698  Temp(const Average &s)
2699  : node(new ScalarStatNode(s.info()))
2700  { }
2701 
2706  Temp(const Vector &s)
2707  : node(new VectorStatNode(s.info()))
2708  { }
2709 
2711  : node(new VectorStatNode(s.info()))
2712  { }
2713 
2717  Temp(const Formula &f)
2718  : node(new FormulaNode(f))
2719  { }
2720 
2725  template <class Stat>
2727  : node(new ScalarProxyNode<Stat>(p))
2728  { }
2729 
2734  Temp(signed char value)
2735  : node(new ConstNode<signed char>(value))
2736  { }
2737 
2742  Temp(unsigned char value)
2743  : node(new ConstNode<unsigned char>(value))
2744  { }
2745 
2750  Temp(signed short value)
2751  : node(new ConstNode<signed short>(value))
2752  { }
2753 
2758  Temp(unsigned short value)
2759  : node(new ConstNode<unsigned short>(value))
2760  { }
2761 
2766  Temp(signed int value)
2767  : node(new ConstNode<signed int>(value))
2768  { }
2769 
2774  Temp(unsigned int value)
2775  : node(new ConstNode<unsigned int>(value))
2776  { }
2777 
2782  Temp(signed long value)
2783  : node(new ConstNode<signed long>(value))
2784  { }
2785 
2790  Temp(unsigned long value)
2791  : node(new ConstNode<unsigned long>(value))
2792  { }
2793 
2798  Temp(signed long long value)
2799  : node(new ConstNode<signed long long>(value))
2800  { }
2801 
2806  Temp(unsigned long long value)
2807  : node(new ConstNode<unsigned long long>(value))
2808  { }
2809 
2814  Temp(float value)
2815  : node(new ConstNode<float>(value))
2816  { }
2817 
2822  Temp(double value)
2823  : node(new ConstNode<double>(value))
2824  { }
2825 };
2826 
2827 
2832 inline Temp
2834 {
2835  return Temp(std::make_shared<BinaryNode<std::plus<Result> > >(l, r));
2836 }
2837 
2838 inline Temp
2840 {
2841  return Temp(std::make_shared<BinaryNode<std::minus<Result> > >(l, r));
2842 }
2843 
2844 inline Temp
2846 {
2847  return Temp(std::make_shared<BinaryNode<std::multiplies<Result> > >(l, r));
2848 }
2849 
2850 inline Temp
2852 {
2853  return Temp(std::make_shared<BinaryNode<std::divides<Result> > >(l, r));
2854 }
2855 
2856 inline Temp
2858 {
2859  return Temp(std::make_shared<UnaryNode<std::negate<Result> > >(l));
2860 }
2861 
2862 template <typename T>
2863 inline Temp
2865 {
2866  return Temp(std::make_shared<ConstNode<T> >(val));
2867 }
2868 
2869 template <typename T>
2870 inline Temp
2872 {
2873  return Temp(std::make_shared<ConstVectorNode<T> >(val));
2874 }
2875 
2876 inline Temp
2878 {
2879  return Temp(std::make_shared<SumNode<std::plus<Result> > >(val));
2880 }
2881 
2883 void dump();
2884 void reset();
2885 void enable();
2886 bool enabled();
2887 const Info* resolve(const std::string &name);
2888 
2894 typedef void (*Handler)();
2895 
2896 void registerHandlers(Handler reset_handler, Handler dump_handler);
2897 
2902 void registerResetCallback(const std::function<void()> &callback);
2903 
2908 void registerDumpCallback(const std::function<void()> &callback);
2909 
2913 void processResetQueue();
2914 
2918 void processDumpQueue();
2919 
2921 
2922 typedef std::map<const void *, Info *> MapType;
2923 MapType &statsMap();
2924 
2925 } // namespace statistics
2926 
2927 void debugDumpStats();
2928 
2929 } // namespace gem5
2930 
2931 #endif // __BASE_STATISTICS_HH__
gem5::statistics::ValueBase::zero
bool zero() const
Definition: statistics.hh:778
gem5::statistics::ProxyInfo::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:638
gem5::statistics::OpString< std::negate< Result > >::str
static std::string str()
Definition: statistics.hh:1717
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1929
gem5::statistics::DistInfoProxy
Definition: statistics.hh:158
gem5::statistics::DistProxy
Definition: statistics.hh:1363
gem5::statistics::DistBase
Implementation of a distribution stat.
Definition: statistics.hh:1273
gem5::statistics::BinaryNode::result
const VResult & result() const override
Return the result vector of this subtree.
Definition: statistics.hh:1777
gem5::statistics::SampleStor::Params
Definition: storage.hh:570
gem5::statistics::ScalarProxy::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:862
gem5::statistics::DistStor
Templatized storage and interface for a distribution stat.
Definition: storage.hh:232
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:2806
gem5::statistics::SparseHistInfoProxy
Definition: statistics.hh:2399
gem5::statistics::Vector2dBase::check
bool check() const
Definition: statistics.hh:1256
gem5::statistics::DataWrapVec2d::ysubname
Derived & ysubname(off_type index, const std::string &subname)
Definition: statistics.hh:489
gem5::statistics::DataWrap::DataWrap
DataWrap()=delete
gem5::statistics::FormulaInfoProxy::vec
VResult vec
Definition: statistics.hh:2378
gem5::statistics::ScalarBase::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:601
gem5::statistics::SparseHistStor
Templatized storage and interface for a sparse histogram stat.
Definition: storage.hh:713
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:2640
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:230
gem5::statistics::DistBase::Params
Stor::Params Params
Definition: statistics.hh:1278
types.hh
gem5::statistics::DistBase::add
void add(DistBase &d)
Add the argument distribution to the this distribution.
Definition: statistics.hh:1359
gem5::statistics::UnaryNode::str
std::string str() const
Definition: statistics.hh:1759
gem5::statistics::BinaryNode::vresult
VResult vresult
Definition: statistics.hh:1771
gem5::statistics::operator+
Temp operator+(Temp l, Temp r)
Definition: statistics.hh:2833
gem5::statistics::InfoAccess::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:210
gem5::statistics::ScalarStatNode
Definition: statistics.hh:1552
gem5::statistics::VectorProxy::VectorProxy
VectorProxy(Stat &s, off_type o, size_type l)
Definition: statistics.hh:1106
gem5::statistics::SparseHistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:2437
warn
#define warn(...)
Definition: logging.hh:256
gem5::statistics::DistInfo
Definition: info.hh:200
gem5::statistics::Histogram::Histogram
Histogram(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2141
gem5::statistics::AvgSampleStor
Templatized storage for distribution that calculates per tick mean and variance.
Definition: storage.hh:637
gem5::statistics::OpString< std::modulus< Result > >::str
static std::string str()
Definition: statistics.hh:1711
gem5::statistics::units::Base
The Base class is the parent class of all unit classes.
Definition: units.hh:120
gem5::statistics::Vector2dBase::y
size_type y
Definition: statistics.hh:1150
gem5::statistics::VectorDistInfo::data
std::vector< DistData > data
Definition: info.hh:210
gem5::statistics::VectorDistBase::Proxy
DistProxy< Derived > Proxy
Definition: statistics.hh:1372
gem5::statistics::FormulaNode::str
std::string str() const
Definition: statistics.hh:2643
gem5::statistics::Distribution
A simple distribution stat.
Definition: statistics.hh:2083
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent=nullptr)
Definition: statistics.hh:2497
gem5::statistics::Result
double Result
All results are doubles.
Definition: types.hh:55
gem5::statistics::FormulaNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2639
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2191
gem5::statistics::ValueProxy::value
Counter value() const
Definition: statistics.hh:654
gem5::statistics::ConstVectorNode::vresult
VResult vresult
Definition: statistics.hh:1652
gem5::statistics::SparseHistBase::storage
char storage[sizeof(Storage)]
The storage for this stat.
Definition: statistics.hh:2419
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:559
gem5::ArmISA::cc_reg::V
constexpr RegId V
Definition: cc.hh:96
gem5::statistics::DistBase::doInit
void doInit()
Definition: statistics.hh:1306
gem5::statistics::ConstNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1644
gem5::statistics::SparseHistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:2475
gem5::statistics::SparseHistBase::Params
Stor::Params Params
Definition: statistics.hh:2415
group.hh
gem5::statistics::Vector::Vector
Vector(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2020
gem5::statistics::sum
Temp sum(Temp val)
Definition: statistics.hh:2877
gem5::statistics::VectorDistBase::storage
std::vector< Storage * > storage
Definition: statistics.hh:1377
gem5::statistics::MethodProxy
A proxy similar to the FunctorProxy, but allows calling a method of a bound object,...
Definition: statistics.hh:698
gem5::statistics::UnaryNode
Definition: statistics.hh:1721
gem5::statistics::ConstNode
Definition: statistics.hh:1635
gem5::statistics::Formula::Temp
friend class Temp
Definition: statistics.hh:2543
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:688
gem5::statistics::VectorBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:990
gem5::statistics::VectorInfo
Definition: info.hh:183
gem5::statistics::resolve
const Info * resolve(const std::string &name)
Definition: statistics.cc:318
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
gem5::statistics::ScalarProxyNode::vresult
VResult vresult
Definition: statistics.hh:1583
gem5::statistics::Vector2dBase::Vector2dBase
Vector2dBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1158
warn_once
#define warn_once(...)
Definition: logging.hh:260
gem5::statistics::Vector2dBase::init
Derived & init(size_type _x, size_type _y)
Definition: statistics.hh:1173
gem5::statistics::AvgSampleStor::Params
Definition: storage.hh:646
gem5::statistics::InfoProxy
Definition: statistics.hh:98
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:689
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:2351
gem5::statistics::OpString< std::minus< Result > >::str
static std::string str()
Definition: statistics.hh:1693
gem5::statistics::ValueProxy::ValueProxy
ValueProxy(T &val)
Definition: statistics.hh:653
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2181
gem5::statistics::Temp::Temp
Temp(const NodePtr &n)
Copy the given pointer to this class.
Definition: statistics.hh:2662
gem5::statistics::FormulaInfoProxy::size
size_type size() const
Definition: statistics.hh:2384
gem5::statistics::ScalarBase::reset
void reset()
Definition: statistics.hh:629
gem5::statistics::Temp::Temp
Temp(const Scalar &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2682
gem5::statistics::VectorStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1627
gem5::statistics::InfoAccess::_info
Info * _info
Definition: statistics.hh:185
gem5::statistics::VectorDistInfoProxy::VectorDistInfoProxy
VectorDistInfoProxy(Stat &stat)
Definition: statistics.hh:168
gem5::statistics::ConstVectorNode::ConstVectorNode
ConstVectorNode(const T &s)
Definition: statistics.hh:1655
gem5::statistics::ScalarBase::result
Result result() const
Definition: statistics.hh:623
gem5::statistics::Temp::Temp
Temp(double value)
Create a ConstNode.
Definition: statistics.hh:2822
gem5::statistics::InfoProxy::prepare
void prepare()
Definition: statistics.hh:107
gem5::statistics::VectorInfo::result
virtual const VResult & result() const =0
gem5::statistics::ProxyInfo::zero
bool zero() const
Definition: statistics.hh:641
gem5::statistics::BinaryNode::r
NodePtr r
Definition: statistics.hh:1770
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2307
gem5::statistics::SparseHistBase::doInit
void doInit()
Definition: statistics.hh:2443
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2211
gem5::statistics::DistProxy::size
size_type size() const
Definition: statistics.hh:1495
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:949
gem5::statistics::VectorStatNode::data
const VectorInfo * data
Definition: statistics.hh:1622
gem5::statistics::Temp
Helper class to construct formula node trees.
Definition: statistics.hh:2649
gem5::statistics::ScalarProxy::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:809
gem5::statistics::ValueBase::size
size_type size() const
Definition: statistics.hh:775
gem5::statistics::BinaryNode::l
NodePtr l
Definition: statistics.hh:1769
gem5::statistics::Temp::Temp
Temp(const Vector &s)
Create a new VectorStatNode.
Definition: statistics.hh:2706
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2220
gem5::statistics::DistProxy::data
Stat::Storage * data()
Definition: statistics.hh:1466
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:776
gem5::statistics::ScalarBase::total
Result total() const
Definition: statistics.hh:625
gem5::statistics::ConstNode::str
std::string str() const
Definition: statistics.hh:1645
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:401
gem5::statistics::Average
A stat that calculates the per tick average of a value.
Definition: statistics.hh:1957
gem5::statistics::InfoAccess::InfoAccess
InfoAccess()
Definition: statistics.hh:204
cast.hh
gem5::statistics::StandardDeviation
Calculates the mean and variance of all the samples.
Definition: statistics.hh:2166
gem5::statistics::Vector2d
A 2-Dimensional vecto of scalar stats.
Definition: statistics.hh:2057
gem5::statistics::Temp::Temp
Temp(signed long long value)
Create a ConstNode.
Definition: statistics.hh:2798
gem5::statistics::ScalarProxy::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:854
gem5::statistics::VectorStandardDeviation::init
VectorStandardDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2321
gem5::statistics::Vector2dBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1247
gem5::statistics::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:231
gem5::statistics::UnaryNode::UnaryNode
UnaryNode(NodePtr &p)
Definition: statistics.hh:1728
gem5::statistics::VectorInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:132
gem5::statistics::Vector
A vector of scalar stats.
Definition: statistics.hh:2005
gem5::statistics::ScalarInfo
Definition: info.hh:175
gem5::statistics::ScalarStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1562
gem5::statistics::VectorDistBase::Info
VectorDistInfoProxy< Derived > Info
Definition: statistics.hh:1369
gem5::statistics::ScalarProxyNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1591
gem5::statistics::VectorDistBase::~VectorDistBase
~VectorDistBase()
Definition: statistics.hh:1413
gem5::statistics::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2538
gem5::statistics::Distribution::Distribution
Distribution(Group *parent=nullptr)
Definition: statistics.hh:2086
std::vector< Counter >
gem5::statistics::Temp::Temp
Temp(const Value &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2690
gem5::statistics::DistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:1290
gem5::statistics::DistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:1300
gem5::statistics::ScalarStatNode::vresult
VResult vresult
Definition: statistics.hh:1556
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:2758
gem5::VegaISA::r
Bitfield< 5 > r
Definition: pagetable.hh:60
gem5::statistics::ScalarBase
Implementation of a scalar stat.
Definition: statistics.hh:519
gem5::statistics::Vector2dBase::prepare
void prepare()
Definition: statistics.hh:1230
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:765
gem5::statistics::VectorDistBase::prepare
void prepare()
Definition: statistics.hh:1442
gem5::statistics::DataWrap
Definition: statistics.hh:227
gem5::statistics::FormulaNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2641
gem5::statistics::DataWrapVec2d::DataWrapVec2d
DataWrapVec2d(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:466
gem5::statistics::units::Unspecified::get
static Unspecified * get()
Definition: units.hh:327
gem5::statistics::ScalarProxyNode::proxy
const ScalarProxy< Stat > proxy
Definition: statistics.hh:1582
gem5::statistics::ScalarProxy::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:897
gem5::statistics::ScalarProxy::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:906
gem5::statistics::ValueBase::total
Result total() const
Definition: statistics.hh:774
gem5::statistics::Temp::Temp
Temp(unsigned long value)
Create a ConstNode.
Definition: statistics.hh:2790
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:197
gem5::statistics::DistProxy::index
off_type index
Definition: statistics.hh:1463
gem5::statistics::ScalarProxyNode::ScalarProxyNode
ScalarProxyNode(const ScalarProxy< Stat > &p)
Definition: statistics.hh:1586
gem5::statistics::Temp::Temp
Temp(const ScalarProxy< Stat > &p)
Create a new ScalarProxyNode.
Definition: statistics.hh:2726
gem5::statistics::Formula::result
void result(VResult &vec) const
Return the result of the Fomula in a vector.
Definition: statistics.cc:208
gem5::statistics::VectorAverageDeviation
This is a vector of AverageDeviation stats.
Definition: statistics.hh:2334
gem5::statistics::VectorStatNode::VectorStatNode
VectorStatNode(const VectorInfo *d)
Definition: statistics.hh:1625
gem5::statistics::InfoProxy::s
Stat & s
Definition: statistics.hh:101
gem5::statistics::HistStor::Params
The parameters for a distribution stat.
Definition: storage.hh:459
gem5::statistics::SumNode::str
std::string str() const
Definition: statistics.hh:1907
gem5::statistics::SparseHistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:2470
gem5::statistics::VectorDistInfoProxy
Definition: statistics.hh:165
gem5::statistics::DistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:1327
gem5::statistics::ValueProxy
Definition: statistics.hh:647
gem5::statistics::FormulaNode::formula
const Formula & formula
Definition: statistics.hh:2633
gem5::statistics::SumNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1904
gem5::statistics::UnaryNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1747
gem5::statistics::Temp::Temp
Temp(float value)
Create a ConstNode.
Definition: statistics.hh:2814
gem5::statistics::VectorBase
Implementation of a vector of stats.
Definition: statistics.hh:921
gem5::statistics::Temp::Temp
Temp(const Average &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2698
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:690
storage.hh
gem5::statistics::Vector2dBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1155
gem5::statistics::ProxyInfo::str
std::string str() const
Definition: statistics.hh:636
gem5::statistics::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2344
gem5::statistics::constant
Temp constant(T val)
Definition: statistics.hh:2864
gem5::statistics::ScalarInfo::result
virtual Result result() const =0
gem5::statistics::registerHandlers
void registerHandlers(Handler reset_handler, Handler dump_handler)
Definition: statistics.cc:255
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:329
gem5::statistics::VectorBase::value
void value(VCounter &vec) const
Definition: statistics.hh:966
gem5::statistics::InfoAccess::newStyleStats
bool newStyleStats() const
Check if the info is new style stats.
Definition: statistics.cc:139
gem5::statistics::FunctorProxy::total
Result total() const
Definition: statistics.hh:669
gem5::statistics::Vector2dInfoProxy
Definition: statistics.hh:174
str.hh
gem5::statistics::ScalarStatNode::data
const ScalarInfo * data
Definition: statistics.hh:1555
gem5::statistics::Average::Average
Average(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1974
gem5::statistics::Histogram::Histogram
Histogram(Group *parent=nullptr)
Definition: statistics.hh:2128
gem5::statistics::DistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:1333
gem5::statistics::ProxyInfo::size
size_type size() const
Definition: statistics.hh:637
gem5::statistics::Scalar::Scalar
Scalar(Group *parent=nullptr)
Definition: statistics.hh:1934
gem5::statistics::VectorStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1626
gem5::statistics::Node::~Node
virtual ~Node()
Definition: statistics.hh:1546
gem5::statistics::FunctorProxy::FunctorProxy
FunctorProxy(T &func)
Definition: statistics.hh:666
gem5::statistics::ScalarProxy::stat
Stat & stat
Pointer to the parent Vector.
Definition: statistics.hh:799
gem5::statistics::Histogram
A simple histogram stat.
Definition: statistics.hh:2125
gem5::statistics::operator/
Temp operator/(Temp l, Temp r)
Definition: statistics.hh:2851
gem5::auxv::Base
@ Base
Definition: aux_vector.hh:74
info.hh
gem5::SparcISA::int_reg::o
constexpr RegId o(int index)
Definition: int.hh:147
gem5::statistics::ScalarProxy::ScalarProxy
ScalarProxy(const ScalarProxy &sp)
Create a copy of the provided ScalarProxy.
Definition: statistics.hh:831
gem5::statistics::FunctorProxy::value
Counter value() const
Definition: statistics.hh:667
gem5::statistics::Vector2dBase::Params
Stor::Params Params
Definition: statistics.hh:1141
gem5::statistics::BinaryNode::size
size_type size() const override
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1841
gem5::statistics::DataWrap::operator=
DataWrap & operator=(const DataWrap &)=delete
gem5::statistics::ScalarBase::Storage
Stor Storage
Definition: statistics.hh:522
gem5::statistics::Node
Base class for formula statistic node.
Definition: statistics.hh:1522
gem5::Flags< FlagsType >
gem5::statistics::DataWrap::info
Info * info()
Definition: statistics.hh:237
gem5::statistics::OpString< std::plus< Result > >::str
static std::string str()
Definition: statistics.hh:1687
gem5::statistics::ScalarBase::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:585
gem5::statistics::Vector2dBase::Proxy
VectorProxy< Derived > Proxy
Definition: statistics.hh:1142
gem5::statistics::DistBase::Storage
Stor Storage
Definition: statistics.hh:1277
gem5::statistics::VectorStatNode::str
std::string str() const
Definition: statistics.hh:1631
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:111
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:2277
gem5::statistics::ScalarProxy::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:864
gem5::statistics::SparseHistogram::init
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2523
gem5::statistics::AverageVector
A vector of Average stats.
Definition: statistics.hh:2031
gem5::statistics::SparseHistBase::Info
SparseHistInfoProxy< Derived > Info
Definition: statistics.hh:2413
gem5::statistics::off_type
unsigned int off_type
Definition: types.hh:60
gem5::statistics::Temp::Temp
Temp(unsigned int value)
Create a ConstNode.
Definition: statistics.hh:2774
gem5::ArmISA::b
Bitfield< 7 > b
Definition: misc_types.hh:438
gem5::statistics::Vector2dInfo::cvec
VCounter cvec
Local storage for the entry values, used for printing.
Definition: info.hh:237
gem5::statistics::Output
Definition: output.hh:64
gem5::statistics::VectorStandardDeviation
This is a vector of StandardDeviation stats.
Definition: statistics.hh:2290
gem5::statistics::ScalarBase::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:583
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:288
gem5::statistics::Distribution::init
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
Definition: statistics.hh:2112
gem5::statistics::DistProxy::data
const Stat::Storage * data() const
Definition: statistics.hh:1467
gem5::statistics::FunctorProxy::functor
T * functor
Definition: statistics.hh:663
gem5::statistics::Vector2dBase::size
size_type size() const
Definition: statistics.hh:1205
gem5::statistics::Vector2dInfoProxy::total
Result total() const
Definition: statistics.hh:179
gem5::statistics::Value::Value
Value(Group *parent=nullptr)
Definition: statistics.hh:1984
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:684
gem5::statistics::MethodProxy::value
Counter value() const
Definition: statistics.hh:707
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::statistics::DataWrapVec2d::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:464
gem5::statistics::VectorProxy::result
const VResult & result() const
Definition: statistics.hh:1086
gem5::statistics::VectorBase::doInit
void doInit(size_type s)
Definition: statistics.hh:952
gem5::statistics::SparseHistInfo
Definition: info.hh:250
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:133
gem5::statistics::VectorDistBase::doInit
void doInit(size_type s)
Definition: statistics.hh:1393
gem5::statistics::Vector2dBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:1221
gem5::statistics::statsMap
MapType & statsMap()
Definition: statistics.cc:68
gem5::statistics::VectorBase::Proxy
ScalarProxy< Derived > Proxy
Proxy type.
Definition: statistics.hh:928
gem5::statistics::Vector2dBase::data
Storage * data(off_type index)
Definition: statistics.hh:1154
gem5::statistics::enable
void enable()
Definition: statistics.cc:291
gem5::statistics::ScalarBase::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:609
gem5::statistics::ValueBase::prepare
void prepare()
Definition: statistics.hh:780
gem5::statistics::DataWrap::unit
Derived & unit(const units::Base *_unit)
Set the unit of the stat.
Definition: statistics.hh:320
gem5::statistics::ValueBase
Definition: statistics.hh:713
gem5::statistics::ConstVectorNode
Definition: statistics.hh:1649
gem5::statistics::DataWrapVec::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:382
gem5::ArmISA::d
Bitfield< 9 > d
Definition: misc_types.hh:64
gem5::statistics::VectorProxy
Definition: statistics.hh:1060
gem5::statistics::ValueBase::result
Result result() const
Definition: statistics.hh:773
gem5::statistics::UnaryNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1756
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:978
gem5::statistics::VectorDistBase::Storage
Stor Storage
Definition: statistics.hh:1370
gem5::statistics::FormulaInfoProxy
Definition: statistics.hh:2375
gem5::statistics::ValueBase::check
bool check() const
Definition: statistics.hh:779
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:425
gem5::statistics::VectorProxy::operator[]
ScalarProxy< Stat > operator[](off_type index)
Definition: statistics.hh:1126
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2072
gem5::statistics::ScalarProxy::operator=
const ScalarProxy & operator=(const ScalarProxy &sp)
Set this proxy equal to the provided one.
Definition: statistics.hh:841
gem5::statistics::SumNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1889
gem5::statistics::ConstVectorNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1668
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:687
gem5::statistics::DistProxy::reset
void reset()
Proxy has no state.
Definition: statistics.hh:1509
gem5::statistics::OpString
Definition: statistics.hh:1682
gem5::statistics::InfoAccess::zero
bool zero() const
Definition: statistics.hh:216
gem5::statistics::Temp::Temp
Temp(unsigned char value)
Create a ConstNode.
Definition: statistics.hh:2742
gem5::statistics::ScalarBase::Params
Stor::Params Params
Definition: statistics.hh:523
gem5::statistics::OpString< std::divides< Result > >::str
static std::string str()
Definition: statistics.hh:1705
gem5::statistics::Vector2dBase::zero
bool zero() const
Definition: statistics.hh:1211
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2503
gem5::statistics::reset
void reset()
Definition: statistics.cc:309
gem5::statistics::dump
void dump()
Dump all statistics data to the registered outputs.
Definition: statistics.cc:300
gem5::statistics::ValueProxy::result
Result result() const
Definition: statistics.hh:655
gem5::statistics::Value::Value
Value(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1989
gem5::statistics::display
const FlagsType display
Print this stat.
Definition: info.hh:57
gem5::statistics::DistInfo::data
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:204
gem5::statistics::ConstVectorNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1656
gem5::statistics::SparseHistBase::prepare
void prepare()
Definition: statistics.hh:2478
gem5::statistics::Temp::Temp
Temp(signed long value)
Create a ConstNode.
Definition: statistics.hh:2782
gem5::statistics::VectorStatNode
Definition: statistics.hh:1619
gem5::statistics::ValueProxy::scalar
T * scalar
Definition: statistics.hh:650
gem5::statistics::DistBase::DistBase
DistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1313
gem5::statistics::ScalarInfoProxy::total
Result total() const
Definition: statistics.hh:125
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2260
gem5::statistics::VectorBase::operator[]
Proxy operator[](off_type index)
Return a reference (ScalarProxy) to the stat at the given index.
Definition: statistics.hh:1052
gem5::statistics::VectorDistBase::size
size_type size() const
Definition: statistics.hh:1427
gem5::statistics::DistProxy::DistProxy
DistProxy(const DistProxy &sp)
Definition: statistics.hh:1474
gem5::statistics::ScalarBase::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:593
gem5::statistics::DataWrapVec2d::ysubname
std::string ysubname(off_type i) const
Definition: statistics.hh:501
gem5::statistics::InfoAccess::setInit
void setInit()
Save Storage class parameters if any.
Definition: statistics.cc:105
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:1629
gem5::statistics::registerResetCallback
void registerResetCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are reset.
Definition: statistics.cc:277
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:777
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:822
cprintf.hh
gem5::statistics::processDumpQueue
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
Definition: statistics.cc:271
gem5::statistics::ScalarBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:548
gem5::statistics::ValueBase::proxy
ProxyInfo * proxy
Definition: statistics.hh:716
gem5::statistics::ConstVectorNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1659
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:304
compiler.hh
gem5::statistics::SumNode
Definition: statistics.hh:1863
gem5::statistics::ValueBase::functor
Derived & functor(const T &func)
Definition: statistics.hh:740
gem5::statistics::Temp::Temp
Temp(const AverageVector &s)
Definition: statistics.hh:2710
gem5::statistics::Vector2dBase
Definition: statistics.hh:1136
gem5::statistics::SparseHistBase::Storage
Stor Storage
Definition: statistics.hh:2414
gem5::statistics::DataWrapVec2d
Definition: statistics.hh:461
gem5::statistics::VectorProxy::operator=
const VectorProxy & operator=(const VectorProxy &sp)
Definition: statistics.hh:1117
gem5::statistics::VectorProxy::offset
off_type offset
Definition: statistics.hh:1064
gem5::statistics::InfoProxy::zero
bool zero() const
Definition: statistics.hh:114
gem5::statistics::ScalarInfoProxy::ScalarInfoProxy
ScalarInfoProxy(Stat &stat)
Definition: statistics.hh:121
gem5::statistics::ScalarProxy::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:859
gem5::statistics::VectorProxy::stat
Stat & stat
Definition: statistics.hh:1063
gem5::statistics::Vector2dBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:1196
gem5::statistics::ScalarBase::zero
bool zero() const
Definition: statistics.hh:627
gem5::statistics::ProxyInfo::prepare
void prepare()
Prepare the stat for dumping.
Definition: statistics.hh:639
gem5::statistics::VectorDistBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:1420
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:345
gem5::statistics::size_type
unsigned int size_type
Definition: types.hh:59
gem5::statistics::Formula::root
NodePtr root
The root of the tree which represents the Formula.
Definition: statistics.hh:2542
gem5::statistics::Temp::node
NodePtr node
Pointer to a Node object.
Definition: statistics.hh:2655
gem5::statistics::SparseHistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:2464
gem5::statistics::Output::visit
virtual void visit(const ScalarInfo &info)=0
gem5::statistics::FormulaInfoProxy::total
Result total() const
Definition: statistics.hh:2392
gem5::statistics::UnaryNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1731
gem5::debugDumpStats
void debugDumpStats()
Definition: statistics.cc:337
gem5::statistics::SparseHistInfoProxy::SparseHistInfoProxy
SparseHistInfoProxy(Stat &stat)
Definition: statistics.hh:2402
gem5::statistics::Scalar::Scalar
Scalar(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1940
gem5::statistics::VectorInfo::total
virtual Result total() const =0
gem5::statistics::BinaryNode::str
std::string str() const override
Definition: statistics.hh:1856
gem5::statistics::InfoAccess
Definition: statistics.hh:182
gem5::statistics::Temp::Temp
Temp(const Formula &f)
Definition: statistics.hh:2717
gem5::statistics::VectorBase::VectorBase
VectorBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1019
gem5::statistics::Average::Average
Average(Group *parent=nullptr)
Definition: statistics.hh:1962
gem5::statistics::FormulaInfoProxy::str
std::string str() const
Definition: statistics.hh:2395
gem5::statistics::DistProxy::operator=
const DistProxy & operator=(const DistProxy &sp)
Definition: statistics.hh:1479
gem5::statistics::SumNode::SumNode
SumNode(NodePtr &p)
Definition: statistics.hh:1870
gem5::statistics::DistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:1338
gem5::statistics::Histogram::init
Histogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2153
gem5::statistics::Distribution::Distribution
Distribution(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2098
gem5::statistics::VectorBase::~VectorBase
~VectorBase()
Definition: statistics.hh:1026
gem5::statistics::ScalarStatNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1570
gem5::statistics::Vector2dInfo::y
size_type y
Definition: info.hh:234
name
const std::string & name()
Definition: trace.cc:48
gem5::statistics::VectorBase::zero
bool zero() const
Definition: statistics.hh:1004
gem5::statistics::FormulaNode::FormulaNode
FormulaNode(const Formula &f)
Definition: statistics.hh:2637
gem5::statistics::FormulaNode
Definition: statistics.hh:2630
gem5::statistics::Temp::getNodePtr
NodePtr getNodePtr() const
Makde gcc < 4.6.3 happy and explicitly get the underlying node.
Definition: statistics.hh:2675
gem5::statistics::Handler
void(* Handler)()
Register reset and dump handlers.
Definition: statistics.hh:2894
gem5::statistics::ValueBase::functor
Derived & functor(T &func)
Definition: statistics.hh:749
gem5::statistics::ConstNode::ConstNode
ConstNode(T s)
Definition: statistics.hh:1641
gem5::statistics::Value::Value
Value(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1994
gem5::statistics::ScalarProxyNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1604
gem5::statistics::MethodProxy::MethodPointer
V(T::* MethodPointer)() const
Definition: statistics.hh:702
gem5::statistics::VectorProxy::data
const Stat::Storage * data(off_type index) const
Definition: statistics.hh:1078
gem5::statistics::DataWrap::DataWrap
DataWrap(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:254
gem5::statistics::Vector2dBase::~Vector2dBase
~Vector2dBase()
Definition: statistics.hh:1165
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:384
gem5::statistics::enabled
bool enabled()
Definition: statistics.cc:285
gem5::statistics::VectorDistBase::zero
bool zero() const
Definition: statistics.hh:1433
gem5::statistics::statsList
std::list< Info * > & statsList()
Definition: statistics.cc:61
gem5::statistics::VectorDistBase
Definition: statistics.hh:1366
gem5::statistics::ScalarBase::doInit
void doInit()
Definition: statistics.hh:554
gem5::statistics::Scalar::Scalar
Scalar(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1946
gem5::statistics::VectorDistBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1387
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2300
gem5::statistics::ScalarStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1568
gem5::statistics::Vector2dInfoProxy::Vector2dInfoProxy
Vector2dInfoProxy(Stat &stat)
Definition: statistics.hh:177
gem5::statistics::Info::setName
void setName(const std::string &name, bool old_style=true)
Set the name of this statistic.
Definition: info.cc:127
gem5::statistics::BinaryNode::total
Result total() const override
Return the total of the result vector.
Definition: statistics.hh:1809
gem5::statistics::ScalarBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:536
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2040
gem5::statistics::Vector::Vector
Vector(Group *parent=nullptr)
Definition: statistics.hh:2008
gem5::VegaISA::v
Bitfield< 0 > v
Definition: pagetable.hh:65
gem5::statistics::Formula::str
std::string str() const
Definition: statistics.cc:246
gem5::statistics::BinaryNode::BinaryNode
BinaryNode(NodePtr &a, NodePtr &b)
Definition: statistics.hh:1774
gem5::statistics::ConstNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1643
gem5::statistics::SumNode::vresult
VResult vresult
Definition: statistics.hh:1867
gem5::statistics::ValueBase::ValueBase
ValueBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:719
gem5::statistics::DistInfoProxy::DistInfoProxy
DistInfoProxy(Stat &stat)
Definition: statistics.hh:161
gem5::statistics::DataWrap::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:230
gem5::statistics::InfoAccess::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:223
units.hh
gem5::statistics::SumNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1873
gem5::statistics::VectorInfoProxy::total
Result total() const
Definition: statistics.hh:154
gem5::statistics::ScalarInfoProxy
Definition: statistics.hh:118
gem5::statistics::DataWrapVec::reset
void reset()
Definition: statistics.hh:449
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:333
gem5::statistics::ConstNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1642
gem5::statistics::SparseHistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:2488
gem5::statistics::MethodProxy::result
Result result() const
Definition: statistics.hh:708
gem5::statistics::SparseHistBase::SparseHistBase
SparseHistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:2450
gem5::statistics::ScalarInfoProxy::value
Counter value() const
Definition: statistics.hh:123
gem5::statistics::Temp::Temp
Temp(signed int value)
Create a ConstNode.
Definition: statistics.hh:2766
gem5::statistics::VectorProxy::data
Stat::Storage * data(off_type index)
Definition: statistics.hh:1071
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:371
gem5::statistics::UnaryNode::l
NodePtr l
Definition: statistics.hh:1724
gem5::statistics::StorageParams
Definition: storage.hh:48
gem5::statistics::VectorDistInfo
Definition: info.hh:207
std
Overload hash function for BasicBlockRange type.
Definition: misc.hh:2909
gem5::statistics::VectorInfo::size
virtual size_type size() const =0
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:513
types.hh
gem5::statistics::VectorProxy::VectorProxy
VectorProxy(const VectorProxy &sp)
Definition: statistics.hh:1111
gem5::statistics::VectorDistInfoProxy::size
size_type size() const
Definition: statistics.hh:170
gem5::statistics::processResetQueue
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
Definition: statistics.cc:265
gem5::statistics::VectorInfoProxy
Definition: statistics.hh:129
gem5::statistics::constantVector
Temp constantVector(T val)
Definition: statistics.hh:2871
gem5::statistics::DistBase::prepare
void prepare()
Definition: statistics.hh:1341
gem5::statistics::VectorDistBase::Params
Stor::Params Params
Definition: statistics.hh:1371
gem5::statistics::Formula::operator=
const Formula & operator=(const Temp &r)
Set an unitialized Formula to the given root.
Definition: statistics.cc:173
gem5::statistics::FormulaInfoProxy::value
VCounter & value() const
Definition: statistics.hh:2393
gem5::statistics::VectorDistBase::VectorDistBase
VectorDistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1406
gem5::statistics::ScalarProxy
A proxy class to access the stat at a given index in a VectorBase stat.
Definition: statistics.hh:795
gem5::statistics::MapType
std::map< const void *, Info * > MapType
Definition: statistics.hh:2922
gem5::PowerISA::vec
Bitfield< 25 > vec
Definition: misc.hh:113
gem5::statistics::Vector2dInfo::x
size_type x
Definition: info.hh:233
gem5::statistics::SparseHistInfo::data
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:254
gem5::statistics::VectorDistBase::data
Storage * data(off_type index)
Definition: statistics.hh:1381
gem5::statistics::Value
Definition: statistics.hh:1981
gem5::statistics::SparseHistStor::Params
The parameters for a sparse histogram stat.
Definition: storage.hh:723
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:925
gem5::statistics::DataWrap::info
const Info * info() const
Definition: statistics.hh:244
gem5::statistics::DistProxy::sample
void sample(const U &v, int n=1)
Definition: statistics.hh:1489
gem5::statistics::NodePtr
std::shared_ptr< Node > NodePtr
Shared pointer to a function Node.
Definition: statistics.hh:1550
gem5::statistics::VectorAverageDeviation::init
VectorAverageDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2365
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:46
gem5::statistics::SparseHistogram
Definition: statistics.hh:2494
output.hh
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2046
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:561
gem5::statistics::InfoProxy::visit
void visit(Output &visitor)
Definition: statistics.hh:110
gem5::statistics::ValueBase::reset
void reset()
Definition: statistics.hh:781
logging.hh
gem5::statistics::ScalarInfoProxy::result
Result result() const
Definition: statistics.hh:124
gem5::statistics::OpString< std::multiplies< Result > >::str
static std::string str()
Definition: statistics.hh:1699
gem5::statistics::VectorBase::size
size_type size() const
Definition: statistics.hh:1001
gem5::statistics::Group
Statistics container.
Definition: group.hh:92
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:660
gem5::statistics::ValueBase::scalar
Derived & scalar(T &value)
Definition: statistics.hh:731
gem5::statistics::DataWrap::name
const std::string & name() const
Definition: statistics.hh:295
gem5::statistics::DataWrapVec2d::ysubnames
Derived & ysubnames(const char **names)
Definition: statistics.hh:477
gem5::statistics::DataWrapVec::prepare
void prepare()
Definition: statistics.hh:438
gem5::statistics::Formula::prepare
void prepare()
Definition: statistics.hh:2615
gem5::statistics::HistStor
Templatized storage and interface for a histogram stat.
Definition: storage.hh:398
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent=nullptr)
Definition: statistics.hh:2034
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2510
gem5::statistics::InfoProxy::reset
void reset()
Definition: statistics.hh:108
gem5::VegaISA::l
Bitfield< 55 > l
Definition: pagetable.hh:54
gem5::statistics::ConstVectorNode::str
std::string str() const
Definition: statistics.hh:1670
gem5::statistics::FunctorProxy::result
Result result() const
Definition: statistics.hh:668
gem5::statistics::FormulaInfoProxy::FormulaInfoProxy
FormulaInfoProxy(Stat &stat)
Definition: statistics.hh:2382
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2230
gem5::statistics::DataWrap::setSeparator
const std::string & setSeparator() const
Definition: statistics.hh:309
gem5::statistics::ScalarBase::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:580
gem5::statistics::BinaryNode
Definition: statistics.hh:1766
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent=nullptr)
Definition: statistics.hh:2060
gem5::statistics::ValueBase::value
Counter value()
Definition: statistics.hh:772
gem5::statistics::MethodProxy::object
T * object
Definition: statistics.hh:701
gem5::statistics::MethodProxy::method
MethodPointer method
Definition: statistics.hh:703
gem5::statistics::StatStor
Templatized storage and interface for a simple scalar stat.
Definition: storage.hh:56
gem5::statistics::FormulaInfoProxy::result
const VResult & result() const
Definition: statistics.hh:2387
gem5::statistics::ScalarBase::prepare
void prepare()
Definition: statistics.hh:630
gem5::statistics::ScalarStatNode::str
std::string str() const
Definition: statistics.hh:1575
gem5::statistics::DistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1351
gem5::statistics::ScalarProxy::str
std::string str() const
Definition: statistics.hh:910
gem5::statistics::DistProxy::DistProxy
DistProxy(Stat &s, off_type i)
Definition: statistics.hh:1470
gem5::statistics::SumNode::l
NodePtr l
Definition: statistics.hh:1866
gem5::statistics::ScalarProxy::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:873
gem5::statistics::VectorDistribution
A vector of distributions.
Definition: statistics.hh:2244
gem5::statistics::VectorBase::check
bool check() const
Definition: statistics.hh:1013
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:357
gem5::statistics::Average::Average
Average(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1968
gem5::statistics::VectorProxy::len
size_type len
Definition: statistics.hh:1065
gem5::statistics::Vector::Vector
Vector(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2014
gem5::statistics::Vector2dBase::Storage
Stor Storage
Definition: statistics.hh:1140
gem5::statistics::InfoAccess::setInfo
void setInfo(Group *parent, Info *info)
Set up an info class for this statistic.
Definition: statistics.cc:75
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2066
gem5::statistics::VectorInfoProxy::value
VCounter & value() const
Definition: statistics.hh:141
gem5::statistics::FormulaInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:2379
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:183
gem5::statistics::Vector2dBase::storage
std::vector< Storage * > storage
Definition: statistics.hh:1151
intmath.hh
gem5::statistics::DistProxy::stat
Stat & stat
Definition: statistics.hh:1462
gem5::statistics::Temp::Temp
Temp(NodePtr &&n)
Definition: statistics.hh:2664
gem5::statistics::SparseHistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:2427
gem5::statistics::ScalarProxyNode::str
std::string str() const
Definition: statistics.hh:1613
gem5::statistics::VectorProxy::vec
VResult vec
Definition: statistics.hh:1068
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent=nullptr)
Definition: statistics.hh:2247
gem5::statistics::Temp::Temp
Temp(signed short value)
Create a ConstNode.
Definition: statistics.hh:2750
gem5::statistics::ScalarBase::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:575
gem5::statistics::ValueBase::~ValueBase
~ValueBase()
Definition: statistics.hh:727
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:236
gem5::statistics::ValueProxy::total
Result total() const
Definition: statistics.hh:656
gem5::statistics::DistBase::Info
DistInfoProxy< Derived > Info
Definition: statistics.hh:1276
gem5::statistics::ProxyInfo
Definition: statistics.hh:633
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:261
gem5::statistics::Formula::total
Result total() const
Return the total Formula result.
Definition: statistics.cc:215
gem5::statistics::VectorInfoProxy::size
size_type size() const
Definition: statistics.hh:138
gem5::statistics::DataWrapVec
Definition: statistics.hh:379
gem5::statistics::ScalarProxy::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:885
gem5::statistics::SparseHistBase
Implementation of a sparse histogram stat.
Definition: statistics.hh:2410
gem5::statistics::VectorBase::init
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1039
gem5::statistics::InfoAccess::setParams
void setParams(const StorageParams *params)
Save Storage class parameters if any.
Definition: statistics.cc:99
gem5::statistics::operator*
Temp operator*(Temp l, Temp r)
Definition: statistics.hh:2845
gem5::statistics::VectorProxy::total
Result total() const
Definition: statistics.hh:1097
gem5::statistics::ScalarBase::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:615
gem5::statistics::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent=nullptr)
Definition: statistics.hh:2338
gem5::statistics::VectorInfoProxy::VectorInfoProxy
VectorInfoProxy(Stat &stat)
Definition: statistics.hh:136
gem5::statistics::ScalarProxyNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1598
gem5::statistics::MethodProxy::MethodProxy
MethodProxy(T *obj, MethodPointer meth)
Definition: statistics.hh:706
gem5::statistics::AverageDeviation
Calculates the per tick mean and variance of the samples.
Definition: statistics.hh:2205
gem5::statistics::Info::getStorageParams
StorageParams const * getStorageParams() const
Getter for the storage params.
Definition: info.cc:84
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent=nullptr)
Definition: statistics.hh:2294
gem5::statistics::FormulaNode::vec
VResult vec
Definition: statistics.hh:2634
gem5::statistics::ScalarProxy::result
Result result() const
Return the current value of this statas a result type.
Definition: statistics.hh:815
gem5::statistics::ProxyInfo::visit
void visit(Output &visitor)
Visitor entry for outputing statistics data.
Definition: statistics.hh:643
gem5::X86ISA::op
Bitfield< 4 > op
Definition: types.hh:83
gem5::statistics::VectorProxy::size
size_type size() const
Definition: statistics.hh:1132
gem5::statistics::Formula::size
size_type size() const
Return the number of elements in the tree.
Definition: statistics.cc:221
gem5::statistics::ScalarProxyNode
Definition: statistics.hh:1579
gem5::statistics::Vector2dBase::Info
Vector2dInfoProxy< Derived > Info
Definition: statistics.hh:1139
gem5::statistics::VectorDistBase::check
bool check() const
Definition: statistics.hh:1452
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:144
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2253
gem5::statistics::InfoProxy::InfoProxy
InfoProxy(Stat &stat)
Definition: statistics.hh:104
gem5::statistics::VectorBase::Storage
Stor Storage
Definition: statistics.hh:924
gem5::statistics::Formula::operator=
const Formula & operator=(const T &v)
Definition: statistics.hh:2569
gem5::ArmISA::rs
Bitfield< 9, 8 > rs
Definition: misc_types.hh:433
gem5::statistics::Histogram::Histogram
Histogram(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2134
gem5::statistics::DistProxy::zero
bool zero() const
Definition: statistics.hh:1501
gem5::statistics::ScalarStatNode::ScalarStatNode
ScalarStatNode(const ScalarInfo *d)
Definition: statistics.hh:1559
gem5::statistics::Distribution::Distribution
Distribution(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2092
gem5::statistics::Info::name
std::string name
The name of the stat.
Definition: info.hh:83
gem5::statistics::UnaryNode::vresult
VResult vresult
Definition: statistics.hh:1725
gem5::statistics::FormulaInfo
Definition: info.hh:244
gem5::statistics::VectorBase::data
Storage * data(off_type index)
Retrieve the storage.
Definition: statistics.hh:942
gem5::statistics::Vector2dInfo
Definition: info.hh:225
gem5::statistics::Temp::Temp
Temp(signed char value)
Create a ConstNode.
Definition: statistics.hh:2734
gem5::statistics::Formula::zero
bool zero() const
Definition: statistics.cc:235
gem5::statistics::Vector2dBase::x
size_type x
Definition: statistics.hh:1149
gem5::statistics::InfoProxy::check
bool check() const
Definition: statistics.hh:106
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2172
gem5::statistics::ScalarProxy::index
off_type index
The index to access in the parent VectorBase.
Definition: statistics.hh:802
gem5::statistics::Info
Definition: info.hh:79
gem5::statistics::MethodProxy::total
Result total() const
Definition: statistics.hh:709
gem5::statistics::ConstNode::vresult
VResult vresult
Definition: statistics.hh:1638
gem5::statistics::ProxyInfo::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:640
gem5::statistics::operator-
Temp operator-(Temp l, Temp r)
Definition: statistics.hh:2839
gem5::statistics::AvgStor
Templatized storage and interface to a per-tick average stat.
Definition: storage.hh:126
gem5::statistics::ScalarBase::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:621
gem5::statistics::VectorBase::storage
std::vector< Storage * > storage
The storage of this stat.
Definition: statistics.hh:934
gem5::statistics::VectorInfoProxy::result
const VResult & result() const
Definition: statistics.hh:148

Generated on Sun Jul 30 2023 01:56:51 for gem5 by doxygen 1.8.17