gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 <cstdint>
33 #include <map>
34 #include <memory>
35 #include <string>
36 #include <vector>
37 
38 #include "base/compiler.hh"
39 #include "base/flags.hh"
40 #include "base/stats/types.hh"
41 #include "base/stats/units.hh"
42 
43 namespace gem5
44 {
45 
46 namespace statistics
47 {
48 
49 typedef uint16_t FlagsType;
51 
53 const FlagsType none = 0x0000;
55 const FlagsType init = 0x0001;
57 const FlagsType display = 0x0002;
59 const FlagsType total = 0x0010;
61 const FlagsType pdf = 0x0020;
63 const FlagsType cdf = 0x0040;
65 const FlagsType dist = 0x0080;
67 const FlagsType nozero = 0x0100;
69 const FlagsType nonan = 0x0200;
71 const FlagsType oneline = 0x0400;
72 
75 
76 struct StorageParams;
77 struct Output;
78 
79 class Info
80 {
81  public:
83  std::string name;
85  static std::string separatorString;
89  std::string desc;
93  int precision;
95  const Info *prereq;
100  static int id_count;
101  int id;
102 
103  private:
104  std::unique_ptr<const StorageParams> storageParams;
105 
106  public:
107  Info();
108  virtual ~Info();
109 
117  void setName(const std::string &name, bool old_style=true);
118 
119  void setSeparator(std::string _sep) { separatorString = _sep;}
120 
126  StorageParams const* getStorageParams() const;
128  void setStorageParams(const StorageParams *const params);
129 
135  virtual bool check() const = 0;
136  bool baseCheck() const;
137 
141  virtual void enable();
142 
146  virtual void prepare() = 0;
147 
151  virtual void reset() = 0;
152 
157  virtual bool zero() const = 0;
158 
162  virtual void visit(Output &visitor) = 0;
163 
172  static bool less(Info *stat1, Info *stat2);
173 };
174 
175 class ScalarInfo : public Info
176 {
177  public:
178  virtual Counter value() const = 0;
179  virtual Result result() const = 0;
180  virtual Result total() const = 0;
181 };
182 
183 class VectorInfo : public Info
184 {
185  public:
189 
190  public:
191  void enable();
192 
193  public:
194  virtual size_type size() const = 0;
195  virtual const VCounter &value() const = 0;
196  virtual const VResult &result() const = 0;
197  virtual Result total() const = 0;
198 };
199 
200 class DistInfo : public Info
201 {
202  public:
205 };
206 
207 class VectorDistInfo : public Info
208 {
209  public:
211 
215  void enable();
216 
217  protected:
219  mutable VResult rvec;
220 
221  public:
222  virtual size_type size() const = 0;
223 };
224 
225 class Vector2dInfo : public Info
226 {
227  public:
232 
235 
237  mutable VCounter cvec;
238 
239  void enable();
240 
241  virtual Result total() const = 0;
242 };
243 
244 class FormulaInfo : public VectorInfo
245 {
246  public:
247  virtual std::string str() const = 0;
248 };
249 
250 class SparseHistInfo : public Info
251 {
252  public:
255 };
256 
257 typedef std::map<std::string, Info *> NameMapType;
259 
260 } // namespace statistics
261 } // namespace gem5
262 
263 #endif // __BASE_STATS_INFO_HH__
gem5::statistics::Info::check
virtual bool check() const =0
Check that this stat has been set up properly and is ready for use.
gem5::statistics::VectorInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:188
gem5::statistics::Info::enable
virtual void enable()
Enable the stat for use.
Definition: info.cc:192
gem5::statistics::Info::setSeparator
void setSeparator(std::string _sep)
Definition: info.hh:119
types.hh
gem5::statistics::Info::precision
int precision
The display precision.
Definition: info.hh:93
gem5::statistics::DistInfo
Definition: info.hh:200
gem5::statistics::Info::prereq
const Info * prereq
A pointer to a prerequisite Stat.
Definition: info.hh:95
gem5::statistics::units::Base
The Base class is the parent class of all unit classes.
Definition: units.hh:120
gem5::statistics::VectorDistInfo::data
std::vector< DistData > data
Definition: info.hh:210
gem5::statistics::FlagsType
uint16_t FlagsType
Definition: info.hh:49
gem5::statistics::Result
double Result
All results are doubles.
Definition: types.hh:55
gem5::statistics::Info::visit
virtual void visit(Output &visitor)=0
Visitor entry for outputing statistics data.
gem5::statistics::VectorDistInfo::size
virtual size_type size() const =0
gem5::statistics::VectorDistInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:213
gem5::statistics::Info::zero
virtual bool zero() const =0
gem5::statistics::VectorInfo
Definition: info.hh:183
gem5::statistics::Vector2dInfo::enable
void enable()
Enable the stat for use.
Definition: info.cc:217
gem5::statistics::VectorInfo::result
virtual const VResult & result() const =0
gem5::statistics::Flags
gem5::Flags< FlagsType > Flags
Definition: info.hh:50
gem5::statistics::nozero
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:67
gem5::statistics::SparseHistData
Data structure of sparse histogram.
Definition: types.hh:84
gem5::statistics::VectorInfo::enable
void enable()
Enable the stat for use.
Definition: info.cc:197
gem5::statistics::VectorInfo::value
virtual const VCounter & value() const =0
gem5::statistics::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:231
gem5::statistics::Info::storageParams
std::unique_ptr< const StorageParams > storageParams
Definition: info.hh:104
gem5::statistics::ScalarInfo
Definition: info.hh:175
std::vector< std::string >
gem5::statistics::nonan
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:69
gem5::statistics::units::Unspecified::get
static Unspecified * get()
Definition: units.hh:327
gem5::statistics::Vector2dInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:230
gem5::statistics::none
const FlagsType none
Nothing extra to print.
Definition: info.hh:53
gem5::statistics::Info::flags
Flags flags
The formatting flags.
Definition: info.hh:91
gem5::statistics::dist
const FlagsType dist
Print the distribution.
Definition: info.hh:65
gem5::statistics::Info::reset
virtual void reset()=0
Reset the stat to the default state.
gem5::statistics::ScalarInfo::result
virtual Result result() const =0
gem5::statistics::pdf
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:61
gem5::statistics::Info::id
int id
Definition: info.hh:101
gem5::statistics::Info::baseCheck
bool baseCheck() const
Definition: info.cc:172
gem5::Flags< FlagsType >
gem5::statistics::ScalarInfo::total
virtual Result total() const =0
gem5::statistics::Vector2dInfo::cvec
VCounter cvec
Local storage for the entry values, used for printing.
Definition: info.hh:237
gem5::statistics::Output
Definition: output.hh:64
gem5::statistics::Info::id_count
static int id_count
A unique stat ID for each stat in the simulator.
Definition: info.hh:100
gem5::statistics::Info::prepare
virtual void prepare()=0
Prepare the stat for dumping.
gem5::statistics::SparseHistInfo
Definition: info.hh:250
gem5::statistics::FormulaInfo::str
virtual std::string str() const =0
gem5::statistics::Info::unit
const units::Base * unit
The unit of the stat.
Definition: info.hh:87
gem5::statistics::display
const FlagsType display
Print this stat.
Definition: info.hh:57
gem5::statistics::DistInfo::data
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:204
gem5::statistics::cdf
const FlagsType cdf
Print the cumulative percentage of total upto this entry.
Definition: info.hh:63
compiler.hh
gem5::statistics::Vector2dInfo::total
virtual Result total() const =0
gem5::statistics::size_type
unsigned int size_type
Definition: types.hh:59
gem5::statistics::VectorInfo::total
virtual Result total() const =0
gem5::statistics::VectorDistInfo::rvec
VResult rvec
Local storage for the entry values, used for printing.
Definition: info.hh:219
gem5::statistics::Vector2dInfo::y
size_type y
Definition: info.hh:234
flags.hh
gem5::statistics::NameMapType
std::map< std::string, Info * > NameMapType
Definition: info.hh:257
gem5::statistics::Info::setName
void setName(const std::string &name, bool old_style=true)
Set the name of this statistic.
Definition: info.cc:127
gem5::statistics::__reserved
const FlagsType __reserved
Mask of flags that can't be set directly.
Definition: info.hh:74
units.hh
gem5::statistics::VectorDistInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:214
gem5::statistics::nameMap
NameMapType & nameMap()
Definition: info.cc:65
gem5::statistics::StorageParams
Definition: storage.hh:48
gem5::statistics::VectorDistInfo
Definition: info.hh:207
gem5::statistics::VectorInfo::size
virtual size_type size() const =0
gem5::statistics::Info::less
static bool less(Info *stat1, Info *stat2)
Checks if the first stat's name is alphabetically less than the second.
Definition: info.cc:146
gem5::statistics::oneline
const FlagsType oneline
Print all values on a single line.
Definition: info.hh:71
gem5::statistics::Info::desc
std::string desc
The description of the stat.
Definition: info.hh:89
gem5::statistics::DistData
General container for distribution data.
Definition: types.hh:65
gem5::statistics::Vector2dInfo::x
size_type x
Definition: info.hh:233
gem5::statistics::SparseHistInfo::data
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:254
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:46
gem5::statistics::ScalarInfo::value
virtual Counter value() const =0
gem5::statistics::VectorDistInfo::enable
void enable()
Enable the stat for use.
Definition: info.cc:207
gem5::statistics::Info::setStorageParams
void setStorageParams(const StorageParams *const params)
Setter for the storage params.
Definition: info.cc:90
gem5::statistics::init
const FlagsType init
This Stat is Initialized.
Definition: info.hh:55
gem5::statistics::Info::separatorString
static std::string separatorString
The separator string used for vectors, dist, etc.
Definition: info.hh:85
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::statistics::total
const FlagsType total
Print the total.
Definition: info.hh:59
gem5::statistics::Info::getStorageParams
StorageParams const * getStorageParams() const
Getter for the storage params.
Definition: info.cc:84
gem5::statistics::Vector2dInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:229
gem5::statistics::VectorInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:187
gem5::statistics::Info::Info
Info()
Definition: info.cc:71
gem5::statistics::Info::name
std::string name
The name of the stat.
Definition: info.hh:83
gem5::statistics::FormulaInfo
Definition: info.hh:244
gem5::statistics::Vector2dInfo
Definition: info.hh:225
gem5::statistics::Info
Definition: info.hh:79
gem5::statistics::Info::~Info
virtual ~Info()
Definition: info.cc:79

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