Go to the documentation of this file.
63 std::string Info::separatorString =
"::";
85 "shouldn't register stat twice!");
99 statsMap().insert(make_pair(
this, info));
100 assert(result.second &&
"this should never fail");
107 info()->storageParams = params;
111 InfoAccess::setInit()
113 info()->flags.set(
init);
124 MapType::const_iterator
i =
statsMap().find(
this);
131 InfoAccess::info()
const
138 MapType::const_iterator
i =
statsMap().find(
this);
144 StorageParams::~StorageParams()
155 int Info::id_count = 0;
160 : flags(
none), precision(-1), prereq(0), storageParams(NULL)
180 while (item != vec.end()) {
184 string::const_iterator
c = item->begin();
187 if (!isalpha(*
c) && *
c !=
'_')
191 while (++
c != item->end()) {
192 if (!isalnum(*
c) && *
c !=
'_')
222 panic(
"same statistic name used twice! name=%s\n",
232 const string &name1 = stat1->
name;
233 const string &name2 = stat2->
name;
241 size_type last = min(v1.size(), v2.size()) - 1;
244 return v1[
i] < v2[
i];
247 if (v1[last] == v2[last])
248 return v1.size() < v2.size();
250 return v1[last] < v2[last];
260 cprintf(
"this is stat number %d\n",
id);
262 panic(
"Not all stats have been initialized.\n"
263 "You may need to add <ParentClass>::regStats() to a"
264 " new SimObject's regStats() function. Name: %s",
270 panic(
"all printable stats must be named");
319 int bottom_half = (
size -
zero) / 2;
322 int low_pair =
zero - 1;
323 for (
int i =
zero - 1;
i >= bottom_half;
i--) {
325 if (low_pair - 1 >= 0)
329 assert(low_pair == 0 || low_pair == -1 || low_pair == -2);
331 for (
int i = bottom_half - 1;
i >= 0;
i--)
335 int high_pair =
zero;
336 for (
int i =
zero;
i < top_half;
i++) {
338 if (high_pair + 1 <
size)
342 assert(high_pair ==
size || high_pair ==
size + 1);
344 for (
int i = top_half;
i <
size;
i++)
356 int half = (
size + 1) / 2;
360 for (
int i =
size - 1;
i >= half; --
i) {
367 for (
int i = half - 1;
i >= 0;
i--)
378 int half = (
size + 1) / 2;
381 for (
int i = 0;
i < half;
i++) {
389 for (
int i = half;
i <
size;
i++)
399 int b_size = hs->
size();
400 assert(
size() == b_size);
413 for (uint32_t
i = 0;
i < b_size;
i++)
435 assert(!
root &&
"Can't change formulas");
436 root =
r.getNodePtr();
448 root =
r.getNodePtr();
471 vec =
root->result();
554 fatal(
"Stats are already enabled");
565 fatal(
"No registered Stats::dump handler");
574 fatal(
"No registered Stats::reset handler");
std::vector< std::string > subnames
Names and descriptions of subfields.
std::vector< std::string > subdescs
void tokenize(vector< string > &v, const string &s, char token, bool ignore)
#define fatal(...)
This implements a cprintf based fatal() function.
const FlagsType init
This Stat is Initialized.
static Root * root()
Use this function to get a pointer to the single Root object in the simulation.
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
VCounter cvec
Counter for each bucket.
Templatized storage and interface for a histogram stat.
std::map< std::string, Info * > NameMapType
void registerDumpCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are about to be dumped.
Counter max_bucket
The maximum value to track.
std::vector< std::string > subdescs
std::vector< std::string > subnames
Names and descriptions of subfields.
std::vector< std::string > y_subnames
const FlagsType display
Print this stat.
const FlagsType none
Nothing extra to print.
Counter logs
The sum of logarithm of each sample, used to compute geometric mean.
static int id_count
A unique stat ID for each stat in the simulator.
Counter min_bucket
The minimum value to track.
Counter squares
The sum of squares.
virtual size_type size() const =0
virtual void enable()
Enable the stat for use.
Helper class to construct formula node trees.
void enable()
Enable the stat for use.
bool validateStatName(const string &name)
const Info * resolveStat(std::string name) const
Resolve a stat by its name within this group.
void cprintf(const char *format, const Args &...args)
void(* Handler)()
Register reset and dump handlers.
const Info * resolve(const std::string &name)
bool zero() const
Returns true if any calls to sample have been made.
void registerResetCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are reset.
Counter sum
The current sum.
std::vector< std::string > subdescs
list< Info * > & statsList()
virtual size_type size() const =0
const std::string & name()
Counter bucket_size
The number of entries in each bucket.
double Result
All results are doubles.
double Counter
All counters are of 64-bit values.
std::vector< std::string > subnames
Names and descriptions of subfields.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void setInit()
Save Storage class parameters if any.
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
void setName(const std::string &name)
Set the name of this statistic.
Overload hash function for BasicBlockRange type.
void dump()
Dump all statistics data to the registered outputs.
Flags flags
The formatting flags.
std::string name
The name of the stat.
static bool less(Info *stat1, Info *stat2)
Checks if the first stat's name is alphabetically less than the second.
void enable()
Enable the stat for use.
size_type size() const
Return the number of buckets in this distribution.
std::map< const void *, Info * > MapType
void registerHandlers(Handler reset_handler, Handler dump_handler)
void enable()
Enable the stat for use.
std::shared_ptr< Node > NodePtr
Shared pointer to a function Node.
#define panic(...)
This implements a cprintf based panic() function.
Counter samples
The number of samples.
Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17