41 #if defined(__APPLE__)
42 #define _GLIBCPP_USE_C99 1
66 constexpr
auto Nan = std::numeric_limits<float>::quiet_NaN();
77 : mystream(false), stream(NULL), descriptions(false), spaces(false)
104 panic(
"stream already set!");
109 fatal(
"Unable to open output stream for writing\n");
116 panic(
"stream already set!");
119 stream =
new std::ofstream(file.c_str(), std::ios::trunc);
121 fatal(
"Unable to open statistics file for writing\n");
133 ccprintf(*
stream,
"\n---------- Begin Simulation Statistics ----------\n");
139 ccprintf(*
stream,
"\n---------- End Simulation Statistics ----------\n");
165 assert(!
path.empty());
184 std::stringstream
val;
186 if (!std::isnan(value)) {
188 val.precision(precision);
189 else if (value == rint(value))
192 val.unsetf(std::ios::showpoint);
193 val.setf(std::ios::fixed);
217 bool enable_descriptions, std::string _desc,
218 bool enable_units, std::string unit_str,
266 void operator()(std::ostream &stream,
bool oneLine =
false)
const;
286 std::stringstream pdfstr, cdfstr;
288 if (!std::isnan(
pdf))
291 if (!std::isnan(
cdf))
300 if (
spaces || pdfstr.rdbuf()->in_avail())
302 if (
spaces || cdfstr.rdbuf()->in_avail())
354 print.
pdf = _total ? 0.0 : Nan;
355 print.
cdf = _total ? 0.0 : Nan;
538 std::stringstream namestr;
545 namestr <<
"-" <<
high;
547 print.
name = namestr.str();
645 bool havesub =
false;
678 yvec[
j] = info.
cvec[iy +
j];
679 tot_vec[
j] += yvec[
j];
695 total_subname.push_back(
"total");
782 MCounter::const_iterator it;
784 std::stringstream namestr;
787 namestr <<(*it).first;
788 print.
name = namestr.str();
789 print.
value = (*it).second;
805 initText(
const std::string &filename,
bool desc,
bool spaces)
808 static bool connected =
false;
OutputStream * findOrCreate(const std::string &name, bool binary=false)
std::ostream * stream() const
Get the output underlying output stream.
Flags flags
The formatting flags.
const units::Base * unit
The unit of the stat.
std::string name
The name of the stat.
std::string desc
The description of the stat.
virtual bool zero() const =0
static std::string separatorString
The separator string used for vectors, dist, etc.
int precision
The display precision.
const Info * prereq
A pointer to a prerequisite Stat.
virtual Result result() const =0
bool noOutput(const Info &info)
std::string statName(const std::string &name) const
void beginGroup(const char *name) override
std::stack< std::string > path
bool valid() const override
void open(std::ostream &stream)
void visit(const ScalarInfo &info) override
std::vector< std::string > y_subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
VCounter cvec
Local storage for the entry values, used for printing.
virtual Result total() const =0
virtual size_type size() const =0
std::vector< std::string > subdescs
std::vector< std::string > subnames
Names and descriptions of subfields.
virtual Result total() const =0
virtual size_type size() const =0
virtual const VResult & result() const =0
std::vector< std::string > subdescs
std::vector< std::string > subnames
Names and descriptions of subfields.
virtual std::string getUnitString() const =0
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
#define panic(...)
This implements a cprintf based panic() function.
#define fatal(...)
This implements a cprintf based fatal() function.
std::vector< Result > VResult
vector of results.
const FlagsType pdf
Print the percent of the total that this entry represents.
const FlagsType nonan
Don't print if this is NAN.
std::string ValueToString(Result value, int precision)
const FlagsType oneline
Print all values on a single line.
const FlagsType nozero
Don't print if this is zero.
const FlagsType total
Print the total.
double Counter
All counters are of 64-bit values.
const FlagsType display
Print this stat.
const FlagsType cdf
Print the cumulative percentage of total upto this entry.
std::list< Info * > & statsList()
double Result
All results are doubles.
Output * initText(const std::string &filename, bool desc, bool spaces)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::string csprintf(const char *format, const Args &...args)
void ccprintf(cp::Print &print)
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
const std::string to_string(sc_enc enc)
BasePrint(bool _spaces=false)
void printUnits(std::ostream &stream) const
void setup(std::string _name, Flags _flags, int _precision, bool enable_descriptions, std::string _desc, bool enable_units, std::string unit_str, bool enable_spaces)
General container for distribution data.
void operator()(std::ostream &stream) const
std::string separatorString
void init(const Text *text, const Info &info)
DistPrint(const Text *text, const DistInfo &info)
void operator()(std::ostream &stream, bool oneLine=false) const
void update(Result val, Result total)
Data structure of sparse histogram.
std::string separatorString
const SparseHistData & data
void init(const Text *text, const Info &info)
void operator()(std::ostream &stream) const
SparseHistPrint(const Text *text, const SparseHistInfo &info)
void operator()(std::ostream &stream) const
std::string separatorString
std::vector< std::string > subdescs
std::vector< std::string > subnames
const std::string & name()