gem5  v21.1.0.2
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 GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
47 namespace statistics
48 {
49 
50 typedef uint16_t FlagsType;
52 
54 const FlagsType none = 0x0000;
56 const FlagsType init = 0x0001;
58 const FlagsType display = 0x0002;
60 const FlagsType total = 0x0010;
62 const FlagsType pdf = 0x0020;
64 const FlagsType cdf = 0x0040;
66 const FlagsType dist = 0x0080;
68 const FlagsType nozero = 0x0100;
70 const FlagsType nonan = 0x0200;
72 const FlagsType oneline = 0x0400;
73 
76 
77 struct StorageParams;
78 struct Output;
79 
80 class Info
81 {
82  public:
84  std::string name;
86  static std::string separatorString;
90  std::string desc;
94  int precision;
96  const Info *prereq;
101  static int id_count;
102  int id;
103 
104  private:
105  std::unique_ptr<const StorageParams> storageParams;
106 
107  public:
108  Info();
109  virtual ~Info();
110 
118  void setName(const std::string &name, bool old_style=true);
119 
120  void setSeparator(std::string _sep) { separatorString = _sep;}
121 
127  StorageParams const* getStorageParams() const;
129  void setStorageParams(const StorageParams *const params);
130 
136  virtual bool check() const = 0;
137  bool baseCheck() const;
138 
142  virtual void enable();
143 
147  virtual void prepare() = 0;
148 
152  virtual void reset() = 0;
153 
158  virtual bool zero() const = 0;
159 
163  virtual void visit(Output &visitor) = 0;
164 
173  static bool less(Info *stat1, Info *stat2);
174 };
175 
176 class ScalarInfo : public Info
177 {
178  public:
179  virtual Counter value() const = 0;
180  virtual Result result() const = 0;
181  virtual Result total() const = 0;
182 };
183 
184 class VectorInfo : public Info
185 {
186  public:
190 
191  public:
192  void enable();
193 
194  public:
195  virtual size_type size() const = 0;
196  virtual const VCounter &value() const = 0;
197  virtual const VResult &result() const = 0;
198  virtual Result total() const = 0;
199 };
200 
201 class DistInfo : public Info
202 {
203  public:
206 };
207 
208 class VectorDistInfo : public Info
209 {
210  public:
212 
216  void enable();
217 
218  protected:
220  mutable VResult rvec;
221 
222  public:
223  virtual size_type size() const = 0;
224 };
225 
226 class Vector2dInfo : public Info
227 {
228  public:
233 
236 
238  mutable VCounter cvec;
239 
240  void enable();
241 
242  virtual Result total() const = 0;
243 };
244 
245 class FormulaInfo : public VectorInfo
246 {
247  public:
248  virtual std::string str() const = 0;
249 };
250 
251 class SparseHistInfo : public Info
252 {
253  public:
256 };
257 
258 typedef std::map<std::string, Info *> NameMapType;
260 
261 } // namespace statistics
262 } // namespace gem5
263 
264 #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:189
gem5::statistics::Info::enable
virtual void enable()
Enable the stat for use.
Definition: info.cc:195
gem5::statistics::Info::setSeparator
void setSeparator(std::string _sep)
Definition: info.hh:120
types.hh
gem5::statistics::Info::precision
int precision
The display precision.
Definition: info.hh:94
gem5::statistics::DistInfo
Definition: info.hh:201
gem5::statistics::Info::prereq
const Info * prereq
A pointer to a prerequisite Stat.
Definition: info.hh:96
gem5::statistics::units::Base
The Base class is the parent class of all unit classes.
Definition: units.hh:122
gem5::statistics::VectorDistInfo::data
std::vector< DistData > data
Definition: info.hh:211
gem5::statistics::FlagsType
uint16_t FlagsType
Definition: info.hh:50
gem5::statistics::Result
double Result
All results are doubles.
Definition: types.hh:56
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:214
gem5::statistics::Info::zero
virtual bool zero() const =0
gem5::statistics::VectorInfo
Definition: info.hh:184
gem5::statistics::Vector2dInfo::enable
void enable()
Enable the stat for use.
Definition: info.cc:220
gem5::statistics::VectorInfo::result
virtual const VResult & result() const =0
gem5::statistics::Flags
gem5::Flags< FlagsType > Flags
Definition: info.hh:51
gem5::statistics::nozero
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:68
gem5::statistics::SparseHistData
Data structure of sparse histogram.
Definition: types.hh:85
gem5::statistics::VectorInfo::enable
void enable()
Enable the stat for use.
Definition: info.cc:200
gem5::statistics::VectorInfo::value
virtual const VCounter & value() const =0
gem5::statistics::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:232
gem5::statistics::Info::storageParams
std::unique_ptr< const StorageParams > storageParams
Definition: info.hh:105
gem5::statistics::ScalarInfo
Definition: info.hh:176
std::vector< std::string >
gem5::statistics::nonan
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:70
gem5::statistics::units::Unspecified::get
static Unspecified * get()
Definition: units.hh:329
gem5::statistics::Vector2dInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:231
gem5::statistics::none
const FlagsType none
Nothing extra to print.
Definition: info.hh:54
gem5::statistics::Info::flags
Flags flags
The formatting flags.
Definition: info.hh:92
gem5::statistics::dist
const FlagsType dist
Print the distribution.
Definition: info.hh:66
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:62
gem5::statistics::Info::id
int id
Definition: info.hh:102
gem5::statistics::Info::baseCheck
bool baseCheck() const
Definition: info.cc:173
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:238
gem5::statistics::Output
Definition: output.hh:65
gem5::statistics::Info::id_count
static int id_count
A unique stat ID for each stat in the simulator.
Definition: info.hh:101
gem5::statistics::Info::prepare
virtual void prepare()=0
Prepare the stat for dumping.
gem5::statistics::SparseHistInfo
Definition: info.hh:251
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:88
gem5::statistics::display
const FlagsType display
Print this stat.
Definition: info.hh:58
gem5::statistics::DistInfo::data
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:205
gem5::statistics::cdf
const FlagsType cdf
Print the cumulative percentage of total upto this entry.
Definition: info.hh:64
compiler.hh
gem5::statistics::Vector2dInfo::total
virtual Result total() const =0
gem5::statistics::size_type
unsigned int size_type
Definition: types.hh:60
gem5::statistics::VectorInfo::total
virtual Result total() const =0
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::statistics::VectorDistInfo::rvec
VResult rvec
Local storage for the entry values, used for printing.
Definition: info.hh:220
gem5::statistics::Vector2dInfo::y
size_type y
Definition: info.hh:235
flags.hh
gem5::statistics::NameMapType
std::map< std::string, Info * > NameMapType
Definition: info.hh:258
gem5::statistics::Info::setName
void setName(const std::string &name, bool old_style=true)
Set the name of this statistic.
Definition: info.cc:128
gem5::statistics::__reserved
const FlagsType __reserved
Mask of flags that can't be set directly.
Definition: info.hh:75
units.hh
gem5::statistics::VectorDistInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:215
gem5::statistics::nameMap
NameMapType & nameMap()
Definition: info.cc:66
gem5::statistics::StorageParams
Definition: storage.hh:49
gem5::statistics::VectorDistInfo
Definition: info.hh:208
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:147
gem5::statistics::oneline
const FlagsType oneline
Print all values on a single line.
Definition: info.hh:72
gem5::statistics::Info::desc
std::string desc
The description of the stat.
Definition: info.hh:90
gem5::statistics::DistData
General container for distribution data.
Definition: types.hh:66
gem5::statistics::Vector2dInfo::x
size_type x
Definition: info.hh:234
gem5::statistics::SparseHistInfo::data
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:255
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
gem5::statistics::ScalarInfo::value
virtual Counter value() const =0
gem5::statistics::VectorDistInfo::enable
void enable()
Enable the stat for use.
Definition: info.cc:210
gem5::statistics::Info::setStorageParams
void setStorageParams(const StorageParams *const params)
Setter for the storage params.
Definition: info.cc:91
gem5::statistics::init
const FlagsType init
This Stat is Initialized.
Definition: info.hh:56
gem5::statistics::Info::separatorString
static std::string separatorString
The separator string used for vectors, dist, etc.
Definition: info.hh:86
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::statistics::total
const FlagsType total
Print the total.
Definition: info.hh:60
gem5::statistics::Info::getStorageParams
StorageParams const * getStorageParams() const
Getter for the storage params.
Definition: info.cc:85
gem5::statistics::Vector2dInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:230
gem5::statistics::VectorInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:188
gem5::statistics::Info::Info
Info()
Definition: info.cc:72
gem5::statistics::Info::name
std::string name
The name of the stat.
Definition: info.hh:84
gem5::statistics::FormulaInfo
Definition: info.hh:245
gem5::statistics::Vector2dInfo
Definition: info.hh:226
gem5::statistics::Info
Definition: info.hh:80
gem5::statistics::Info::~Info
virtual ~Info()
Definition: info.cc:80

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