gem5  v20.1.0.0
info.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __BASE_STATS_INFO_HH__
30 #define __BASE_STATS_INFO_HH__
31 
32 #include "base/stats/types.hh"
33 #include "base/flags.hh"
34 
35 namespace Stats {
36 
37 class Group;
38 
39 typedef uint16_t FlagsType;
40 typedef ::Flags<FlagsType> Flags;
41 
43 const FlagsType none = 0x0000;
45 const FlagsType init = 0x0001;
47 const FlagsType display = 0x0002;
49 const FlagsType total = 0x0010;
51 const FlagsType pdf = 0x0020;
53 const FlagsType cdf = 0x0040;
55 const FlagsType dist = 0x0080;
57 const FlagsType nozero = 0x0100;
59 const FlagsType nonan = 0x0200;
61 const FlagsType oneline = 0x0400;
62 
65 
66 struct StorageParams;
67 struct Output;
68 
69 class Info
70 {
71  public:
73  std::string name;
75  static std::string separatorString;
77  std::string desc;
81  int precision;
83  const Info *prereq;
88  static int id_count;
89  int id;
90 
91  public:
93 
94  public:
95  Info();
96  virtual ~Info();
97 
99  void setName(const std::string &name);
100  void setName(const Group *parent, const std::string &name);
101  void setSeparator(std::string _sep) { separatorString = _sep;}
102 
108  virtual bool check() const = 0;
109  bool baseCheck() const;
110 
114  virtual void enable();
115 
119  virtual void prepare() = 0;
120 
124  virtual void reset() = 0;
125 
130  virtual bool zero() const = 0;
131 
135  virtual void visit(Output &visitor) = 0;
136 
145  static bool less(Info *stat1, Info *stat2);
146 };
147 
148 class ScalarInfo : public Info
149 {
150  public:
151  virtual Counter value() const = 0;
152  virtual Result result() const = 0;
153  virtual Result total() const = 0;
154 };
155 
156 class VectorInfo : public Info
157 {
158  public:
162 
163  public:
164  void enable();
165 
166  public:
167  virtual size_type size() const = 0;
168  virtual const VCounter &value() const = 0;
169  virtual const VResult &result() const = 0;
170  virtual Result total() const = 0;
171 };
172 
174 
175 struct DistData
176 {
181 
191 };
192 
193 class DistInfo : public Info
194 {
195  public:
198 };
199 
200 class VectorDistInfo : public Info
201 {
202  public:
204 
208  void enable();
209 
210  protected:
212  mutable VResult rvec;
213 
214  public:
215  virtual size_type size() const = 0;
216 };
217 
218 class Vector2dInfo : public Info
219 {
220  public:
225 
228 
230  mutable VCounter cvec;
231 
232  void enable();
233 
234  virtual Result total() const = 0;
235 };
236 
237 class FormulaInfo : public VectorInfo
238 {
239  public:
240  virtual std::string str() const = 0;
241 };
242 
245 {
248 };
249 
250 
251 class SparseHistInfo : public Info
252 {
253  public:
256 };
257 
258 } // namespace Stats
259 
260 #endif // __BASE_STATS_INFO_HH__
Stats::VectorDistInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:206
Stats::Vector2dInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:223
Stats::Info::~Info
virtual ~Info()
Definition: statistics.cc:167
Stats::VectorDistInfo::rvec
VResult rvec
Local storage for the entry values, used for printing.
Definition: info.hh:212
Stats::Flags
::Flags< FlagsType > Flags
Definition: info.hh:40
Stats::init
const FlagsType init
This Stat is Initialized.
Definition: info.hh:45
Stats::Info::zero
virtual bool zero() const =0
Stats::VectorInfo::value
virtual const VCounter & value() const =0
types.hh
Stats::Info::visit
virtual void visit(Output &visitor)=0
Visitor entry for outputing statistics data.
Stats::Deviation
@ Deviation
Definition: info.hh:173
Stats::Info::baseCheck
bool baseCheck() const
Definition: statistics.cc:256
Stats::FormulaInfo::str
virtual std::string str() const =0
Stats::VectorInfo
Definition: info.hh:156
Stats::SparseHistData
Data structure of sparse histogram.
Definition: info.hh:244
Stats::DistData::sum
Counter sum
Definition: info.hh:187
Stats::DistData::type
DistType type
Definition: info.hh:177
Flags< FlagsType >
Stats::DistData::samples
Counter samples
Definition: info.hh:190
Stats::Vector2dInfo
Definition: info.hh:218
Stats::Info::Info
Info()
Definition: statistics.cc:159
Stats::VectorDistInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:207
Stats::DistType
DistType
Definition: info.hh:173
Stats::Vector2dInfo::cvec
VCounter cvec
Local storage for the entry values, used for printing.
Definition: info.hh:230
Stats::Vector2dInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:222
Stats::Hist
@ Hist
Definition: info.hh:173
Stats::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:224
std::vector< std::string >
Stats::MCounter
std::map< Counter, int > MCounter
map of counters
Definition: types.hh:45
Stats::DistData::underflow
Counter underflow
Definition: info.hh:184
Stats::display
const FlagsType display
Print this stat.
Definition: info.hh:47
Stats::Info::setSeparator
void setSeparator(std::string _sep)
Definition: info.hh:101
Stats::cdf
const FlagsType cdf
Print the cumulative percentage of total upto this entry.
Definition: info.hh:53
Stats::ScalarInfo::result
virtual Result result() const =0
Stats::Dist
@ Dist
Definition: info.hh:173
Stats::none
const FlagsType none
Nothing extra to print.
Definition: info.hh:43
Stats::Info::id_count
static int id_count
A unique stat ID for each stat in the simulator.
Definition: info.hh:88
Stats::StorageParams
Definition: statistics.hh:176
Stats::Info::storageParams
const StorageParams * storageParams
Definition: info.hh:92
Stats::ScalarInfo::total
virtual Result total() const =0
Stats::DistData::logs
Counter logs
Definition: info.hh:189
Stats::VectorDistInfo
Definition: info.hh:200
Stats::Info::check
virtual bool check() const =0
Check that this stat has been set up properly and is ready for use.
Stats::VectorDistInfo::size
virtual size_type size() const =0
Stats::DistData::min_val
Counter min_val
Definition: info.hh:182
Stats::Info::id
int id
Definition: info.hh:89
Stats::Info::enable
virtual void enable()
Enable the stat for use.
Definition: statistics.cc:278
Stats::DistData::min
Counter min
Definition: info.hh:178
Stats::DistData::bucket_size
Counter bucket_size
Definition: info.hh:180
Stats::DistData
Definition: info.hh:175
Stats::DistInfo
Definition: info.hh:193
Stats::ScalarInfo::value
virtual Counter value() const =0
Stats::VectorDistInfo::enable
void enable()
Enable the stat for use.
Definition: statistics.cc:293
Stats::oneline
const FlagsType oneline
Print all values on a single line.
Definition: info.hh:61
Stats::Info::separatorString
static std::string separatorString
The separator string used for vectors, dist, etc.
Definition: info.hh:75
Stats::__reserved
const FlagsType __reserved
Mask of flags that can't be set directly.
Definition: info.hh:64
Stats::VectorInfo::total
virtual Result total() const =0
Stats::SparseHistData::cmap
MCounter cmap
Definition: info.hh:246
Stats::FlagsType
uint16_t FlagsType
Definition: info.hh:37
Stats::Vector2dInfo::total
virtual Result total() const =0
Stats::VectorInfo::result
virtual const VResult & result() const =0
Stats::DistData::squares
Counter squares
Definition: info.hh:188
Stats::VectorInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:161
Stats::Info::prepare
virtual void prepare()=0
Prepare the stat for dumping.
Stats::Vector2dInfo::x
size_type x
Definition: info.hh:226
Stats::SparseHistInfo
Definition: info.hh:251
Stats::Output
Definition: output.hh:58
Stats::Info::reset
virtual void reset()=0
Reset the stat to the default state.
Stats::VectorInfo::size
virtual size_type size() const =0
Stats::VectorDistInfo::data
std::vector< DistData > data
Definition: info.hh:203
Stats::dist
const FlagsType dist
Print the distribution.
Definition: info.hh:55
flags.hh
Stats::nozero
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:57
Stats::Info
Definition: info.hh:69
Stats::Result
double Result
All results are doubles.
Definition: types.hh:50
Stats::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:41
Stats::VectorInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:160
Stats::FormulaInfo
Definition: info.hh:237
Stats::Info::setName
void setName(const std::string &name)
Set the name of this statistic.
Stats::Vector2dInfo::y
size_type y
Definition: info.hh:227
Stats::pdf
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:51
Stats::Info::flags
Flags flags
The formatting flags.
Definition: info.hh:79
Stats::Group
Statistics container.
Definition: group.hh:83
Stats::Info::name
std::string name
The name of the stat.
Definition: info.hh:73
Stats::DistData::max
Counter max
Definition: info.hh:179
Stats::DistInfo::data
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:197
Stats::SparseHistData::samples
Counter samples
Definition: info.hh:247
Stats::Info::prereq
const Info * prereq
A pointer to a prerequisite Stat.
Definition: info.hh:83
Stats::ScalarInfo
Definition: info.hh:148
Stats::SparseHistInfo::data
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:255
Stats::Info::precision
int precision
The display precision.
Definition: info.hh:81
Stats::Info::desc
std::string desc
The description of the stat.
Definition: info.hh:77
Stats::DistData::overflow
Counter overflow
Definition: info.hh:185
Stats::Info::less
static bool less(Info *stat1, Info *stat2)
Checks if the first stat's name is alphabetically less than the second.
Definition: statistics.cc:230
Stats
Definition: statistics.cc:61
Stats::Vector2dInfo::enable
void enable()
Enable the stat for use.
Definition: statistics.cc:303
Stats::size_type
unsigned int size_type
Definition: types.hh:54
Stats::total
const FlagsType total
Print the total.
Definition: info.hh:49
Stats::VectorInfo::enable
void enable()
Enable the stat for use.
Definition: statistics.cc:283
Stats::DistData::max_val
Counter max_val
Definition: info.hh:183
Stats::nonan
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:59
Stats::DistData::cvec
VCounter cvec
Definition: info.hh:186

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