gem5  v21.1.0.2
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 GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
95 namespace statistics
96 {
97 
98 template <class Stat, class Base>
99 class InfoProxy : public Base
100 {
101  protected:
102  Stat &s;
103 
104  public:
105  InfoProxy(Stat &stat) : s(stat) {}
106 
107  bool check() const { return s.check(); }
108  void prepare() { s.prepare(); }
109  void reset() { s.reset(); }
110  void
111  visit(Output &visitor)
112  {
113  visitor.visit(*static_cast<Base *>(this));
114  }
115  bool zero() const { return s.zero(); }
116 };
117 
118 template <class Stat>
119 class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo>
120 {
121  public:
122  ScalarInfoProxy(Stat &stat) : InfoProxy<Stat, ScalarInfo>(stat) {}
123 
124  Counter value() const { return this->s.value(); }
125  Result result() const { return this->s.result(); }
126  Result total() const { return this->s.total(); }
127 };
128 
129 template <class Stat>
130 class VectorInfoProxy : public InfoProxy<Stat, VectorInfo>
131 {
132  protected:
133  mutable VCounter cvec;
134  mutable VResult rvec;
135 
136  public:
137  VectorInfoProxy(Stat &stat) : InfoProxy<Stat, VectorInfo>(stat) {}
138 
139  size_type size() const { return this->s.size(); }
140 
141  VCounter &
142  value() const
143  {
144  this->s.value(cvec);
145  return cvec;
146  }
147 
148  const VResult &
149  result() const
150  {
151  this->s.result(rvec);
152  return rvec;
153  }
154 
155  Result total() const { return this->s.total(); }
156 };
157 
158 template <class Stat>
159 class DistInfoProxy : public InfoProxy<Stat, DistInfo>
160 {
161  public:
162  DistInfoProxy(Stat &stat) : InfoProxy<Stat, DistInfo>(stat) {}
163 };
164 
165 template <class Stat>
166 class VectorDistInfoProxy : public InfoProxy<Stat, VectorDistInfo>
167 {
168  public:
169  VectorDistInfoProxy(Stat &stat) : InfoProxy<Stat, VectorDistInfo>(stat) {}
170 
171  size_type size() const { return this->s.size(); }
172 };
173 
174 template <class Stat>
175 class Vector2dInfoProxy : public InfoProxy<Stat, Vector2dInfo>
176 {
177  public:
178  Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {}
179 
180  Result total() const { return this->s.total(); }
181 };
182 
184 {
185  private:
187 
188  protected:
190  void setInfo(Group *parent, Info *info);
192  void setParams(const StorageParams *params);
194  void setInit();
195 
197  Info *info();
199  const Info *info() const;
200 
201  public:
203  : _info(nullptr) {};
204 
208  void reset() { }
209 
214  bool zero() const { return true; }
215 
221  bool check() const { return true; }
222 };
223 
224 template <class Derived, template <class> class InfoProxyType>
225 class DataWrap : public InfoAccess
226 {
227  public:
228  typedef InfoProxyType<Derived> Info;
229 
230  protected:
231  Derived &self() { return *static_cast<Derived *>(this); }
232 
233  protected:
234  Info *
236  {
237  return safe_cast<Info *>(InfoAccess::info());
238  }
239 
240  public:
241  const Info *
242  info() const
243  {
244  return safe_cast<const Info *>(InfoAccess::info());
245  }
246 
247  public:
248  DataWrap() = delete;
249  DataWrap(const DataWrap &) = delete;
250  DataWrap &operator=(const DataWrap &) = delete;
251 
252  DataWrap(Group *parent, const char *name, const units::Base *unit,
253  const char *desc)
254  {
255  auto info = new Info(self());
256  this->setInfo(parent, info);
257 
258  if (parent)
259  parent->addStat(info);
260 
261  if (name) {
262  info->setName(name, parent == nullptr);
263  info->flags.set(display);
264  }
265 
266  info->unit = unit;
267 
268  if (desc)
269  info->desc = desc;
270 
271  // Stat that does not belong to any statistics::Group is a legacy stat
272  std::string common_message = "Legacy stat is a stat that does not "
273  "belong to any statistics::Group. Legacy stat is deprecated.";
274  if (parent == nullptr && name != nullptr)
275  warn(csprintf("`%s` is a legacy stat. %s", name, common_message));
276  else if (parent == nullptr)
277  warn_once("One of the stats is a legacy stat. " + common_message);
278  }
279 
285  Derived &
286  name(const std::string &name)
287  {
288  Info *info = this->info();
289  info->setName(name);
290  info->flags.set(display);
291  return this->self();
292  }
293  const std::string &name() const { return this->info()->name; }
294 
301  Derived &
302  setSeparator(const std::string &_sep)
303  {
304  this->info()->setSeparator(_sep);
305  return this->self();
306  }
307  const std::string &setSeparator() const
308  {
309  return this->info()->separatorString;
310  }
311 
317  Derived &
318  unit(const units::Base *_unit)
319  {
320  this->info()->unit = _unit;
321  return this->self();
322  }
323 
330  Derived &
331  desc(const std::string &_desc)
332  {
333  this->info()->desc = _desc;
334  return this->self();
335  }
336 
342  Derived &
343  precision(int _precision)
344  {
345  this->info()->precision = _precision;
346  return this->self();
347  }
348 
354  Derived &
355  flags(Flags _flags)
356  {
357  this->info()->flags.set(_flags);
358  return this->self();
359  }
360 
367  template <class Stat>
368  Derived &
369  prereq(const Stat &prereq)
370  {
371  this->info()->prereq = prereq.info();
372  return this->self();
373  }
374 };
375 
376 template <class Derived, template <class> class InfoProxyType>
377 class DataWrapVec : public DataWrap<Derived, InfoProxyType>
378 {
379  public:
380  typedef InfoProxyType<Derived> Info;
381 
382  DataWrapVec(Group *parent = nullptr, const char *name = nullptr,
384  const char *desc = nullptr)
385  : DataWrap<Derived, InfoProxyType>(parent, name, unit, desc)
386  {}
387 
388  // The following functions are specific to vectors. If you use them
389  // in a non vector context, you will get a nice compiler error!
390 
398  Derived &
399  subname(off_type index, const std::string &name)
400  {
401  Derived &self = this->self();
402  Info *info = self.info();
403 
404  std::vector<std::string> &subn = info->subnames;
405  if (subn.size() <= index)
406  subn.resize(index + 1);
407  subn[index] = name;
408  return self;
409  }
410 
411  // The following functions are specific to 2d vectors. If you use
412  // them in a non vector context, you will get a nice compiler
413  // error because info doesn't have the right variables.
414 
422  Derived &
423  subdesc(off_type index, const std::string &desc)
424  {
425  Info *info = this->info();
426 
427  std::vector<std::string> &subd = info->subdescs;
428  if (subd.size() <= index)
429  subd.resize(index + 1);
430  subd[index] = desc;
431 
432  return this->self();
433  }
434 
435  void
437  {
438  Derived &self = this->self();
439  Info *info = this->info();
440 
441  size_t size = self.size();
442  for (off_type i = 0; i < size; ++i)
443  self.data(i)->prepare(info->getStorageParams());
444  }
445 
446  void
448  {
449  Derived &self = this->self();
450  Info *info = this->info();
451 
452  size_t size = self.size();
453  for (off_type i = 0; i < size; ++i)
454  self.data(i)->reset(info->getStorageParams());
455  }
456 };
457 
458 template <class Derived, template <class> class InfoProxyType>
459 class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType>
460 {
461  public:
462  typedef InfoProxyType<Derived> Info;
463 
464  DataWrapVec2d(Group *parent, const char *name,
465  const units::Base *unit, const char *desc)
466  : DataWrapVec<Derived, InfoProxyType>(parent, name, unit, desc)
467  {
468  }
469 
474  Derived &
475  ysubnames(const char **names)
476  {
477  Derived &self = this->self();
478  Info *info = this->info();
479 
480  info->y_subnames.resize(self.y);
481  for (off_type i = 0; i < self.y; ++i)
482  info->y_subnames[i] = names[i];
483  return self;
484  }
485 
486  Derived &
487  ysubname(off_type index, const std::string &subname)
488  {
489  Derived &self = this->self();
490  Info *info = this->info();
491 
492  assert(index < self.y);
493  info->y_subnames.resize(self.y);
494  info->y_subnames[index] = subname.c_str();
495  return self;
496  }
497 
498  std::string
500  {
501  return this->info()->y_subnames[i];
502  }
503 
504 };
505 
507 //
508 // Simple Statistics
509 //
511 
516 template <class Derived, class Stor>
517 class ScalarBase : public DataWrap<Derived, ScalarInfoProxy>
518 {
519  public:
520  typedef Stor Storage;
521  typedef typename Stor::Params Params;
522 
523  protected:
525  GEM5_ALIGNED(8) char storage[sizeof(Storage)];
526 
527  protected:
533  Storage *
535  {
536  return reinterpret_cast<Storage *>(storage);
537  }
538 
545  const Storage *
546  data() const
547  {
548  return reinterpret_cast<const Storage *>(storage);
549  }
550 
551  void
553  {
554  new (storage) Storage(this->info()->getStorageParams());
555  this->setInit();
556  }
557 
558  public:
559  ScalarBase(Group *parent = nullptr, const char *name = nullptr,
561  const char *desc = nullptr)
562  : DataWrap<Derived, ScalarInfoProxy>(parent, name, unit, desc)
563  {
564  this->doInit();
565  }
566 
567  public:
568  // Common operators for stats
573  void operator++() { data()->inc(1); }
578  void operator--() { data()->dec(1); }
579 
581  void operator++(int) { ++*this; }
583  void operator--(int) { --*this; }
584 
590  template <typename U>
591  void operator=(const U &v) { data()->set(v); }
592 
598  template <typename U>
599  void operator+=(const U &v) { data()->inc(v); }
600 
606  template <typename U>
607  void operator-=(const U &v) { data()->dec(v); }
608 
613  size_type size() const { return 1; }
614 
619  Counter value() const { return data()->value(); }
620 
621  Result result() const { return data()->result(); }
622 
623  Result total() const { return result(); }
624 
625  bool zero() const { return result() == 0.0; }
626 
627  void reset() { data()->reset(this->info()->getStorageParams()); }
628  void prepare() { data()->prepare(this->info()->getStorageParams()); }
629 };
630 
631 class ProxyInfo : public ScalarInfo
632 {
633  public:
634  std::string str() const { return std::to_string(value()); }
635  size_type size() const { return 1; }
636  bool check() const { return true; }
637  void prepare() { }
638  void reset() { }
639  bool zero() const { return value() == 0; }
640 
641  void visit(Output &visitor) { visitor.visit(*this); }
642 };
643 
644 template <class T>
645 class ValueProxy : public ProxyInfo
646 {
647  private:
648  T *scalar;
649 
650  public:
652  Counter value() const { return *scalar; }
653  Result result() const { return *scalar; }
654  Result total() const { return *scalar; }
655 };
656 
657 template <class T, class Enabled=void>
658 class FunctorProxy : public ProxyInfo
659 {
660  private:
662 
663  public:
664  FunctorProxy(T &func) : functor(&func) {}
665  Counter value() const { return (*functor)(); }
666  Result result() const { return (*functor)(); }
667  Result total() const { return (*functor)(); }
668 };
669 
676 template <class T>
677 class FunctorProxy<T,
678  typename std::enable_if_t<std::is_constructible<std::function<Result()>,
679  const T &>::value>> : public ProxyInfo
680 {
681  private:
682  std::function<Result()> functor;
683 
684  public:
685  FunctorProxy(const T &func) : functor(func) {}
686  Counter value() const { return functor(); }
687  Result result() const { return functor(); }
688  Result total() const { return functor(); }
689 };
690 
695 template <class T, class V>
696 class MethodProxy : public ProxyInfo
697 {
698  private:
699  T *object;
700  typedef V (T::*MethodPointer) () const;
702 
703  public:
704  MethodProxy(T *obj, MethodPointer meth) : object(obj), method(meth) {}
705  Counter value() const { return (object->*method)(); }
706  Result result() const { return (object->*method)(); }
707  Result total() const { return (object->*method)(); }
708 };
709 
710 template <class Derived>
711 class ValueBase : public DataWrap<Derived, ScalarInfoProxy>
712 {
713  private:
715 
716  public:
717  ValueBase(Group *parent, const char *name,
718  const units::Base *unit,
719  const char *desc)
720  : DataWrap<Derived, ScalarInfoProxy>(parent, name, unit, desc),
721  proxy(NULL)
722  {
723  }
724 
725  ~ValueBase() { if (proxy) delete proxy; }
726 
727  template <class T>
728  Derived &
730  {
731  proxy = new ValueProxy<T>(value);
732  this->setInit();
733  return this->self();
734  }
735 
736  template <class T>
737  Derived &
738  functor(const T &func)
739  {
740  proxy = new FunctorProxy<T>(func);
741  this->setInit();
742  return this->self();
743  }
744 
745  template <class T>
746  Derived &
747  functor(T &func)
748  {
749  proxy = new FunctorProxy<T>(func);
750  this->setInit();
751  return this->self();
752  }
753 
761  template <class T, class V>
762  Derived &
763  method(T *obj, V (T::*method)() const)
764  {
765  proxy = new MethodProxy<T,V>(obj, method);
766  this->setInit();
767  return this->self();
768  }
769 
770  Counter value() { return proxy->value(); }
771  Result result() const { return proxy->result(); }
772  Result total() const { return proxy->total(); };
773  size_type size() const { return proxy->size(); }
774 
775  std::string str() const { return proxy->str(); }
776  bool zero() const { return proxy->zero(); }
777  bool check() const { return proxy != NULL; }
778  void prepare() { }
779  void reset() { }
780 };
781 
783 //
784 // Vector Statistics
785 //
787 
792 template <class Stat>
794 {
795  private:
797  Stat &stat;
798 
801 
802  public:
807  Counter value() const { return stat.data(index)->value(); }
808 
813  Result result() const { return stat.data(index)->result(); }
814 
815  public:
821  : stat(s), index(i)
822  {
823  }
824 
830  : stat(sp.stat), index(sp.index)
831  {}
832 
838  const ScalarProxy &
840  {
841  stat = sp.stat;
842  index = sp.index;
843  return *this;
844  }
845 
846  public:
847  // Common operators for stats
852  void operator++() { stat.data(index)->inc(1); }
857  void operator--() { stat.data(index)->dec(1); }
858 
860  void operator++(int) { ++*this; }
862  void operator--(int) { --*this; }
863 
869  template <typename U>
870  void
871  operator=(const U &v)
872  {
873  stat.data(index)->set(v);
874  }
875 
881  template <typename U>
882  void
883  operator+=(const U &v)
884  {
885  stat.data(index)->inc(v);
886  }
887 
893  template <typename U>
894  void
895  operator-=(const U &v)
896  {
897  stat.data(index)->dec(v);
898  }
899 
904  size_type size() const { return 1; }
905 
906  public:
907  std::string
908  str() const
909  {
910  return csprintf("%s[%d]", stat.info()->name, index);
911  }
912 };
913 
918 template <class Derived, class Stor>
919 class VectorBase : public DataWrapVec<Derived, VectorInfoProxy>
920 {
921  public:
922  typedef Stor Storage;
923  typedef typename Stor::Params Params;
924 
927  friend class ScalarProxy<Derived>;
928  friend class DataWrapVec<Derived, VectorInfoProxy>;
929 
930  protected:
933 
934  protected:
941 
947  const Storage *data(off_type index) const { return storage[index]; }
948 
949  void
951  {
952  fatal_if(s <= 0, "Storage size must be positive");
953  fatal_if(check(), "Stat has already been initialized");
954 
955  storage.reserve(s);
956  for (size_type i = 0; i < s; ++i)
957  storage.push_back(new Storage(this->info()->getStorageParams()));
958 
959  this->setInit();
960  }
961 
962  public:
963  void
965  {
966  vec.resize(size());
967  for (off_type i = 0; i < size(); ++i)
968  vec[i] = data(i)->value();
969  }
970 
975  void
977  {
978  vec.resize(size());
979  for (off_type i = 0; i < size(); ++i)
980  vec[i] = data(i)->result();
981  }
982 
987  Result
988  total() const
989  {
990  Result total = 0.0;
991  for (off_type i = 0; i < size(); ++i)
992  total += data(i)->result();
993  return total;
994  }
995 
999  size_type size() const { return storage.size(); }
1000 
1001  bool
1002  zero() const
1003  {
1004  for (off_type i = 0; i < size(); ++i)
1005  if (data(i)->zero())
1006  return false;
1007  return true;
1008  }
1009 
1010  bool
1011  check() const
1012  {
1013  return size() > 0;
1014  }
1015 
1016  public:
1017  VectorBase(Group *parent, const char *name,
1018  const units::Base *unit,
1019  const char *desc)
1020  : DataWrapVec<Derived, VectorInfoProxy>(parent, name, unit, desc),
1021  storage()
1022  {}
1023 
1025  {
1026  for (auto& stor : storage) {
1027  delete stor;
1028  }
1029  }
1030 
1036  Derived &
1038  {
1039  Derived &self = this->self();
1040  self.doInit(size);
1041  return self;
1042  }
1043 
1049  Proxy
1051  {
1052  assert (index < size());
1053  return Proxy(this->self(), index);
1054  }
1055 };
1056 
1057 template <class Stat>
1059 {
1060  private:
1061  Stat &stat;
1064 
1065  private:
1066  mutable VResult vec;
1067 
1068  typename Stat::Storage *
1070  {
1071  assert(index < len);
1072  return stat.data(offset + index);
1073  }
1074 
1075  const typename Stat::Storage *
1077  {
1078  assert(index < len);
1079  return stat.data(offset + index);
1080  }
1081 
1082  public:
1083  const VResult &
1084  result() const
1085  {
1086  vec.resize(size());
1087 
1088  for (off_type i = 0; i < size(); ++i)
1089  vec[i] = data(i)->result();
1090 
1091  return vec;
1092  }
1093 
1094  Result
1095  total() const
1096  {
1097  Result total = 0.0;
1098  for (off_type i = 0; i < size(); ++i)
1099  total += data(i)->result();
1100  return total;
1101  }
1102 
1103  public:
1105  : stat(s), offset(o), len(l)
1106  {
1107  }
1108 
1110  : stat(sp.stat), offset(sp.offset), len(sp.len)
1111  {
1112  }
1113 
1114  const VectorProxy &
1116  {
1117  stat = sp.stat;
1118  offset = sp.offset;
1119  len = sp.len;
1120  return *this;
1121  }
1122 
1125  {
1126  assert (index < size());
1127  return ScalarProxy<Stat>(stat, offset + index);
1128  }
1129 
1130  size_type size() const { return len; }
1131 };
1132 
1133 template <class Derived, class Stor>
1134 class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
1135 {
1136  public:
1138  typedef Stor Storage;
1139  typedef typename Stor::Params Params;
1141  friend class ScalarProxy<Derived>;
1142  friend class VectorProxy<Derived>;
1143  friend class DataWrapVec<Derived, Vector2dInfoProxy>;
1144  friend class DataWrapVec2d<Derived, Vector2dInfoProxy>;
1145 
1146  protected:
1150 
1151  protected:
1153  const Storage *data(off_type index) const { return storage[index]; }
1154 
1155  public:
1156  Vector2dBase(Group *parent, const char *name,
1157  const units::Base *unit,
1158  const char *desc)
1159  : DataWrapVec2d<Derived, Vector2dInfoProxy>(parent, name, unit, desc),
1160  x(0), y(0), storage()
1161  {}
1162 
1164  {
1165  for (auto& stor : storage) {
1166  delete stor;
1167  }
1168  }
1169 
1170  Derived &
1172  {
1173  fatal_if((_x <= 0) || (_y <= 0), "Storage sizes must be positive");
1174  fatal_if(check(), "Stat has already been initialized");
1175 
1176  Derived &self = this->self();
1177  Info *info = this->info();
1178 
1179  x = _x;
1180  y = _y;
1181  info->x = _x;
1182  info->y = _y;
1183 
1184  storage.reserve(x * y);
1185  for (size_type i = 0; i < x * y; ++i)
1186  storage.push_back(new Storage(this->info()->getStorageParams()));
1187 
1188  this->setInit();
1189 
1190  return self;
1191  }
1192 
1193  Proxy
1195  {
1196  off_type offset = index * y;
1197  assert (offset + y <= size());
1198  return Proxy(this->self(), offset, y);
1199  }
1200 
1201 
1202  size_type
1203  size() const
1204  {
1205  return storage.size();
1206  }
1207 
1208  bool
1209  zero() const
1210  {
1211  return data(0)->zero();
1212  }
1213 
1218  Result
1219  total() const
1220  {
1221  Result total = 0.0;
1222  for (off_type i = 0; i < size(); ++i)
1223  total += data(i)->result();
1224  return total;
1225  }
1226 
1227  void
1229  {
1230  Info *info = this->info();
1231  size_type size = this->size();
1232 
1233  for (off_type i = 0; i < size; ++i)
1234  data(i)->prepare(info->getStorageParams());
1235 
1236  info->cvec.resize(size);
1237  for (off_type i = 0; i < size; ++i)
1238  info->cvec[i] = data(i)->value();
1239  }
1240 
1244  void
1246  {
1247  Info *info = this->info();
1248  size_type size = this->size();
1249  for (off_type i = 0; i < size; ++i)
1250  data(i)->reset(info->getStorageParams());
1251  }
1252 
1253  bool
1254  check() const
1255  {
1256  return size() > 0;
1257  }
1258 };
1259 
1261 //
1262 // Non formula statistics
1263 //
1265 
1270 template <class Derived, class Stor>
1271 class DistBase : public DataWrap<Derived, DistInfoProxy>
1272 {
1273  public:
1275  typedef Stor Storage;
1276  typedef typename Stor::Params Params;
1277 
1278  protected:
1280  GEM5_ALIGNED(8) char storage[sizeof(Storage)];
1281 
1282  protected:
1287  Storage *
1289  {
1290  return reinterpret_cast<Storage *>(storage);
1291  }
1292 
1297  const Storage *
1298  data() const
1299  {
1300  return reinterpret_cast<const Storage *>(storage);
1301  }
1302 
1303  void
1305  {
1306  new (storage) Storage(this->info()->getStorageParams());
1307  this->setInit();
1308  }
1309 
1310  public:
1311  DistBase(Group *parent, const char *name,
1312  const units::Base *unit,
1313  const char *desc)
1314  : DataWrap<Derived, DistInfoProxy>(parent, name, unit, desc)
1315  {
1316  }
1317 
1324  template <typename U>
1325  void sample(const U &v, int n = 1) { data()->sample(v, n); }
1326 
1331  size_type size() const { return data()->size(); }
1336  bool zero() const { return data()->zero(); }
1337 
1338  void
1340  {
1341  Info *info = this->info();
1342  data()->prepare(info->getStorageParams(), info->data);
1343  }
1344 
1348  void
1350  {
1351  data()->reset(this->info()->getStorageParams());
1352  }
1353 
1357  void add(DistBase &d) { data()->add(d.data()); }
1358 };
1359 
1360 template <class Stat>
1362 
1363 template <class Derived, class Stor>
1364 class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy>
1365 {
1366  public:
1368  typedef Stor Storage;
1369  typedef typename Stor::Params Params;
1371  friend class DistProxy<Derived>;
1372  friend class DataWrapVec<Derived, VectorDistInfoProxy>;
1373 
1374  protected:
1376 
1377  protected:
1378  Storage *
1380  {
1381  return storage[index];
1382  }
1383 
1384  const Storage *
1386  {
1387  return storage[index];
1388  }
1389 
1390  void
1392  {
1393  fatal_if(s <= 0, "Storage size must be positive");
1394  fatal_if(check(), "Stat has already been initialized");
1395 
1396  storage.reserve(s);
1397  for (size_type i = 0; i < s; ++i)
1398  storage.push_back(new Storage(this->info()->getStorageParams()));
1399 
1400  this->setInit();
1401  }
1402 
1403  public:
1404  VectorDistBase(Group *parent, const char *name,
1405  const units::Base *unit,
1406  const char *desc)
1407  : DataWrapVec<Derived, VectorDistInfoProxy>(parent, name, unit, desc),
1408  storage()
1409  {}
1410 
1412  {
1413  for (auto& stor : storage) {
1414  delete stor;
1415  }
1416  }
1417 
1419  {
1420  assert(index < size());
1421  return Proxy(this->self(), index);
1422  }
1423 
1424  size_type
1425  size() const
1426  {
1427  return storage.size();
1428  }
1429 
1430  bool
1431  zero() const
1432  {
1433  for (off_type i = 0; i < size(); ++i)
1434  if (!data(i)->zero())
1435  return false;
1436  return true;
1437  }
1438 
1439  void
1441  {
1442  Info *info = this->info();
1443  size_type size = this->size();
1444  info->data.resize(size);
1445  for (off_type i = 0; i < size; ++i)
1446  data(i)->prepare(info->getStorageParams(), info->data[i]);
1447  }
1448 
1449  bool
1450  check() const
1451  {
1452  return size() > 0;
1453  }
1454 };
1455 
1456 template <class Stat>
1457 class DistProxy
1458 {
1459  private:
1460  Stat &stat;
1462 
1463  protected:
1464  typename Stat::Storage *data() { return stat.data(index); }
1465  const typename Stat::Storage *data() const { return stat.data(index); }
1466 
1467  public:
1469  : stat(s), index(i)
1470  {}
1471 
1473  : stat(sp.stat), index(sp.index)
1474  {}
1475 
1476  const DistProxy &
1478  {
1479  stat = sp.stat;
1480  index = sp.index;
1481  return *this;
1482  }
1483 
1484  public:
1485  template <typename U>
1486  void
1487  sample(const U &v, int n = 1)
1488  {
1489  data()->sample(v, n);
1490  }
1491 
1492  size_type
1493  size() const
1494  {
1495  return 1;
1496  }
1497 
1498  bool
1499  zero() const
1500  {
1501  return data()->zero();
1502  }
1503 
1507  void reset() { }
1508 };
1509 
1511 //
1512 // Formula Details
1513 //
1515 
1520 class Node
1521 {
1522  public:
1527  virtual size_type size() const = 0;
1532  virtual const VResult &result() const = 0;
1537  virtual Result total() const = 0;
1538 
1542  virtual std::string str() const = 0;
1543 
1544  virtual ~Node() {};
1545 };
1546 
1548 typedef std::shared_ptr<Node> NodePtr;
1549 
1550 class ScalarStatNode : public Node
1551 {
1552  private:
1554  mutable VResult vresult;
1555 
1556  public:
1558 
1559  const VResult &
1560  result() const
1561  {
1562  vresult[0] = data->result();
1563  return vresult;
1564  }
1565 
1566  Result total() const { return data->result(); };
1567 
1568  size_type size() const { return 1; }
1569 
1573  std::string str() const { return data->name; }
1574 };
1575 
1576 template <class Stat>
1577 class ScalarProxyNode : public Node
1578 {
1579  private:
1581  mutable VResult vresult;
1582 
1583  public:
1585  : proxy(p), vresult(1)
1586  { }
1587 
1588  const VResult &
1589  result() const
1590  {
1591  vresult[0] = proxy.result();
1592  return vresult;
1593  }
1594 
1595  Result
1596  total() const
1597  {
1598  return proxy.result();
1599  }
1600 
1601  size_type
1602  size() const
1603  {
1604  return 1;
1605  }
1606 
1610  std::string
1611  str() const
1612  {
1613  return proxy.str();
1614  }
1615 };
1616 
1617 class VectorStatNode : public Node
1618 {
1619  private:
1621 
1622  public:
1624  const VResult &result() const { return data->result(); }
1625  Result total() const { return data->total(); };
1626 
1627  size_type size() const { return data->size(); }
1628 
1629  std::string str() const { return data->name; }
1630 };
1631 
1632 template <class T>
1633 class ConstNode : public Node
1634 {
1635  private:
1637 
1638  public:
1639  ConstNode(T s) : vresult(1, (Result)s) {}
1640  const VResult &result() const { return vresult; }
1641  Result total() const { return vresult[0]; };
1642  size_type size() const { return 1; }
1643  std::string str() const { return std::to_string(vresult[0]); }
1644 };
1645 
1646 template <class T>
1647 class ConstVectorNode : public Node
1648 {
1649  private:
1651 
1652  public:
1653  ConstVectorNode(const T &s) : vresult(s.begin(), s.end()) {}
1654  const VResult &result() const { return vresult; }
1655 
1656  Result
1657  total() const
1658  {
1659  size_type size = this->size();
1660  Result tmp = 0;
1661  for (off_type i = 0; i < size; i++)
1662  tmp += vresult[i];
1663  return tmp;
1664  }
1665 
1666  size_type size() const { return vresult.size(); }
1667  std::string
1668  str() const
1669  {
1670  size_type size = this->size();
1671  std::string tmp = "(";
1672  for (off_type i = 0; i < size; i++)
1673  tmp += csprintf("%s ", std::to_string(vresult[i]));
1674  tmp += ")";
1675  return tmp;
1676  }
1677 };
1678 
1679 template <class Op>
1680 struct OpString;
1681 
1682 template<>
1683 struct OpString<std::plus<Result> >
1684 {
1685  static std::string str() { return "+"; }
1686 };
1687 
1688 template<>
1689 struct OpString<std::minus<Result> >
1690 {
1691  static std::string str() { return "-"; }
1692 };
1693 
1694 template<>
1695 struct OpString<std::multiplies<Result> >
1696 {
1697  static std::string str() { return "*"; }
1698 };
1699 
1700 template<>
1701 struct OpString<std::divides<Result> >
1702 {
1703  static std::string str() { return "/"; }
1704 };
1705 
1706 template<>
1707 struct OpString<std::modulus<Result> >
1708 {
1709  static std::string str() { return "%"; }
1710 };
1711 
1712 template<>
1713 struct OpString<std::negate<Result> >
1714 {
1715  static std::string str() { return "-"; }
1716 };
1717 
1718 template <class Op>
1719 class UnaryNode : public Node
1720 {
1721  public:
1723  mutable VResult vresult;
1724 
1725  public:
1727 
1728  const VResult &
1729  result() const
1730  {
1731  const VResult &lvec = l->result();
1732  size_type size = lvec.size();
1733 
1734  assert(size > 0);
1735 
1736  vresult.resize(size);
1737  Op op;
1738  for (off_type i = 0; i < size; ++i)
1739  vresult[i] = op(lvec[i]);
1740 
1741  return vresult;
1742  }
1743 
1744  Result
1745  total() const
1746  {
1747  const VResult &vec = this->result();
1748  Result total = 0.0;
1749  for (off_type i = 0; i < size(); i++)
1750  total += vec[i];
1751  return total;
1752  }
1753 
1754  size_type size() const { return l->size(); }
1755 
1756  std::string
1757  str() const
1758  {
1759  return OpString<Op>::str() + l->str();
1760  }
1761 };
1762 
1763 template <class Op>
1764 class BinaryNode : public Node
1765 {
1766  public:
1769  mutable VResult vresult;
1770 
1771  public:
1773 
1774  const VResult &
1775  result() const override
1776  {
1777  Op op;
1778  const VResult &lvec = l->result();
1779  const VResult &rvec = r->result();
1780 
1781  assert(lvec.size() > 0 && rvec.size() > 0);
1782 
1783  if (lvec.size() == 1 && rvec.size() == 1) {
1784  vresult.resize(1);
1785  vresult[0] = op(lvec[0], rvec[0]);
1786  } else if (lvec.size() == 1) {
1787  size_type size = rvec.size();
1788  vresult.resize(size);
1789  for (off_type i = 0; i < size; ++i)
1790  vresult[i] = op(lvec[0], rvec[i]);
1791  } else if (rvec.size() == 1) {
1792  size_type size = lvec.size();
1793  vresult.resize(size);
1794  for (off_type i = 0; i < size; ++i)
1795  vresult[i] = op(lvec[i], rvec[0]);
1796  } else if (rvec.size() == lvec.size()) {
1797  size_type size = rvec.size();
1798  vresult.resize(size);
1799  for (off_type i = 0; i < size; ++i)
1800  vresult[i] = op(lvec[i], rvec[i]);
1801  }
1802 
1803  return vresult;
1804  }
1805 
1806  Result
1807  total() const override
1808  {
1809  const VResult &vec = this->result();
1810  const VResult &lvec = l->result();
1811  const VResult &rvec = r->result();
1812  Result total = 0.0;
1813  Result lsum = 0.0;
1814  Result rsum = 0.0;
1815  Op op;
1816 
1817  assert(lvec.size() > 0 && rvec.size() > 0);
1818  assert(lvec.size() == rvec.size() ||
1819  lvec.size() == 1 || rvec.size() == 1);
1820 
1822  if (lvec.size() == rvec.size() && lvec.size() > 1) {
1823  for (off_type i = 0; i < size(); ++i) {
1824  lsum += lvec[i];
1825  rsum += rvec[i];
1826  }
1827  return op(lsum, rsum);
1828  }
1829 
1831  for (off_type i = 0; i < size(); ++i) {
1832  total += vec[i];
1833  }
1834 
1835  return total;
1836  }
1837 
1838  size_type
1839  size() const override
1840  {
1841  size_type ls = l->size();
1842  size_type rs = r->size();
1843  if (ls == 1) {
1844  return rs;
1845  } else if (rs == 1) {
1846  return ls;
1847  } else {
1848  assert(ls == rs && "Node vector sizes are not equal");
1849  return ls;
1850  }
1851  }
1852 
1853  std::string
1854  str() const override
1855  {
1856  return csprintf("(%s %s %s)", l->str(), OpString<Op>::str(), r->str());
1857  }
1858 };
1859 
1860 template <class Op>
1861 class SumNode : public Node
1862 {
1863  public:
1865  mutable VResult vresult;
1866 
1867  public:
1868  SumNode(NodePtr &p) : l(p), vresult(1) {}
1869 
1870  const VResult &
1871  result() const
1872  {
1873  const VResult &lvec = l->result();
1874  size_type size = lvec.size();
1875  assert(size > 0);
1876 
1877  vresult[0] = 0.0;
1878 
1879  Op op;
1880  for (off_type i = 0; i < size; ++i)
1881  vresult[0] = op(vresult[0], lvec[i]);
1882 
1883  return vresult;
1884  }
1885 
1886  Result
1887  total() const
1888  {
1889  const VResult &lvec = l->result();
1890  size_type size = lvec.size();
1891  assert(size > 0);
1892 
1893  Result result = 0.0;
1894 
1895  Op op;
1896  for (off_type i = 0; i < size; ++i)
1897  result = op(result, lvec[i]);
1898 
1899  return result;
1900  }
1901 
1902  size_type size() const { return 1; }
1903 
1904  std::string
1905  str() const
1906  {
1907  return csprintf("total(%s)", l->str());
1908  }
1909 };
1910 
1911 
1913 //
1914 // Visible Statistics Types
1915 //
1917 
1927 class Scalar : public ScalarBase<Scalar, StatStor>
1928 {
1929  public:
1931 
1932  Scalar(Group *parent = nullptr)
1934  parent, nullptr, units::Unspecified::get(), nullptr)
1935  {
1936  }
1937 
1938  Scalar(Group *parent, const char *name, const char *desc = nullptr)
1940  parent, name, units::Unspecified::get(), desc)
1941  {
1942  }
1943 
1944  Scalar(Group *parent, const char *name, const units::Base *unit,
1945  const char *desc = nullptr)
1946  : ScalarBase<Scalar, StatStor>(parent, name, unit, desc)
1947  {
1948  }
1949 };
1950 
1955 class Average : public ScalarBase<Average, AvgStor>
1956 {
1957  public:
1959 
1960  Average(Group *parent = nullptr)
1962  parent, nullptr, units::Unspecified::get(), nullptr)
1963  {
1964  }
1965 
1966  Average(Group *parent, const char *name, const char *desc = nullptr)
1968  parent, name, units::Unspecified::get(), desc)
1969  {
1970  }
1971 
1972  Average(Group *parent, const char *name, const units::Base *unit,
1973  const char *desc = nullptr)
1974  : ScalarBase<Average, AvgStor>(parent, name, unit, desc)
1975  {
1976  }
1977 };
1978 
1979 class Value : public ValueBase<Value>
1980 {
1981  public:
1982  Value(Group *parent = nullptr)
1983  : ValueBase<Value>(parent, nullptr, units::Unspecified::get(), nullptr)
1984  {
1985  }
1986 
1987  Value(Group *parent, const char *name, const char *desc = nullptr)
1988  : ValueBase<Value>(parent, name, units::Unspecified::get(), desc)
1989  {
1990  }
1991 
1992  Value(Group *parent, const char *name, const units::Base *unit,
1993  const char *desc = nullptr)
1994  : ValueBase<Value>(parent, name, unit, desc)
1995  {
1996  }
1997 };
1998 
2003 class Vector : public VectorBase<Vector, StatStor>
2004 {
2005  public:
2006  Vector(Group *parent = nullptr)
2008  parent, nullptr, units::Unspecified::get(), nullptr)
2009  {
2010  }
2011 
2012  Vector(Group *parent, const char *name, const char *desc = nullptr)
2014  parent, name, units::Unspecified::get(), desc)
2015  {
2016  }
2017 
2018  Vector(Group *parent, const char *name, const units::Base *unit,
2019  const char *desc = nullptr)
2020  : VectorBase<Vector, StatStor>(parent, name, unit, desc)
2021  {
2022  }
2023 };
2024 
2029 class AverageVector : public VectorBase<AverageVector, AvgStor>
2030 {
2031  public:
2032  AverageVector(Group *parent = nullptr)
2034  parent, nullptr, units::Unspecified::get(), nullptr)
2035  {
2036  }
2037 
2038  AverageVector(Group *parent, const char *name, const char *desc = nullptr)
2040  parent, name, units::Unspecified::get(), desc)
2041  {
2042  }
2043 
2044  AverageVector(Group *parent, const char *name, const units::Base *unit,
2045  const char *desc = nullptr)
2046  : VectorBase<AverageVector, AvgStor>(parent, name, unit, desc)
2047  {
2048  }
2049 };
2050 
2055 class Vector2d : public Vector2dBase<Vector2d, StatStor>
2056 {
2057  public:
2058  Vector2d(Group *parent = nullptr)
2060  parent, nullptr, units::Unspecified::get(), nullptr)
2061  {
2062  }
2063 
2064  Vector2d(Group *parent, const char *name, const char *desc = nullptr)
2066  parent, name, units::Unspecified::get(), desc)
2067  {
2068  }
2069 
2070  Vector2d(Group *parent, const char *name, const units::Base *unit,
2071  const char *desc = nullptr)
2072  : Vector2dBase<Vector2d, StatStor>(parent, name, unit, desc)
2073  {
2074  }
2075 };
2076 
2081 class Distribution : public DistBase<Distribution, DistStor>
2082 {
2083  public:
2084  Distribution(Group *parent = nullptr)
2086  parent, nullptr, units::Unspecified::get(), nullptr)
2087  {
2088  }
2089 
2090  Distribution(Group *parent, const char *name, const char *desc = nullptr)
2092  parent, name, units::Unspecified::get(), desc)
2093  {
2094  }
2095 
2096  Distribution(Group *parent, const char *name, const units::Base *unit,
2097  const char *desc = nullptr)
2098  : DistBase<Distribution, DistStor>(parent, name, unit, desc)
2099  {
2100  }
2101 
2109  Distribution &
2110  init(Counter min, Counter max, Counter bkt)
2111  {
2112  DistStor::Params *params = new DistStor::Params(min, max, bkt);
2113  this->setParams(params);
2114  this->doInit();
2115  return this->self();
2116  }
2117 };
2118 
2123 class Histogram : public DistBase<Histogram, HistStor>
2124 {
2125  public:
2126  Histogram(Group *parent = nullptr)
2128  parent, nullptr, units::Unspecified::get(), nullptr)
2129  {
2130  }
2131 
2132  Histogram(Group *parent, const char *name,
2133  const char *desc = nullptr)
2135  parent, name, units::Unspecified::get(), desc)
2136  {
2137  }
2138 
2139  Histogram(Group *parent, const char *name, const units::Base *unit,
2140  const char *desc = nullptr)
2141  : DistBase<Histogram, HistStor>(parent, name, unit, desc)
2142  {
2143  }
2144 
2150  Histogram &
2152  {
2153  HistStor::Params *params = new HistStor::Params(size);
2154  this->setParams(params);
2155  this->doInit();
2156  return this->self();
2157  }
2158 };
2159 
2164 class StandardDeviation : public DistBase<StandardDeviation, SampleStor>
2165 {
2166  public:
2170  StandardDeviation(Group *parent = nullptr)
2172  parent, nullptr, units::Unspecified::get(), nullptr)
2173  {
2174  SampleStor::Params *params = new SampleStor::Params;
2175  this->doInit();
2176  this->setParams(params);
2177  }
2178 
2179  StandardDeviation(Group *parent, const char *name,
2180  const char *desc = nullptr)
2182  parent, name, units::Unspecified::get(), desc)
2183  {
2184  SampleStor::Params *params = new SampleStor::Params;
2185  this->doInit();
2186  this->setParams(params);
2187  }
2188 
2189  StandardDeviation(Group *parent, const char *name, const units::Base *unit,
2190  const char *desc = nullptr)
2192  {
2193  SampleStor::Params *params = new SampleStor::Params;
2194  this->doInit();
2195  this->setParams(params);
2196  }
2197 };
2198 
2203 class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor>
2204 {
2205  public:
2209  AverageDeviation(Group *parent = nullptr)
2211  parent, nullptr, units::Unspecified::get(), nullptr)
2212  {
2214  this->doInit();
2215  this->setParams(params);
2216  }
2217 
2218  AverageDeviation(Group *parent, const char *name,
2219  const char *desc = nullptr)
2221  parent, name, units::Unspecified::get(), desc)
2222  {
2224  this->doInit();
2225  this->setParams(params);
2226  }
2227 
2228  AverageDeviation(Group *parent, const char *name, const units::Base *unit,
2229  const char *desc = nullptr)
2231  {
2233  this->doInit();
2234  this->setParams(params);
2235  }
2236 };
2237 
2242 class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor>
2243 {
2244  public:
2245  VectorDistribution(Group *parent = nullptr)
2246  : VectorDistBase<VectorDistribution, DistStor>(parent, nullptr,
2247  units::Unspecified::get(), nullptr)
2248  {
2249  }
2250 
2251  VectorDistribution(Group *parent, const char *name,
2252  const char *desc = nullptr)
2254  parent, name, units::Unspecified::get(), desc)
2255  {
2256  }
2257 
2258  VectorDistribution(Group *parent, const char *name,
2259  const units::Base *unit,
2260  const char *desc = nullptr)
2262  desc)
2263  {
2264  }
2265 
2276  {
2277  DistStor::Params *params = new DistStor::Params(min, max, bkt);
2278  this->setParams(params);
2279  this->doInit(size);
2280  return this->self();
2281  }
2282 };
2283 
2289  : public VectorDistBase<VectorStandardDeviation, SampleStor>
2290 {
2291  public:
2292  VectorStandardDeviation(Group *parent = nullptr)
2294  units::Unspecified::get(), nullptr)
2295  {
2296  }
2297 
2298  VectorStandardDeviation(Group *parent, const char *name,
2299  const char *desc = nullptr)
2301  units::Unspecified::get(), desc)
2302  {
2303  }
2304 
2305  VectorStandardDeviation(Group *parent, const char *name,
2306  const units::Base *unit,
2307  const char *desc = nullptr)
2309  unit, desc)
2310  {
2311  }
2312 
2320  {
2321  SampleStor::Params *params = new SampleStor::Params;
2322  this->doInit(size);
2323  this->setParams(params);
2324  return this->self();
2325  }
2326 };
2327 
2333  : public VectorDistBase<VectorAverageDeviation, AvgSampleStor>
2334 {
2335  public:
2336  VectorAverageDeviation(Group *parent = nullptr)
2338  nullptr, units::Unspecified::get(), nullptr)
2339  {
2340  }
2341 
2342  VectorAverageDeviation(Group *parent, const char *name,
2343  const char *desc = nullptr)
2345  units::Unspecified::get(), desc)
2346  {
2347  }
2348 
2349  VectorAverageDeviation(Group *parent, const char *name,
2350  const units::Base *unit,
2351  const char *desc = nullptr)
2353  unit, desc)
2354  {
2355  }
2356 
2364  {
2366  this->doInit(size);
2367  this->setParams(params);
2368  return this->self();
2369  }
2370 };
2371 
2372 template <class Stat>
2373 class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo>
2374 {
2375  protected:
2376  mutable VResult vec;
2377  mutable VCounter cvec;
2378 
2379  public:
2380  FormulaInfoProxy(Stat &stat) : InfoProxy<Stat, FormulaInfo>(stat) {}
2381 
2382  size_type size() const { return this->s.size(); }
2383 
2384  const VResult &
2385  result() const
2386  {
2387  this->s.result(vec);
2388  return vec;
2389  }
2390  Result total() const { return this->s.total(); }
2391  VCounter &value() const { return cvec; }
2392 
2393  std::string str() const { return this->s.str(); }
2394 };
2395 
2396 template <class Stat>
2397 class SparseHistInfoProxy : public InfoProxy<Stat, SparseHistInfo>
2398 {
2399  public:
2400  SparseHistInfoProxy(Stat &stat) : InfoProxy<Stat, SparseHistInfo>(stat) {}
2401 };
2402 
2407 template <class Derived, class Stor>
2408 class SparseHistBase : public DataWrap<Derived, SparseHistInfoProxy>
2409 {
2410  public:
2412  typedef Stor Storage;
2413  typedef typename Stor::Params Params;
2414 
2415  protected:
2417  char storage[sizeof(Storage)];
2418 
2419  protected:
2424  Storage *
2426  {
2427  return reinterpret_cast<Storage *>(storage);
2428  }
2429 
2434  const Storage *
2435  data() const
2436  {
2437  return reinterpret_cast<const Storage *>(storage);
2438  }
2439 
2440  void
2442  {
2443  new (storage) Storage(this->info()->getStorageParams());
2444  this->setInit();
2445  }
2446 
2447  public:
2448  SparseHistBase(Group *parent, const char *name,
2449  const units::Base *unit,
2450  const char *desc)
2451  : DataWrap<Derived, SparseHistInfoProxy>(parent, name, unit, desc)
2452  {
2453  }
2454 
2461  template <typename U>
2462  void sample(const U &v, int n = 1) { data()->sample(v, n); }
2463 
2468  size_type size() const { return data()->size(); }
2473  bool zero() const { return data()->zero(); }
2474 
2475  void
2477  {
2478  Info *info = this->info();
2479  data()->prepare(info->getStorageParams(), info->data);
2480  }
2481 
2485  void
2487  {
2488  data()->reset(this->info()->getStorageParams());
2489  }
2490 };
2491 
2492 class SparseHistogram : public SparseHistBase<SparseHistogram, SparseHistStor>
2493 {
2494  public:
2495  SparseHistogram(Group *parent = nullptr)
2496  : SparseHistBase<SparseHistogram, SparseHistStor>(parent, nullptr,
2497  units::Unspecified::get(), nullptr)
2498  {
2499  }
2500 
2501  SparseHistogram(Group *parent, const char *name,
2502  const char *desc = nullptr)
2504  units::Unspecified::get(), desc)
2505  {
2506  }
2507 
2508  SparseHistogram(Group *parent, const char *name, const units::Base *unit,
2509  const char *desc = nullptr)
2511  desc)
2512  {
2513  }
2514 
2520  SparseHistogram &
2522  {
2524  this->setParams(params);
2525  this->doInit();
2526  return this->self();
2527  }
2528 };
2529 
2530 class Temp;
2536 class Formula : public DataWrapVec<Formula, FormulaInfoProxy>
2537 {
2538  protected:
2541  friend class Temp;
2542 
2543  public:
2547  Formula(Group *parent = nullptr, const char *name = nullptr,
2548  const char *desc = nullptr);
2549 
2550  Formula(Group *parent, const char *name, const units::Base *unit,
2551  const char *desc = nullptr);
2552 
2553  Formula(Group *parent, const char *name, const char *desc,
2554  const Temp &r);
2555 
2556  Formula(Group *parent, const char *name, const units::Base *unit,
2557  const char *desc, const Temp &r);
2558 
2564  const Formula &operator=(const Temp &r);
2565 
2566  template<typename T>
2567  const Formula &operator=(const T &v)
2568  {
2569  *this = Temp(v);
2570  return *this;
2571  }
2572 
2578  const Formula &operator+=(Temp r);
2579 
2585  const Formula &operator/=(Temp r);
2586 
2594  void result(VResult &vec) const;
2595 
2606  Result total() const;
2607 
2611  size_type size() const;
2612 
2613  void prepare() { }
2614 
2618  void reset();
2619 
2623  bool zero() const;
2624 
2625  std::string str() const;
2626 };
2627 
2628 class FormulaNode : public Node
2629 {
2630  private:
2632  mutable VResult vec;
2633 
2634  public:
2636 
2637  size_type size() const { return formula.size(); }
2638  const VResult &result() const { formula.result(vec); return vec; }
2639  Result total() const { return formula.total(); }
2640 
2641  std::string str() const { return formula.str(); }
2642 };
2643 
2647 class Temp
2648 {
2649  protected:
2654 
2655  public:
2660  Temp(const NodePtr &n) : node(n) { }
2661 
2662  Temp(NodePtr &&n) : node(std::move(n)) { }
2663 
2668  operator NodePtr&() { return node; }
2669 
2673  NodePtr getNodePtr() const { return node; }
2674 
2675  public:
2680  Temp(const Scalar &s)
2681  : node(new ScalarStatNode(s.info()))
2682  { }
2683 
2688  Temp(const Value &s)
2689  : node(new ScalarStatNode(s.info()))
2690  { }
2691 
2696  Temp(const Average &s)
2697  : node(new ScalarStatNode(s.info()))
2698  { }
2699 
2704  Temp(const Vector &s)
2705  : node(new VectorStatNode(s.info()))
2706  { }
2707 
2709  : node(new VectorStatNode(s.info()))
2710  { }
2711 
2715  Temp(const Formula &f)
2716  : node(new FormulaNode(f))
2717  { }
2718 
2723  template <class Stat>
2725  : node(new ScalarProxyNode<Stat>(p))
2726  { }
2727 
2732  Temp(signed char value)
2733  : node(new ConstNode<signed char>(value))
2734  { }
2735 
2740  Temp(unsigned char value)
2741  : node(new ConstNode<unsigned char>(value))
2742  { }
2743 
2748  Temp(signed short value)
2749  : node(new ConstNode<signed short>(value))
2750  { }
2751 
2756  Temp(unsigned short value)
2757  : node(new ConstNode<unsigned short>(value))
2758  { }
2759 
2764  Temp(signed int value)
2765  : node(new ConstNode<signed int>(value))
2766  { }
2767 
2772  Temp(unsigned int value)
2773  : node(new ConstNode<unsigned int>(value))
2774  { }
2775 
2780  Temp(signed long value)
2781  : node(new ConstNode<signed long>(value))
2782  { }
2783 
2788  Temp(unsigned long value)
2789  : node(new ConstNode<unsigned long>(value))
2790  { }
2791 
2796  Temp(signed long long value)
2797  : node(new ConstNode<signed long long>(value))
2798  { }
2799 
2804  Temp(unsigned long long value)
2805  : node(new ConstNode<unsigned long long>(value))
2806  { }
2807 
2812  Temp(float value)
2813  : node(new ConstNode<float>(value))
2814  { }
2815 
2820  Temp(double value)
2821  : node(new ConstNode<double>(value))
2822  { }
2823 };
2824 
2825 
2830 inline Temp
2832 {
2833  return Temp(std::make_shared<BinaryNode<std::plus<Result> > >(l, r));
2834 }
2835 
2836 inline Temp
2838 {
2839  return Temp(std::make_shared<BinaryNode<std::minus<Result> > >(l, r));
2840 }
2841 
2842 inline Temp
2844 {
2845  return Temp(std::make_shared<BinaryNode<std::multiplies<Result> > >(l, r));
2846 }
2847 
2848 inline Temp
2850 {
2851  return Temp(std::make_shared<BinaryNode<std::divides<Result> > >(l, r));
2852 }
2853 
2854 inline Temp
2856 {
2857  return Temp(std::make_shared<UnaryNode<std::negate<Result> > >(l));
2858 }
2859 
2860 template <typename T>
2861 inline Temp
2863 {
2864  return Temp(std::make_shared<ConstNode<T> >(val));
2865 }
2866 
2867 template <typename T>
2868 inline Temp
2870 {
2871  return Temp(std::make_shared<ConstVectorNode<T> >(val));
2872 }
2873 
2874 inline Temp
2876 {
2877  return Temp(std::make_shared<SumNode<std::plus<Result> > >(val));
2878 }
2879 
2881 void dump();
2882 void reset();
2883 void enable();
2884 bool enabled();
2885 const Info* resolve(const std::string &name);
2886 
2892 typedef void (*Handler)();
2893 
2894 void registerHandlers(Handler reset_handler, Handler dump_handler);
2895 
2900 void registerResetCallback(const std::function<void()> &callback);
2901 
2906 void registerDumpCallback(const std::function<void()> &callback);
2907 
2911 void processResetQueue();
2912 
2916 void processDumpQueue();
2917 
2919 
2920 typedef std::map<const void *, Info *> MapType;
2921 MapType &statsMap();
2922 
2923 } // namespace statistics
2924 
2925 void debugDumpStats();
2926 
2927 } // namespace gem5
2928 
2929 #endif // __BASE_STATISTICS_HH__
gem5::statistics::ValueBase::zero
bool zero() const
Definition: statistics.hh:776
gem5::statistics::ProxyInfo::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:636
gem5::statistics::OpString< std::negate< Result > >::str
static std::string str()
Definition: statistics.hh:1715
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::statistics::DistInfoProxy
Definition: statistics.hh:159
gem5::statistics::DistProxy
Definition: statistics.hh:1361
gem5::statistics::DistBase
Implementation of a distribution stat.
Definition: statistics.hh:1271
gem5::statistics::BinaryNode::result
const VResult & result() const override
Return the result vector of this subtree.
Definition: statistics.hh:1775
gem5::statistics::SampleStor::Params
Definition: storage.hh:571
gem5::statistics::ScalarProxy::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:860
gem5::statistics::DistStor
Templatized storage and interface for a distribution stat.
Definition: storage.hh:233
gem5::statistics::Temp::Temp
Temp(unsigned long long value)
Create a ConstNode.
Definition: statistics.hh:2804
gem5::statistics::SparseHistInfoProxy
Definition: statistics.hh:2397
gem5::statistics::Vector2dBase::check
bool check() const
Definition: statistics.hh:1254
gem5::statistics::DataWrapVec2d::ysubname
Derived & ysubname(off_type index, const std::string &subname)
Definition: statistics.hh:487
gem5::statistics::DataWrap::DataWrap
DataWrap()=delete
gem5::statistics::FormulaInfoProxy::vec
VResult vec
Definition: statistics.hh:2376
gem5::statistics::ScalarBase::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:599
gem5::statistics::SparseHistStor
Templatized storage and interface for a sparse histogram stat.
Definition: storage.hh:714
gem5::statistics::FormulaNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:2638
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:225
gem5::statistics::DistBase::Params
Stor::Params Params
Definition: statistics.hh:1276
types.hh
gem5::statistics::DistBase::add
void add(DistBase &d)
Add the argument distribution to the this distribution.
Definition: statistics.hh:1357
gem5::statistics::UnaryNode::str
std::string str() const
Definition: statistics.hh:1757
gem5::statistics::BinaryNode::vresult
VResult vresult
Definition: statistics.hh:1769
gem5::statistics::operator+
Temp operator+(Temp l, Temp r)
Definition: statistics.hh:2831
gem5::statistics::InfoAccess::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:208
gem5::statistics::ScalarStatNode
Definition: statistics.hh:1550
gem5::statistics::VectorProxy::VectorProxy
VectorProxy(Stat &s, off_type o, size_type l)
Definition: statistics.hh:1104
gem5::statistics::SparseHistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:2435
warn
#define warn(...)
Definition: logging.hh:245
gem5::statistics::DistInfo
Definition: info.hh:201
gem5::statistics::Histogram::Histogram
Histogram(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2139
gem5::statistics::AvgSampleStor
Templatized storage for distribution that calculates per tick mean and variance.
Definition: storage.hh:638
gem5::statistics::OpString< std::modulus< Result > >::str
static std::string str()
Definition: statistics.hh:1709
gem5::statistics::units::Base
The Base class is the parent class of all unit classes.
Definition: units.hh:122
gem5::statistics::Vector2dBase::y
size_type y
Definition: statistics.hh:1148
gem5::statistics::VectorDistInfo::data
std::vector< DistData > data
Definition: info.hh:211
gem5::statistics::VectorDistBase::Proxy
DistProxy< Derived > Proxy
Definition: statistics.hh:1370
gem5::statistics::FormulaNode::str
std::string str() const
Definition: statistics.hh:2641
gem5::statistics::Distribution
A simple distribution stat.
Definition: statistics.hh:2081
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent=nullptr)
Definition: statistics.hh:2495
gem5::statistics::Result
double Result
All results are doubles.
Definition: types.hh:56
gem5::statistics::FormulaNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:2637
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2189
gem5::statistics::ValueProxy::value
Counter value() const
Definition: statistics.hh:652
gem5::statistics::ConstVectorNode::vresult
VResult vresult
Definition: statistics.hh:1650
gem5::statistics::SparseHistBase::storage
char storage[sizeof(Storage)]
The storage for this stat.
Definition: statistics.hh:2417
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::statistics::SampleStor
Templatized storage and interface for a distribution that calculates mean and variance.
Definition: storage.hh:560
gem5::statistics::DistBase::doInit
void doInit()
Definition: statistics.hh:1304
gem5::statistics::ConstNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1642
gem5::statistics::SparseHistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:2473
gem5::statistics::SparseHistBase::Params
Stor::Params Params
Definition: statistics.hh:2413
group.hh
gem5::statistics::Vector::Vector
Vector(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2018
gem5::statistics::sum
Temp sum(Temp val)
Definition: statistics.hh:2875
gem5::statistics::VectorDistBase::storage
std::vector< Storage * > storage
Definition: statistics.hh:1375
gem5::statistics::MethodProxy
A proxy similar to the FunctorProxy, but allows calling a method of a bound object,...
Definition: statistics.hh:696
gem5::statistics::UnaryNode
Definition: statistics.hh:1719
gem5::statistics::ConstNode
Definition: statistics.hh:1633
gem5::statistics::Formula::Temp
friend class Temp
Definition: statistics.hh:2541
gem5::statistics::VectorBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:988
gem5::statistics::VectorInfo
Definition: info.hh:184
gem5::statistics::resolve
const Info * resolve(const std::string &name)
Definition: statistics.cc:313
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
gem5::statistics::ScalarProxyNode::vresult
VResult vresult
Definition: statistics.hh:1581
gem5::statistics::Vector2dBase::Vector2dBase
Vector2dBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1156
warn_once
#define warn_once(...)
Definition: logging.hh:249
gem5::statistics::Vector2dBase::init
Derived & init(size_type _x, size_type _y)
Definition: statistics.hh:1171
gem5::statistics::AvgSampleStor::Params
Definition: storage.hh:647
gem5::statistics::InfoProxy
Definition: statistics.hh:99
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:2349
gem5::statistics::OpString< std::minus< Result > >::str
static std::string str()
Definition: statistics.hh:1691
gem5::statistics::ValueProxy::ValueProxy
ValueProxy(T &val)
Definition: statistics.hh:651
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2179
gem5::statistics::Temp::Temp
Temp(const NodePtr &n)
Copy the given pointer to this class.
Definition: statistics.hh:2660
gem5::statistics::FormulaInfoProxy::size
size_type size() const
Definition: statistics.hh:2382
gem5::statistics::ScalarBase::reset
void reset()
Definition: statistics.hh:627
gem5::statistics::Temp::Temp
Temp(const Scalar &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2680
gem5::statistics::VectorStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1625
gem5::statistics::InfoAccess::_info
Info * _info
Definition: statistics.hh:186
gem5::ArmISA::f
Bitfield< 6 > f
Definition: misc_types.hh:67
gem5::statistics::VectorDistInfoProxy::VectorDistInfoProxy
VectorDistInfoProxy(Stat &stat)
Definition: statistics.hh:169
gem5::statistics::ConstVectorNode::ConstVectorNode
ConstVectorNode(const T &s)
Definition: statistics.hh:1653
gem5::statistics::ScalarBase::result
Result result() const
Definition: statistics.hh:621
gem5::statistics::Temp::Temp
Temp(double value)
Create a ConstNode.
Definition: statistics.hh:2820
gem5::statistics::InfoProxy::prepare
void prepare()
Definition: statistics.hh:108
gem5::statistics::VectorInfo::result
virtual const VResult & result() const =0
gem5::statistics::ProxyInfo::zero
bool zero() const
Definition: statistics.hh:639
gem5::statistics::BinaryNode::r
NodePtr r
Definition: statistics.hh:1768
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2305
gem5::statistics::SparseHistBase::doInit
void doInit()
Definition: statistics.hh:2441
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2209
gem5::statistics::DistProxy::size
size_type size() const
Definition: statistics.hh:1493
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:947
gem5::statistics::VectorStatNode::data
const VectorInfo * data
Definition: statistics.hh:1620
gem5::statistics::Temp
Helper class to construct formula node trees.
Definition: statistics.hh:2647
gem5::statistics::ScalarProxy::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:807
gem5::statistics::ValueBase::size
size_type size() const
Definition: statistics.hh:773
gem5::statistics::BinaryNode::l
NodePtr l
Definition: statistics.hh:1767
gem5::statistics::Temp::Temp
Temp(const Vector &s)
Create a new VectorStatNode.
Definition: statistics.hh:2704
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2218
gem5::statistics::DistProxy::data
Stat::Storage * data()
Definition: statistics.hh:1464
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:775
gem5::statistics::ScalarBase::total
Result total() const
Definition: statistics.hh:623
gem5::statistics::ConstNode::str
std::string str() const
Definition: statistics.hh:1643
gem5::ArmISA::a
Bitfield< 8 > a
Definition: misc_types.hh:65
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:399
gem5::statistics::Average
A stat that calculates the per tick average of a value.
Definition: statistics.hh:1955
gem5::statistics::InfoAccess::InfoAccess
InfoAccess()
Definition: statistics.hh:202
cast.hh
gem5::statistics::StandardDeviation
Calculates the mean and variance of all the samples.
Definition: statistics.hh:2164
gem5::statistics::Vector2d
A 2-Dimensional vecto of scalar stats.
Definition: statistics.hh:2055
gem5::statistics::Temp::Temp
Temp(signed long long value)
Create a ConstNode.
Definition: statistics.hh:2796
gem5::statistics::ScalarProxy::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:852
gem5::statistics::VectorStandardDeviation::init
VectorStandardDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2319
gem5::statistics::Vector2dBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1245
gem5::statistics::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:232
gem5::statistics::UnaryNode::UnaryNode
UnaryNode(NodePtr &p)
Definition: statistics.hh:1726
gem5::statistics::VectorInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:133
gem5::statistics::Vector
A vector of scalar stats.
Definition: statistics.hh:2003
gem5::statistics::ScalarInfo
Definition: info.hh:176
gem5::statistics::ScalarStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1560
gem5::statistics::VectorDistBase::Info
VectorDistInfoProxy< Derived > Info
Definition: statistics.hh:1367
gem5::statistics::ScalarProxyNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1589
gem5::statistics::VectorDistBase::~VectorDistBase
~VectorDistBase()
Definition: statistics.hh:1411
gem5::statistics::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2536
gem5::statistics::Distribution::Distribution
Distribution(Group *parent=nullptr)
Definition: statistics.hh:2084
std::vector< Counter >
gem5::statistics::Temp::Temp
Temp(const Value &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2688
gem5::statistics::DistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:1288
gem5::statistics::DistBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:1298
gem5::statistics::ScalarStatNode::vresult
VResult vresult
Definition: statistics.hh:1554
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:2756
gem5::statistics::ScalarBase
Implementation of a scalar stat.
Definition: statistics.hh:517
gem5::statistics::Vector2dBase::prepare
void prepare()
Definition: statistics.hh:1228
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:763
gem5::statistics::VectorDistBase::prepare
void prepare()
Definition: statistics.hh:1440
gem5::statistics::DataWrap
Definition: statistics.hh:225
gem5::statistics::FormulaNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:2639
gem5::statistics::DataWrapVec2d::DataWrapVec2d
DataWrapVec2d(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:464
gem5::statistics::units::Unspecified::get
static Unspecified * get()
Definition: units.hh:329
gem5::statistics::ScalarProxyNode::proxy
const ScalarProxy< Stat > proxy
Definition: statistics.hh:1580
gem5::statistics::ScalarProxy::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:895
gem5::statistics::ScalarProxy::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:904
gem5::statistics::ValueBase::total
Result total() const
Definition: statistics.hh:772
gem5::statistics::Temp::Temp
Temp(unsigned long value)
Create a ConstNode.
Definition: statistics.hh:2788
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
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:192
gem5::statistics::DistProxy::index
off_type index
Definition: statistics.hh:1461
gem5::statistics::ScalarProxyNode::ScalarProxyNode
ScalarProxyNode(const ScalarProxy< Stat > &p)
Definition: statistics.hh:1584
gem5::statistics::Temp::Temp
Temp(const ScalarProxy< Stat > &p)
Create a new ScalarProxyNode.
Definition: statistics.hh:2724
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible< std::function< Result()>, const T & >::value > >::functor
std::function< Result()> functor
Definition: statistics.hh:682
gem5::statistics::Formula::result
void result(VResult &vec) const
Return the result of the Fomula in a vector.
Definition: statistics.cc:203
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible< std::function< Result()>, const T & >::value > >::total
Result total() const
Definition: statistics.hh:688
gem5::statistics::VectorAverageDeviation
This is a vector of AverageDeviation stats.
Definition: statistics.hh:2332
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible< std::function< Result()>, const T & >::value > >::result
Result result() const
Definition: statistics.hh:687
gem5::statistics::VectorStatNode::VectorStatNode
VectorStatNode(const VectorInfo *d)
Definition: statistics.hh:1623
gem5::statistics::InfoProxy::s
Stat & s
Definition: statistics.hh:102
gem5::statistics::HistStor::Params
The parameters for a distribution stat.
Definition: storage.hh:460
gem5::statistics::SumNode::str
std::string str() const
Definition: statistics.hh:1905
gem5::statistics::SparseHistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:2468
gem5::statistics::VectorDistInfoProxy
Definition: statistics.hh:166
gem5::statistics::DistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:1325
gem5::statistics::ValueProxy
Definition: statistics.hh:645
gem5::statistics::FormulaNode::formula
const Formula & formula
Definition: statistics.hh:2631
gem5::statistics::SumNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1902
gem5::statistics::UnaryNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1745
gem5::statistics::Temp::Temp
Temp(float value)
Create a ConstNode.
Definition: statistics.hh:2812
gem5::statistics::VectorBase
Implementation of a vector of stats.
Definition: statistics.hh:919
gem5::statistics::Temp::Temp
Temp(const Average &s)
Create a new ScalarStatNode.
Definition: statistics.hh:2696
storage.hh
gem5::statistics::Vector2dBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1153
gem5::statistics::ProxyInfo::str
std::string str() const
Definition: statistics.hh:634
gem5::statistics::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2342
gem5::statistics::constant
Temp constant(T val)
Definition: statistics.hh:2862
gem5::statistics::ScalarInfo::result
virtual Result result() const =0
gem5::statistics::registerHandlers
void registerHandlers(Handler reset_handler, Handler dump_handler)
Definition: statistics.cc:250
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:324
gem5::statistics::VectorBase::value
void value(VCounter &vec) const
Definition: statistics.hh:964
gem5::statistics::FunctorProxy::total
Result total() const
Definition: statistics.hh:667
gem5::statistics::Vector2dInfoProxy
Definition: statistics.hh:175
str.hh
gem5::statistics::ScalarStatNode::data
const ScalarInfo * data
Definition: statistics.hh:1553
gem5::statistics::Average::Average
Average(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1972
gem5::statistics::Histogram::Histogram
Histogram(Group *parent=nullptr)
Definition: statistics.hh:2126
gem5::statistics::DistBase::size
size_type size() const
Return the number of entries in this stat.
Definition: statistics.hh:1331
gem5::statistics::ProxyInfo::size
size_type size() const
Definition: statistics.hh:635
gem5::statistics::Scalar::Scalar
Scalar(Group *parent=nullptr)
Definition: statistics.hh:1932
gem5::statistics::VectorStatNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1624
gem5::statistics::Node::~Node
virtual ~Node()
Definition: statistics.hh:1544
gem5::statistics::FunctorProxy::FunctorProxy
FunctorProxy(T &func)
Definition: statistics.hh:664
gem5::statistics::ScalarProxy::stat
Stat & stat
Pointer to the parent Vector.
Definition: statistics.hh:797
gem5::statistics::Histogram
A simple histogram stat.
Definition: statistics.hh:2123
gem5::statistics::operator/
Temp operator/(Temp l, Temp r)
Definition: statistics.hh:2849
gem5::auxv::Base
@ Base
Definition: aux_vector.hh:76
info.hh
gem5::statistics::ScalarProxy::ScalarProxy
ScalarProxy(const ScalarProxy &sp)
Create a copy of the provided ScalarProxy.
Definition: statistics.hh:829
gem5::statistics::FunctorProxy::value
Counter value() const
Definition: statistics.hh:665
gem5::statistics::Vector2dBase::Params
Stor::Params Params
Definition: statistics.hh:1139
gem5::statistics::BinaryNode::size
size_type size() const override
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1839
gem5::statistics::DataWrap::operator=
DataWrap & operator=(const DataWrap &)=delete
gem5::statistics::ScalarBase::Storage
Stor Storage
Definition: statistics.hh:520
gem5::statistics::Node
Base class for formula statistic node.
Definition: statistics.hh:1520
gem5::Flags< FlagsType >
gem5::statistics::DataWrap::info
Info * info()
Definition: statistics.hh:235
gem5::statistics::OpString< std::plus< Result > >::str
static std::string str()
Definition: statistics.hh:1685
gem5::statistics::ScalarBase::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:583
gem5::statistics::Vector2dBase::Proxy
VectorProxy< Derived > Proxy
Definition: statistics.hh:1140
gem5::statistics::DistBase::Storage
Stor Storage
Definition: statistics.hh:1275
gem5::statistics::VectorStatNode::str
std::string str() const
Definition: statistics.hh:1629
gem5::statistics::ScalarInfo::total
virtual Result total() const =0
gem5::statistics::InfoAccess::info
Info * info()
Grab the information class for this statistic.
Definition: statistics.cc:112
gem5::statistics::VectorDistribution::init
VectorDistribution & init(size_type size, Counter min, Counter max, Counter bkt)
Initialize storage and parameters for this distribution.
Definition: statistics.hh:2275
gem5::statistics::ScalarProxy::operator--
void operator--(int)
Decrement the stat by 1.
Definition: statistics.hh:862
gem5::statistics::SparseHistogram::init
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2521
gem5::statistics::AverageVector
A vector of Average stats.
Definition: statistics.hh:2029
gem5::statistics::SparseHistBase::Info
SparseHistInfoProxy< Derived > Info
Definition: statistics.hh:2411
gem5::statistics::off_type
unsigned int off_type
Definition: types.hh:61
gem5::statistics::Temp::Temp
Temp(unsigned int value)
Create a ConstNode.
Definition: statistics.hh:2772
gem5::ArmISA::b
Bitfield< 7 > b
Definition: misc_types.hh:381
gem5::statistics::Vector2dInfo::cvec
VCounter cvec
Local storage for the entry values, used for printing.
Definition: info.hh:238
gem5::statistics::Output
Definition: output.hh:65
gem5::statistics::VectorStandardDeviation
This is a vector of StandardDeviation stats.
Definition: statistics.hh:2288
gem5::statistics::ScalarBase::operator++
void operator++(int)
Increment the stat by 1.
Definition: statistics.hh:581
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:286
gem5::statistics::Distribution::init
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
Definition: statistics.hh:2110
gem5::statistics::DistProxy::data
const Stat::Storage * data() const
Definition: statistics.hh:1465
gem5::statistics::FunctorProxy::functor
T * functor
Definition: statistics.hh:661
gem5::statistics::Vector2dBase::size
size_type size() const
Definition: statistics.hh:1203
gem5::statistics::Vector2dInfoProxy::total
Result total() const
Definition: statistics.hh:180
gem5::statistics::Value::Value
Value(Group *parent=nullptr)
Definition: statistics.hh:1982
gem5::statistics::MethodProxy::value
Counter value() const
Definition: statistics.hh:705
gem5::statistics::DataWrapVec2d::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:462
gem5::statistics::VectorProxy::result
const VResult & result() const
Definition: statistics.hh:1084
gem5::statistics::VectorBase::doInit
void doInit(size_type s)
Definition: statistics.hh:950
gem5::statistics::SparseHistInfo
Definition: info.hh:251
gem5::statistics::ScalarBase::GEM5_ALIGNED
GEM5_ALIGNED(8) char storage[sizeof(Storage)]
The storage of this stat.
gem5::statistics::VectorInfoProxy::rvec
VResult rvec
Definition: statistics.hh:134
gem5::statistics::VectorDistBase::doInit
void doInit(size_type s)
Definition: statistics.hh:1391
gem5::statistics::Vector2dBase::total
Result total() const
Return a total of all entries in this vector.
Definition: statistics.hh:1219
gem5::statistics::statsMap
MapType & statsMap()
Definition: statistics.cc:69
gem5::statistics::VectorBase::Proxy
ScalarProxy< Derived > Proxy
Proxy type.
Definition: statistics.hh:926
gem5::statistics::Vector2dBase::data
Storage * data(off_type index)
Definition: statistics.hh:1152
gem5::statistics::enable
void enable()
Definition: statistics.cc:286
gem5::statistics::ScalarBase::operator-=
void operator-=(const U &v)
Decrement the stat by the given value.
Definition: statistics.hh:607
gem5::statistics::ValueBase::prepare
void prepare()
Definition: statistics.hh:778
gem5::statistics::DataWrap::unit
Derived & unit(const units::Base *_unit)
Set the unit of the stat.
Definition: statistics.hh:318
gem5::statistics::ValueBase
Definition: statistics.hh:711
gem5::statistics::ConstVectorNode
Definition: statistics.hh:1647
gem5::statistics::DataWrapVec::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:380
gem5::ArmISA::d
Bitfield< 9 > d
Definition: misc_types.hh:63
gem5::statistics::VectorProxy
Definition: statistics.hh:1058
gem5::statistics::ValueBase::result
Result result() const
Definition: statistics.hh:771
gem5::statistics::UnaryNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1754
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:976
gem5::statistics::VectorDistBase::Storage
Stor Storage
Definition: statistics.hh:1368
gem5::statistics::FormulaInfoProxy
Definition: statistics.hh:2373
gem5::statistics::ValueBase::check
bool check() const
Definition: statistics.hh:777
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:423
gem5::statistics::VectorProxy::operator[]
ScalarProxy< Stat > operator[](off_type index)
Definition: statistics.hh:1124
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2070
gem5::statistics::ScalarProxy::operator=
const ScalarProxy & operator=(const ScalarProxy &sp)
Set this proxy equal to the provided one.
Definition: statistics.hh:839
gem5::statistics::SumNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1887
gem5::statistics::ConstVectorNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1666
gem5::statistics::DistProxy::reset
void reset()
Proxy has no state.
Definition: statistics.hh:1507
gem5::statistics::OpString
Definition: statistics.hh:1680
gem5::statistics::InfoAccess::zero
bool zero() const
Definition: statistics.hh:214
gem5::statistics::Temp::Temp
Temp(unsigned char value)
Create a ConstNode.
Definition: statistics.hh:2740
gem5::ArmISA::v
Bitfield< 28 > v
Definition: misc_types.hh:54
gem5::statistics::ScalarBase::Params
Stor::Params Params
Definition: statistics.hh:521
gem5::statistics::OpString< std::divides< Result > >::str
static std::string str()
Definition: statistics.hh:1703
gem5::statistics::Vector2dBase::zero
bool zero() const
Definition: statistics.hh:1209
gem5::ArmISA::s
Bitfield< 4 > s
Definition: misc_types.hh:561
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2501
gem5::statistics::reset
void reset()
Definition: statistics.cc:304
gem5::statistics::dump
void dump()
Dump all statistics data to the registered outputs.
Definition: statistics.cc:295
gem5::statistics::ValueProxy::result
Result result() const
Definition: statistics.hh:653
gem5::statistics::Value::Value
Value(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1987
gem5::statistics::display
const FlagsType display
Print this stat.
Definition: info.hh:58
gem5::statistics::DistInfo::data
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:205
gem5::statistics::ConstVectorNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1654
gem5::statistics::SparseHistBase::prepare
void prepare()
Definition: statistics.hh:2476
gem5::statistics::Temp::Temp
Temp(signed long value)
Create a ConstNode.
Definition: statistics.hh:2780
gem5::statistics::VectorStatNode
Definition: statistics.hh:1617
gem5::statistics::ValueProxy::scalar
T * scalar
Definition: statistics.hh:648
gem5::statistics::DistBase::DistBase
DistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1311
gem5::statistics::ScalarInfoProxy::total
Result total() const
Definition: statistics.hh:126
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2258
gem5::statistics::VectorBase::operator[]
Proxy operator[](off_type index)
Return a reference (ScalarProxy) to the stat at the given index.
Definition: statistics.hh:1050
gem5::statistics::VectorDistBase::size
size_type size() const
Definition: statistics.hh:1425
gem5::statistics::DistProxy::DistProxy
DistProxy(const DistProxy &sp)
Definition: statistics.hh:1472
gem5::statistics::ScalarBase::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:591
gem5::statistics::DataWrapVec2d::ysubname
std::string ysubname(off_type i) const
Definition: statistics.hh:499
gem5::statistics::InfoAccess::setInit
void setInit()
Save Storage class parameters if any.
Definition: statistics.cc:106
gem5::MipsISA::l
Bitfield< 5 > l
Definition: pra_constants.hh:323
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:1627
gem5::statistics::registerResetCallback
void registerResetCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are reset.
Definition: statistics.cc:272
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:775
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:820
cprintf.hh
gem5::statistics::processDumpQueue
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
Definition: statistics.cc:266
gem5::statistics::ScalarBase::data
const Storage * data() const
Retrieve a const pointer to the storage.
Definition: statistics.hh:546
gem5::statistics::ValueBase::proxy
ProxyInfo * proxy
Definition: statistics.hh:714
gem5::statistics::ConstVectorNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1657
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:302
compiler.hh
gem5::statistics::SumNode
Definition: statistics.hh:1861
gem5::statistics::ValueBase::functor
Derived & functor(const T &func)
Definition: statistics.hh:738
gem5::statistics::Temp::Temp
Temp(const AverageVector &s)
Definition: statistics.hh:2708
gem5::statistics::Vector2dBase
Definition: statistics.hh:1134
gem5::statistics::SparseHistBase::Storage
Stor Storage
Definition: statistics.hh:2412
gem5::statistics::DataWrapVec2d
Definition: statistics.hh:459
gem5::statistics::VectorProxy::operator=
const VectorProxy & operator=(const VectorProxy &sp)
Definition: statistics.hh:1115
gem5::statistics::VectorProxy::offset
off_type offset
Definition: statistics.hh:1062
gem5::X86ISA::delivery_mode::names
static const char *const names[NumModes]
Definition: intmessage.hh:70
gem5::statistics::InfoProxy::zero
bool zero() const
Definition: statistics.hh:115
gem5::statistics::ScalarInfoProxy::ScalarInfoProxy
ScalarInfoProxy(Stat &stat)
Definition: statistics.hh:122
gem5::statistics::ScalarProxy::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:857
gem5::statistics::VectorProxy::stat
Stat & stat
Definition: statistics.hh:1061
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible< std::function< Result()>, const T & >::value > >::FunctorProxy
FunctorProxy(const T &func)
Definition: statistics.hh:685
gem5::statistics::Vector2dBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:1194
gem5::statistics::ScalarBase::zero
bool zero() const
Definition: statistics.hh:625
gem5::statistics::ProxyInfo::prepare
void prepare()
Prepare the stat for dumping.
Definition: statistics.hh:637
gem5::statistics::VectorDistBase::operator[]
Proxy operator[](off_type index)
Definition: statistics.hh:1418
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:343
gem5::statistics::size_type
unsigned int size_type
Definition: types.hh:60
gem5::statistics::Formula::root
NodePtr root
The root of the tree which represents the Formula.
Definition: statistics.hh:2540
gem5::statistics::Temp::node
NodePtr node
Pointer to a Node object.
Definition: statistics.hh:2653
gem5::statistics::SparseHistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:2462
gem5::statistics::Output::visit
virtual void visit(const ScalarInfo &info)=0
gem5::statistics::FormulaInfoProxy::total
Result total() const
Definition: statistics.hh:2390
gem5::statistics::UnaryNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1729
gem5::debugDumpStats
void debugDumpStats()
Definition: statistics.cc:332
gem5::statistics::SparseHistInfoProxy::SparseHistInfoProxy
SparseHistInfoProxy(Stat &stat)
Definition: statistics.hh:2400
gem5::statistics::Scalar::Scalar
Scalar(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1938
gem5::statistics::VectorInfo::total
virtual Result total() const =0
gem5::statistics::BinaryNode::str
std::string str() const override
Definition: statistics.hh:1854
gem5::statistics::InfoAccess
Definition: statistics.hh:183
gem5::statistics::Temp::Temp
Temp(const Formula &f)
Definition: statistics.hh:2715
gem5::statistics::VectorBase::VectorBase
VectorBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1017
gem5::statistics::Average::Average
Average(Group *parent=nullptr)
Definition: statistics.hh:1960
gem5::statistics::FormulaInfoProxy::str
std::string str() const
Definition: statistics.hh:2393
gem5::statistics::DistProxy::operator=
const DistProxy & operator=(const DistProxy &sp)
Definition: statistics.hh:1477
gem5::statistics::SumNode::SumNode
SumNode(NodePtr &p)
Definition: statistics.hh:1868
gem5::statistics::DistBase::zero
bool zero() const
Return true if no samples have been added.
Definition: statistics.hh:1336
gem5::statistics::Histogram::init
Histogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2151
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::statistics::Distribution::Distribution
Distribution(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2096
gem5::statistics::VectorBase::~VectorBase
~VectorBase()
Definition: statistics.hh:1024
gem5::statistics::ScalarStatNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1568
gem5::statistics::Vector2dInfo::y
size_type y
Definition: info.hh:235
name
const std::string & name()
Definition: trace.cc:49
gem5::statistics::VectorBase::zero
bool zero() const
Definition: statistics.hh:1002
gem5::statistics::FormulaNode::FormulaNode
FormulaNode(const Formula &f)
Definition: statistics.hh:2635
gem5::statistics::FormulaNode
Definition: statistics.hh:2628
gem5::statistics::Temp::getNodePtr
NodePtr getNodePtr() const
Makde gcc < 4.6.3 happy and explicitly get the underlying node.
Definition: statistics.hh:2673
gem5::statistics::Handler
void(* Handler)()
Register reset and dump handlers.
Definition: statistics.hh:2892
gem5::statistics::ValueBase::functor
Derived & functor(T &func)
Definition: statistics.hh:747
gem5::statistics::ConstNode::ConstNode
ConstNode(T s)
Definition: statistics.hh:1639
gem5::statistics::Value::Value
Value(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1992
gem5::statistics::ScalarProxyNode::size
size_type size() const
Return the number of nodes in the subtree starting at this node.
Definition: statistics.hh:1602
gem5::statistics::MethodProxy::MethodPointer
V(T::* MethodPointer)() const
Definition: statistics.hh:700
gem5::statistics::VectorProxy::data
const Stat::Storage * data(off_type index) const
Definition: statistics.hh:1076
gem5::statistics::DataWrap::DataWrap
DataWrap(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:252
gem5::statistics::Vector2dBase::~Vector2dBase
~Vector2dBase()
Definition: statistics.hh:1163
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:382
gem5::statistics::enabled
bool enabled()
Definition: statistics.cc:280
gem5::statistics::VectorDistBase::zero
bool zero() const
Definition: statistics.hh:1431
gem5::statistics::statsList
std::list< Info * > & statsList()
Definition: statistics.cc:62
gem5::statistics::VectorDistBase
Definition: statistics.hh:1364
gem5::statistics::ScalarBase::doInit
void doInit()
Definition: statistics.hh:552
gem5::statistics::Scalar::Scalar
Scalar(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:1944
gem5::statistics::VectorDistBase::data
const Storage * data(off_type index) const
Definition: statistics.hh:1385
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2298
gem5::statistics::ScalarStatNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1566
gem5::statistics::Vector2dInfoProxy::Vector2dInfoProxy
Vector2dInfoProxy(Stat &stat)
Definition: statistics.hh:178
gem5::statistics::FunctorProxy< T, typename std::enable_if_t< std::is_constructible< std::function< Result()>, const T & >::value > >::value
Counter value() const
Definition: statistics.hh:686
gem5::statistics::Info::setName
void setName(const std::string &name, bool old_style=true)
Set the name of this statistic.
Definition: info.cc:128
gem5::statistics::BinaryNode::total
Result total() const override
Return the total of the result vector.
Definition: statistics.hh:1807
gem5::statistics::ScalarBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:534
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2038
gem5::statistics::Vector::Vector
Vector(Group *parent=nullptr)
Definition: statistics.hh:2006
gem5::statistics::Formula::str
std::string str() const
Definition: statistics.cc:241
gem5::statistics::BinaryNode::BinaryNode
BinaryNode(NodePtr &a, NodePtr &b)
Definition: statistics.hh:1772
gem5::statistics::ConstNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1641
gem5::statistics::SumNode::vresult
VResult vresult
Definition: statistics.hh:1865
gem5::statistics::ValueBase::ValueBase
ValueBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:717
gem5::statistics::DistInfoProxy::DistInfoProxy
DistInfoProxy(Stat &stat)
Definition: statistics.hh:162
gem5::statistics::DataWrap::Info
InfoProxyType< Derived > Info
Definition: statistics.hh:228
gem5::statistics::InfoAccess::check
bool check() const
Check that this stat has been set up properly and is ready for use.
Definition: statistics.hh:221
units.hh
gem5::statistics::SumNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1871
gem5::statistics::VectorInfoProxy::total
Result total() const
Definition: statistics.hh:155
gem5::statistics::ScalarInfoProxy
Definition: statistics.hh:119
gem5::statistics::DataWrapVec::reset
void reset()
Definition: statistics.hh:447
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:331
gem5::statistics::ConstNode::result
const VResult & result() const
Return the result vector of this subtree.
Definition: statistics.hh:1640
gem5::statistics::SparseHistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:2486
gem5::statistics::MethodProxy::result
Result result() const
Definition: statistics.hh:706
gem5::statistics::SparseHistBase::SparseHistBase
SparseHistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:2448
gem5::statistics::ScalarInfoProxy::value
Counter value() const
Definition: statistics.hh:124
gem5::statistics::Temp::Temp
Temp(signed int value)
Create a ConstNode.
Definition: statistics.hh:2764
gem5::statistics::VectorProxy::data
Stat::Storage * data(off_type index)
Definition: statistics.hh:1069
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:369
gem5::statistics::UnaryNode::l
NodePtr l
Definition: statistics.hh:1722
gem5::statistics::StorageParams
Definition: storage.hh:49
gem5::statistics::VectorDistInfo
Definition: info.hh:208
std
Overload hash function for BasicBlockRange type.
Definition: types.hh:111
gem5::statistics::VectorInfo::size
virtual size_type size() const =0
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:455
types.hh
gem5::statistics::VectorProxy::VectorProxy
VectorProxy(const VectorProxy &sp)
Definition: statistics.hh:1109
gem5::statistics::VectorDistInfoProxy::size
size_type size() const
Definition: statistics.hh:171
gem5::statistics::processResetQueue
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
Definition: statistics.cc:260
gem5::statistics::VectorInfoProxy
Definition: statistics.hh:130
gem5::statistics::constantVector
Temp constantVector(T val)
Definition: statistics.hh:2869
gem5::statistics::DistBase::prepare
void prepare()
Definition: statistics.hh:1339
gem5::statistics::VectorDistBase::Params
Stor::Params Params
Definition: statistics.hh:1369
gem5::statistics::Formula::operator=
const Formula & operator=(const Temp &r)
Set an unitialized Formula to the given root.
Definition: statistics.cc:168
gem5::statistics::FormulaInfoProxy::value
VCounter & value() const
Definition: statistics.hh:2391
gem5::statistics::VectorDistBase::VectorDistBase
VectorDistBase(Group *parent, const char *name, const units::Base *unit, const char *desc)
Definition: statistics.hh:1404
gem5::statistics::ScalarProxy
A proxy class to access the stat at a given index in a VectorBase stat.
Definition: statistics.hh:793
gem5::statistics::MapType
std::map< const void *, Info * > MapType
Definition: statistics.hh:2920
gem5::PowerISA::vec
Bitfield< 25 > vec
Definition: misc.hh:108
gem5::statistics::Vector2dInfo::x
size_type x
Definition: info.hh:234
gem5::statistics::SparseHistInfo::data
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:255
gem5::statistics::VectorDistBase::data
Storage * data(off_type index)
Definition: statistics.hh:1379
gem5::statistics::Value
Definition: statistics.hh:1979
gem5::statistics::SparseHistStor::Params
The parameters for a sparse histogram stat.
Definition: storage.hh:724
gem5::statistics::Node::size
virtual size_type size() const =0
Return the number of nodes in the subtree starting at this node.
gem5::statistics::VectorBase::Params
Stor::Params Params
Definition: statistics.hh:923
gem5::statistics::DataWrap::info
const Info * info() const
Definition: statistics.hh:242
gem5::statistics::DistProxy::sample
void sample(const U &v, int n=1)
Definition: statistics.hh:1487
gem5::statistics::NodePtr
std::shared_ptr< Node > NodePtr
Shared pointer to a function Node.
Definition: statistics.hh:1548
gem5::statistics::VectorAverageDeviation::init
VectorAverageDeviation & init(size_type size)
Initialize storage for this distribution.
Definition: statistics.hh:2363
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
gem5::statistics::SparseHistogram
Definition: statistics.hh:2492
output.hh
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2044
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:559
gem5::statistics::InfoProxy::visit
void visit(Output &visitor)
Definition: statistics.hh:111
gem5::statistics::ValueBase::reset
void reset()
Definition: statistics.hh:779
logging.hh
gem5::statistics::ScalarInfoProxy::result
Result result() const
Definition: statistics.hh:125
gem5::statistics::OpString< std::multiplies< Result > >::str
static std::string str()
Definition: statistics.hh:1697
gem5::statistics::VectorBase::size
size_type size() const
Definition: statistics.hh:999
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::statistics::Group::addStat
void addStat(statistics::Info *info)
Register a stat with this group.
Definition: group.cc:109
gem5::statistics::FunctorProxy
Definition: statistics.hh:658
gem5::statistics::ValueBase::scalar
Derived & scalar(T &value)
Definition: statistics.hh:729
gem5::statistics::DataWrap::name
const std::string & name() const
Definition: statistics.hh:293
gem5::statistics::DataWrapVec2d::ysubnames
Derived & ysubnames(const char **names)
Definition: statistics.hh:475
gem5::statistics::DataWrapVec::prepare
void prepare()
Definition: statistics.hh:436
gem5::statistics::Formula::prepare
void prepare()
Definition: statistics.hh:2613
gem5::statistics::HistStor
Templatized storage and interface for a histogram stat.
Definition: storage.hh:399
gem5::statistics::AverageVector::AverageVector
AverageVector(Group *parent=nullptr)
Definition: statistics.hh:2032
gem5::statistics::SparseHistogram::SparseHistogram
SparseHistogram(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2508
gem5::statistics::InfoProxy::reset
void reset()
Definition: statistics.hh:109
gem5::statistics::ConstVectorNode::str
std::string str() const
Definition: statistics.hh:1668
gem5::statistics::FunctorProxy::result
Result result() const
Definition: statistics.hh:666
gem5::statistics::FormulaInfoProxy::FormulaInfoProxy
FormulaInfoProxy(Stat &stat)
Definition: statistics.hh:2380
gem5::MipsISA::r
r
Definition: pra_constants.hh:98
gem5::statistics::AverageDeviation::AverageDeviation
AverageDeviation(Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
Definition: statistics.hh:2228
gem5::statistics::DataWrap::setSeparator
const std::string & setSeparator() const
Definition: statistics.hh:307
gem5::statistics::ScalarBase::operator--
void operator--()
Decrement the stat by 1.
Definition: statistics.hh:578
gem5::statistics::BinaryNode
Definition: statistics.hh:1764
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent=nullptr)
Definition: statistics.hh:2058
gem5::statistics::ValueBase::value
Counter value()
Definition: statistics.hh:770
gem5::statistics::MethodProxy::object
T * object
Definition: statistics.hh:699
gem5::statistics::MethodProxy::method
MethodPointer method
Definition: statistics.hh:701
gem5::statistics::StatStor
Templatized storage and interface for a simple scalar stat.
Definition: storage.hh:57
gem5::statistics::FormulaInfoProxy::result
const VResult & result() const
Definition: statistics.hh:2385
gem5::statistics::ScalarBase::prepare
void prepare()
Definition: statistics.hh:628
gem5::statistics::ScalarStatNode::str
std::string str() const
Definition: statistics.hh:1573
gem5::statistics::DistBase::reset
void reset()
Reset stat value to default.
Definition: statistics.hh:1349
gem5::statistics::ScalarProxy::str
std::string str() const
Definition: statistics.hh:908
gem5::statistics::DistProxy::DistProxy
DistProxy(Stat &s, off_type i)
Definition: statistics.hh:1468
gem5::statistics::SumNode::l
NodePtr l
Definition: statistics.hh:1864
gem5::statistics::ScalarProxy::operator=
void operator=(const U &v)
Set the data value to the given value.
Definition: statistics.hh:871
gem5::statistics::VectorDistribution
A vector of distributions.
Definition: statistics.hh:2242
gem5::statistics::VectorBase::check
bool check() const
Definition: statistics.hh:1011
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:355
gem5::statistics::Average::Average
Average(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:1966
gem5::statistics::VectorProxy::len
size_type len
Definition: statistics.hh:1063
gem5::statistics::Vector::Vector
Vector(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2012
gem5::statistics::Vector2dBase::Storage
Stor Storage
Definition: statistics.hh:1138
gem5::statistics::InfoAccess::setInfo
void setInfo(Group *parent, Info *info)
Set up an info class for this statistic.
Definition: statistics.cc:76
gem5::statistics::Vector2d::Vector2d
Vector2d(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2064
gem5::statistics::VectorInfoProxy::value
VCounter & value() const
Definition: statistics.hh:142
gem5::statistics::FormulaInfoProxy::cvec
VCounter cvec
Definition: statistics.hh:2377
std::list
STL list class.
Definition: stl.hh:51
gem5::ArmISA::sp
Bitfield< 0 > sp
Definition: misc_types.hh:74
gem5::statistics::Formula::operator+=
const Formula & operator+=(Temp r)
Add the given tree to the existing one.
Definition: statistics.cc:178
gem5::statistics::Vector2dBase::storage
std::vector< Storage * > storage
Definition: statistics.hh:1149
intmath.hh
gem5::statistics::DistProxy::stat
Stat & stat
Definition: statistics.hh:1460
gem5::statistics::Temp::Temp
Temp(NodePtr &&n)
Definition: statistics.hh:2662
gem5::statistics::SparseHistBase::data
Storage * data()
Retrieve the storage.
Definition: statistics.hh:2425
gem5::statistics::ScalarProxyNode::str
std::string str() const
Definition: statistics.hh:1611
gem5::statistics::VectorProxy::vec
VResult vec
Definition: statistics.hh:1066
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent=nullptr)
Definition: statistics.hh:2245
gem5::statistics::Temp::Temp
Temp(signed short value)
Create a ConstNode.
Definition: statistics.hh:2748
gem5::statistics::ScalarBase::operator++
void operator++()
Increment the stat by 1.
Definition: statistics.hh:573
gem5::statistics::ValueBase::~ValueBase
~ValueBase()
Definition: statistics.hh:725
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:225
gem5::statistics::ValueProxy::total
Result total() const
Definition: statistics.hh:654
gem5::statistics::DistBase::Info
DistInfoProxy< Derived > Info
Definition: statistics.hh:1274
gem5::statistics::ProxyInfo
Definition: statistics.hh:631
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::statistics::DistStor::Params
The parameters for a distribution stat.
Definition: storage.hh:262
gem5::statistics::Formula::total
Result total() const
Return the total Formula result.
Definition: statistics.cc:210
gem5::statistics::VectorInfoProxy::size
size_type size() const
Definition: statistics.hh:139
gem5::statistics::DataWrapVec
Definition: statistics.hh:377
gem5::statistics::ScalarProxy::operator+=
void operator+=(const U &v)
Increment the stat by the given value.
Definition: statistics.hh:883
gem5::statistics::SparseHistBase
Implementation of a sparse histogram stat.
Definition: statistics.hh:2408
gem5::statistics::VectorBase::init
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1037
gem5::statistics::InfoAccess::setParams
void setParams(const StorageParams *params)
Save Storage class parameters if any.
Definition: statistics.cc:100
gem5::statistics::operator*
Temp operator*(Temp l, Temp r)
Definition: statistics.hh:2843
gem5::statistics::VectorProxy::total
Result total() const
Definition: statistics.hh:1095
gem5::statistics::ScalarBase::size
size_type size() const
Return the number of elements, always 1 for a scalar.
Definition: statistics.hh:613
gem5::statistics::VectorAverageDeviation::VectorAverageDeviation
VectorAverageDeviation(Group *parent=nullptr)
Definition: statistics.hh:2336
gem5::statistics::VectorInfoProxy::VectorInfoProxy
VectorInfoProxy(Stat &stat)
Definition: statistics.hh:137
gem5::statistics::ScalarProxyNode::total
Result total() const
Return the total of the result vector.
Definition: statistics.hh:1596
gem5::statistics::MethodProxy::MethodProxy
MethodProxy(T *obj, MethodPointer meth)
Definition: statistics.hh:704
gem5::statistics::AverageDeviation
Calculates the per tick mean and variance of the samples.
Definition: statistics.hh:2203
gem5::statistics::Info::getStorageParams
StorageParams const * getStorageParams() const
Getter for the storage params.
Definition: info.cc:85
gem5::statistics::VectorStandardDeviation::VectorStandardDeviation
VectorStandardDeviation(Group *parent=nullptr)
Definition: statistics.hh:2292
gem5::statistics::FormulaNode::vec
VResult vec
Definition: statistics.hh:2632
gem5::statistics::ScalarProxy::result
Result result() const
Return the current value of this statas a result type.
Definition: statistics.hh:813
gem5::statistics::ProxyInfo::visit
void visit(Output &visitor)
Visitor entry for outputing statistics data.
Definition: statistics.hh:641
gem5::X86ISA::op
Bitfield< 4 > op
Definition: types.hh:83
gem5::statistics::VectorProxy::size
size_type size() const
Definition: statistics.hh:1130
gem5::statistics::Formula::size
size_type size() const
Return the number of elements in the tree.
Definition: statistics.cc:216
gem5::statistics::ScalarProxyNode
Definition: statistics.hh:1577
gem5::statistics::Vector2dBase::Info
Vector2dInfoProxy< Derived > Info
Definition: statistics.hh:1137
gem5::statistics::VectorDistBase::check
bool check() const
Definition: statistics.hh:1450
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:139
gem5::statistics::VectorDistribution::VectorDistribution
VectorDistribution(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2251
gem5::statistics::InfoProxy::InfoProxy
InfoProxy(Stat &stat)
Definition: statistics.hh:105
gem5::statistics::VectorBase::Storage
Stor Storage
Definition: statistics.hh:922
gem5::statistics::Formula::operator=
const Formula & operator=(const T &v)
Definition: statistics.hh:2567
gem5::ArmISA::rs
Bitfield< 9, 8 > rs
Definition: misc_types.hh:376
gem5::statistics::Histogram::Histogram
Histogram(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2132
gem5::statistics::DistProxy::zero
bool zero() const
Definition: statistics.hh:1499
gem5::statistics::ScalarStatNode::ScalarStatNode
ScalarStatNode(const ScalarInfo *d)
Definition: statistics.hh:1557
gem5::statistics::Distribution::Distribution
Distribution(Group *parent, const char *name, const char *desc=nullptr)
Definition: statistics.hh:2090
gem5::statistics::Info::name
std::string name
The name of the stat.
Definition: info.hh:84
gem5::statistics::UnaryNode::vresult
VResult vresult
Definition: statistics.hh:1723
gem5::statistics::FormulaInfo
Definition: info.hh:245
gem5::statistics::VectorBase::data
Storage * data(off_type index)
Retrieve the storage.
Definition: statistics.hh:940
gem5::statistics::Vector2dInfo
Definition: info.hh:226
gem5::statistics::Temp::Temp
Temp(signed char value)
Create a ConstNode.
Definition: statistics.hh:2732
gem5::statistics::Formula::zero
bool zero() const
Definition: statistics.cc:230
gem5::statistics::Vector2dBase::x
size_type x
Definition: statistics.hh:1147
gem5::statistics::InfoProxy::check
bool check() const
Definition: statistics.hh:107
gem5::statistics::StandardDeviation::StandardDeviation
StandardDeviation(Group *parent=nullptr)
Construct and initialize this distribution.
Definition: statistics.hh:2170
gem5::statistics::ScalarProxy::index
off_type index
The index to access in the parent VectorBase.
Definition: statistics.hh:800
gem5::statistics::Info
Definition: info.hh:80
gem5::statistics::MethodProxy::total
Result total() const
Definition: statistics.hh:707
gem5::statistics::ConstNode::vresult
VResult vresult
Definition: statistics.hh:1636
gem5::statistics::ProxyInfo::reset
void reset()
Reset the stat to the default state.
Definition: statistics.hh:638
gem5::statistics::operator-
Temp operator-(Temp l, Temp r)
Definition: statistics.hh:2837
gem5::statistics::AvgStor
Templatized storage and interface to a per-tick average stat.
Definition: storage.hh:127
gem5::statistics::ScalarBase::value
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:619
gem5::statistics::VectorBase::storage
std::vector< Storage * > storage
The storage of this stat.
Definition: statistics.hh:932
gem5::statistics::VectorInfoProxy::result
const VResult & result() const
Definition: statistics.hh:149

Generated on Tue Sep 21 2021 12:24:58 for gem5 by doxygen 1.8.17