gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  * Authors: Nathan Binkert
29  */
30 
31 #ifndef __BASE_STATS_INFO_HH__
32 #define __BASE_STATS_INFO_HH__
33 
34 #include "base/stats/types.hh"
35 #include "base/flags.hh"
36 
37 namespace Stats {
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 setSeparator(std::string _sep) { separatorString = _sep;}
101 
107  virtual bool check() const = 0;
108  bool baseCheck() const;
109 
113  virtual void enable();
114 
118  virtual void prepare() = 0;
119 
123  virtual void reset() = 0;
124 
129  virtual bool zero() const = 0;
130 
134  virtual void visit(Output &visitor) = 0;
135 
144  static bool less(Info *stat1, Info *stat2);
145 };
146 
147 class ScalarInfo : public Info
148 {
149  public:
150  virtual Counter value() const = 0;
151  virtual Result result() const = 0;
152  virtual Result total() const = 0;
153 };
154 
155 class VectorInfo : public Info
156 {
157  public:
161 
162  public:
163  void enable();
164 
165  public:
166  virtual size_type size() const = 0;
167  virtual const VCounter &value() const = 0;
168  virtual const VResult &result() const = 0;
169  virtual Result total() const = 0;
170 };
171 
173 
174 struct DistData
175 {
180 
190 };
191 
192 class DistInfo : public Info
193 {
194  public:
197 };
198 
199 class VectorDistInfo : public Info
200 {
201  public:
203 
207  void enable();
208 
209  protected:
211  mutable VResult rvec;
212 
213  public:
214  virtual size_type size() const = 0;
215 };
216 
217 class Vector2dInfo : public Info
218 {
219  public:
224 
227 
229  mutable VCounter cvec;
230 
231  void enable();
232 
233  virtual Result total() const = 0;
234 };
235 
236 class FormulaInfo : public VectorInfo
237 {
238  public:
239  virtual std::string str() const = 0;
240 };
241 
244 {
247 };
248 
249 
250 class SparseHistInfo : public Info
251 {
252  public:
255 };
256 
257 } // namespace Stats
258 
259 #endif // __BASE_STATS_INFO_HH__
double Result
All results are doubles.
Definition: types.hh:52
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:51
std::map< Counter, int > MCounter
map of counters
Definition: types.hh:47
std::string name
The name of the stat.
Definition: info.hh:73
static int id_count
A unique stat ID for each stat in the simulator.
Definition: info.hh:88
void enable()
Enable the stat for use.
Definition: statistics.cc:265
VResult rvec
Local storage for the entry values, used for printing.
Definition: info.hh:211
std::vector< std::string > subdescs
Definition: info.hh:206
std::vector< std::string > subdescs
Definition: info.hh:160
int id
Definition: info.hh:89
static std::string separatorString
The separator string used for vectors, dist, etc.
Definition: info.hh:75
virtual bool zero() const =0
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:59
virtual size_type size() const =0
Counter min_val
Definition: info.hh:181
virtual void enable()
Enable the stat for use.
Definition: statistics.cc:240
virtual Result total() const =0
DistType type
Definition: info.hh:176
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:159
virtual std::string str() const =0
std::vector< std::string > y_subnames
Definition: info.hh:223
virtual Result result() const =0
void enable()
Enable the stat for use.
Definition: statistics.cc:255
Counter max
Definition: info.hh:178
virtual void prepare()=0
Prepare the stat for dumping.
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:221
unsigned int size_type
Definition: types.hh:56
Counter overflow
Definition: info.hh:184
virtual void reset()=0
Reset the stat to the default state.
double Counter
All counters are of 64-bit values.
Definition: types.hh:43
virtual Result total() const =0
Data structure of sparse histogram.
Definition: info.hh:243
virtual const VResult & result() const =0
VCounter cvec
Local storage for the entry values, used for printing.
Definition: info.hh:229
Counter min
Definition: info.hh:177
const Info * prereq
A pointer to a prerequisite Stat.
Definition: info.hh:83
static bool less(Info *stat1, Info *stat2)
Checks if the first stat's name is alphabetically less than the second.
Definition: statistics.cc:193
Counter underflow
Definition: info.hh:183
virtual Result total() const =0
Flags flags
The formatting flags.
Definition: info.hh:79
const FlagsType oneline
Print all values on a single line.
Definition: info.hh:61
DistType
Definition: info.hh:172
virtual size_type size() const =0
void setName(const std::string &name)
Set the name of this statistic.
Definition: statistics.cc:172
virtual Counter value() const =0
std::vector< DistData > data
Definition: info.hh:202
const FlagsType display
Print this stat.
Definition: info.hh:47
const FlagsType none
Nothing extra to print.
Definition: info.hh:43
virtual ~Info()
Definition: statistics.cc:136
size_type x
Definition: info.hh:225
void enable()
Enable the stat for use.
Definition: statistics.cc:245
bool baseCheck() const
Definition: statistics.cc:219
Counter logs
Definition: info.hh:188
int precision
The display precision.
Definition: info.hh:81
std::vector< std::string > subdescs
Definition: info.hh:222
const FlagsType total
Print the total.
Definition: info.hh:49
Counter samples
Definition: info.hh:189
const FlagsType __reserved
Mask of flags that can't be set directly.
Definition: info.hh:64
void setSeparator(std::string _sep)
Definition: info.hh:100
virtual const VCounter & value() const =0
VCounter cvec
Definition: info.hh:185
uint16_t FlagsType
Definition: info.hh:39
size_type y
Definition: info.hh:226
virtual bool check() const =0
Check that this stat has been set up properly and is ready for use.
const StorageParams * storageParams
Definition: info.hh:92
Counter squares
Definition: info.hh:187
SparseHistData data
Local storage for the entry values, used for printing.
Definition: info.hh:254
Counter max_val
Definition: info.hh:182
Counter sum
Definition: info.hh:186
Counter bucket_size
Definition: info.hh:179
::Flags< FlagsType > Flags
Definition: info.hh:40
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:57
const FlagsType dist
Print the distribution.
Definition: info.hh:55
const FlagsType cdf
Print the cumulative percentage of total upto this entry.
Definition: info.hh:53
DistData data
Local storage for the entry values, used for printing.
Definition: info.hh:196
const FlagsType init
This Stat is Initialized.
Definition: info.hh:45
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:205
virtual void visit(Output &visitor)=0
Visitor entry for outputing statistics data.
std::string desc
The description of the stat.
Definition: info.hh:77

Generated on Fri Jun 9 2017 13:03:41 for gem5 by doxygen 1.8.6