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

Generated on Tue Jun 18 2024 16:24:01 for gem5 by doxygen 1.11.0