gem5  v21.1.0.2
text.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020 Arm Limited
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2004-2005 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #if defined(__APPLE__)
42 #define _GLIBCPP_USE_C99 1
43 #endif
44 
45 #include "base/stats/text.hh"
46 
47 #include <cassert>
48 #include <cmath>
49 #include <fstream>
50 #include <iostream>
51 #include <limits>
52 #include <sstream>
53 #include <string>
54 
55 #include "base/cast.hh"
56 #include "base/logging.hh"
57 #include "base/stats/info.hh"
58 #include "base/str.hh"
59 
60 namespace gem5
61 {
62 
63 namespace
64 {
65 
66 constexpr auto Nan = std::numeric_limits<float>::quiet_NaN();
67 
68 } // anonymous namespace
69 
70 GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
71 namespace statistics
72 {
73 
75 
77  : mystream(false), stream(NULL), descriptions(false), spaces(false)
78 {
79 }
80 
81 Text::Text(std::ostream &stream) : Text()
82 {
83  open(stream);
84 }
85 
86 Text::Text(const std::string &file) : Text()
87 {
88  open(file);
89 }
90 
91 
93 {
94  if (mystream) {
95  assert(stream);
96  delete stream;
97  }
98 }
99 
100 void
101 Text::open(std::ostream &_stream)
102 {
103  if (stream)
104  panic("stream already set!");
105 
106  mystream = false;
107  stream = &_stream;
108  if (!valid())
109  fatal("Unable to open output stream for writing\n");
110 }
111 
112 void
113 Text::open(const std::string &file)
114 {
115  if (stream)
116  panic("stream already set!");
117 
118  mystream = true;
119  stream = new std::ofstream(file.c_str(), std::ios::trunc);
120  if (!valid())
121  fatal("Unable to open statistics file for writing\n");
122 }
123 
124 bool
125 Text::valid() const
126 {
127  return stream != NULL && stream->good();
128 }
129 
130 void
132 {
133  ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
134 }
135 
136 void
138 {
139  ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
140  stream->flush();
141 }
142 
143 std::string
144 Text::statName(const std::string &name) const
145 {
146  if (path.empty())
147  return name;
148  else
149  return csprintf("%s.%s", path.top(), name);
150 }
151 
152 void
153 Text::beginGroup(const char *name)
154 {
155  if (path.empty()) {
156  path.push(name);
157  } else {
158  path.push(csprintf("%s.%s", path.top(), name));
159  }
160 }
161 
162 void
164 {
165  assert(!path.empty());
166  path.pop();
167 }
168 
169 bool
170 Text::noOutput(const Info &info)
171 {
172  if (!info.flags.isSet(display))
173  return true;
174 
175  if (info.prereq && info.prereq->zero())
176  return true;
177 
178  return false;
179 }
180 
181 std::string
182 ValueToString(Result value, int precision)
183 {
184  std::stringstream val;
185 
186  if (!std::isnan(value)) {
187  if (precision != -1)
188  val.precision(precision);
189  else if (value == rint(value))
190  val.precision(0);
191 
192  val.unsetf(std::ios::showpoint);
193  val.setf(std::ios::fixed);
194  val << value;
195  } else {
196  val << "nan";
197  }
198 
199  return val.str();
200 }
201 
202 struct BasePrint
203 {
204  std::string name;
208  std::string desc;
210  std::string unitStr;
211  bool spaces;
212 
213  BasePrint(bool _spaces=false) : spaces(_spaces) {}
214 
215  void
216  setup(std::string _name, Flags _flags, int _precision,
217  bool enable_descriptions, std::string _desc,
218  bool enable_units, std::string unit_str,
219  bool enable_spaces)
220  {
221  name = _name;
222  flags = _flags;
223  precision = _precision;
224  descriptions = enable_descriptions;
225  desc = _desc;
226  enableUnits = enable_units;
227  unitStr = unit_str;
228  spaces = enable_spaces;
229  }
230 
231  void
232  printUnits(std::ostream &stream) const
233  {
234  if (enableUnits && !unitStr.empty()) {
235  ccprintf(stream, " (%s)", unitStr);
236  }
237  }
238 };
239 
240 struct ScalarPrint : public BasePrint
241 {
249 
251  : BasePrint(spaces)
252  {
253  if (spaces) {
254  nameSpaces = 40;
255  valueSpaces = 12;
256  pdfstrSpaces = 10;
257  cdfstrSpaces = 10;
258  } else {
259  nameSpaces = 0;
260  valueSpaces = 0;
261  pdfstrSpaces = 0;
262  cdfstrSpaces = 0;
263  }
264  }
265  void update(Result val, Result total);
266  void operator()(std::ostream &stream, bool oneLine = false) const;
267 };
268 
269 void
271 {
272  value = val;
273  if (total) {
274  pdf = val / total;
275  cdf += pdf;
276  }
277 }
278 
279 void
280 ScalarPrint::operator()(std::ostream &stream, bool oneLine) const
281 {
282  if ((flags.isSet(nozero) && (!oneLine) && value == 0.0) ||
283  (flags.isSet(nonan) && std::isnan(value)))
284  return;
285 
286  std::stringstream pdfstr, cdfstr;
287 
288  if (!std::isnan(pdf))
289  ccprintf(pdfstr, "%.2f%%", pdf * 100.0);
290 
291  if (!std::isnan(cdf))
292  ccprintf(cdfstr, "%.2f%%", cdf * 100.0);
293 
294  if (oneLine) {
295  ccprintf(stream, " |");
296  } else {
297  ccprintf(stream, "%-*s ", nameSpaces, name);
298  }
299  ccprintf(stream, "%*s", valueSpaces, ValueToString(value, precision));
300  if (spaces || pdfstr.rdbuf()->in_avail())
301  ccprintf(stream, " %*s", pdfstrSpaces, pdfstr.str());
302  if (spaces || cdfstr.rdbuf()->in_avail())
303  ccprintf(stream, " %*s", cdfstrSpaces, cdfstr.str());
304  if (!oneLine) {
305  if (descriptions) {
306  if (!desc.empty())
307  ccprintf(stream, " # %s", desc);
308  }
309  printUnits(stream);
310  stream << std::endl;
311  }
312 }
313 
314 struct VectorPrint : public BasePrint
315 {
316  std::string separatorString;
323 
324  VectorPrint() = delete;
326  : BasePrint(spaces)
327  {
328  if (spaces) {
329  nameSpaces = 40;
330  } else {
331  nameSpaces = 0;
332  }
333  }
334  void operator()(std::ostream &stream) const;
335 };
336 
337 void
338 VectorPrint::operator()(std::ostream &stream) const
339 {
340  size_type _size = vec.size();
341  Result _total = 0.0;
342 
343  if (flags.isSet(pdf | cdf)) {
344  for (off_type i = 0; i < _size; ++i) {
345  _total += vec[i];
346  }
347  }
348 
349  std::string base = name + separatorString;
350 
351  ScalarPrint print(spaces);
353  unitStr, spaces);
354  print.pdf = _total ? 0.0 : Nan;
355  print.cdf = _total ? 0.0 : Nan;
356 
357  bool havesub = !subnames.empty();
358 
359  if (_size == 1) {
360  // If forceSubnames is set, get the first subname (or index in
361  // the case where there are no subnames) and append it to the
362  // base name.
363  if (forceSubnames)
364  print.name = base + (havesub ? subnames[0] : std::to_string(0));
365  print.value = vec[0];
366  print(stream);
367  return;
368  }
369 
370  if ((!flags.isSet(nozero)) || (total != 0)) {
371  if (flags.isSet(oneline)) {
372  ccprintf(stream, "%-*s", nameSpaces, name);
373  print.flags = print.flags & (~nozero);
374  }
375 
376  for (off_type i = 0; i < _size; ++i) {
377  if (havesub && (i >= subnames.size() || subnames[i].empty()))
378  continue;
379 
380  print.name = base + (havesub ? subnames[i] : std::to_string(i));
381  print.desc = subdescs.empty() ? desc : subdescs[i];
382  print.unitStr = unitStr;
383 
384  print.update(vec[i], _total);
385  print(stream, flags.isSet(oneline));
386  }
387 
388  if (flags.isSet(oneline)) {
389  if (descriptions) {
390  if (!desc.empty())
391  ccprintf(stream, " # %s", desc);
392  }
393  printUnits(stream);
394  stream << std::endl;
395  }
396  }
397 
399  print.pdf = Nan;
400  print.cdf = Nan;
401  print.name = base + "total";
402  print.desc = desc;
403  print.unitStr = unitStr;
404  print.value = total;
405  print(stream);
406  }
407 }
408 
409 struct DistPrint : public BasePrint
410 {
411  std::string separatorString;
413 
414  const DistData &data;
415 
416  DistPrint(const Text *text, const DistInfo &info);
417  DistPrint(const Text *text, const VectorDistInfo &info, int i);
418  void init(const Text *text, const Info &info);
419  void operator()(std::ostream &stream) const;
420 };
421 
422 DistPrint::DistPrint(const Text *text, const DistInfo &info)
423  : data(info.data)
424 {
425  init(text, info);
426 }
427 
428 DistPrint::DistPrint(const Text *text, const VectorDistInfo &info,
429  int i) : data(info.data[i])
430 {
431  init(text, info);
432 
433  name = text->statName(
434  info.name + "_" +
435  (info.subnames[i].empty() ? (std::to_string(i)) : info.subnames[i]));
436 
437  if (!info.subdescs[i].empty())
438  desc = info.subdescs[i];
439 
440  unitStr = info.unit->getUnitString();
441 }
442 
443 void
444 DistPrint::init(const Text *text, const Info &info)
445 {
446  setup(text->statName(info.name), info.flags, info.precision,
447  text->descriptions, info.desc, text->enableUnits,
448  info.unit->getUnitString(), text->spaces);
450  if (spaces) {
451  nameSpaces = 40;
452  } else {
453  nameSpaces = 0;
454  }
455 }
456 
457 void
458 DistPrint::operator()(std::ostream &stream) const
459 {
460  if (flags.isSet(nozero) && data.samples == 0) return;
461  std::string base = name + separatorString;
462 
463  ScalarPrint print(spaces);
464  print.precision = precision;
465  print.flags = flags;
466  print.descriptions = descriptions;
467  print.desc = desc;
468  print.unitStr = unitStr;
469  print.pdf = Nan;
470  print.cdf = Nan;
471 
472  if (flags.isSet(oneline)) {
473  print.name = base + "bucket_size";
474  print.value = data.bucket_size;
475  print(stream);
476 
477  print.name = base + "min_bucket";
478  print.value = data.min;
479  print(stream);
480 
481  print.name = base + "max_bucket";
482  print.value = data.max;
483  print(stream);
484  }
485 
486  print.name = base + "samples";
487  print.value = data.samples;
488  print(stream);
489 
490  print.name = base + "mean";
491  print.value = data.samples ? data.sum / data.samples : Nan;
492  print(stream);
493 
494  if (data.type == Hist) {
495  print.name = base + "gmean";
496  print.value = data.samples ? exp(data.logs / data.samples) : Nan;
497  print(stream);
498  }
499 
500  Result stdev = Nan;
501  if (data.samples)
502  stdev = sqrt((data.samples * data.squares - data.sum * data.sum) /
503  (data.samples * (data.samples - 1.0)));
504  print.name = base + "stdev";
505  print.value = stdev;
506  print(stream);
507 
508  if (data.type == Deviation)
509  return;
510 
511  size_t size = data.cvec.size();
512 
513  Result total = 0.0;
514  if (data.type == Dist && data.underflow != Nan)
515  total += data.underflow;
516  for (off_type i = 0; i < size; ++i)
517  total += data.cvec[i];
518  if (data.type == Dist && data.overflow != Nan)
519  total += data.overflow;
520 
521  if (total) {
522  print.pdf = 0.0;
523  print.cdf = 0.0;
524  }
525 
526  if (data.type == Dist && data.underflow != Nan) {
527  print.name = base + "underflows";
528  print.update(data.underflow, total);
529  print(stream);
530  }
531 
532  if (flags.isSet(oneline)) {
533  ccprintf(stream, "%-*s", nameSpaces, name);
534  }
535 
536  for (off_type i = 0; i < size; ++i) {
537  std::stringstream namestr;
538  namestr << base;
539 
540  Counter low = i * data.bucket_size + data.min;
541  Counter high = std::min(low + data.bucket_size - 1.0, data.max);
542  namestr << low;
543  if (low < high)
544  namestr << "-" << high;
545 
546  print.name = namestr.str();
547  print.update(data.cvec[i], total);
548  print(stream, flags.isSet(oneline));
549  }
550 
551  if (flags.isSet(oneline)) {
552  if (descriptions) {
553  if (!desc.empty())
554  ccprintf(stream, " # %s", desc);
555  }
556  printUnits(stream);
557  stream << std::endl;
558  }
559 
560  if (data.type == Dist && data.overflow != Nan) {
561  print.name = base + "overflows";
562  print.update(data.overflow, total);
563  print(stream);
564  }
565 
566  print.pdf = Nan;
567  print.cdf = Nan;
568 
569  if (data.type == Dist && data.min_val != Nan) {
570  print.name = base + "min_value";
571  print.value = data.min_val;
572  print(stream);
573  }
574 
575  if (data.type == Dist && data.max_val != Nan) {
576  print.name = base + "max_value";
577  print.value = data.max_val;
578  print(stream);
579  }
580 
581  print.name = base + "total";
582  print.value = total;
583  print(stream);
584 }
585 
586 void
588 {
589  if (noOutput(info))
590  return;
591 
592  ScalarPrint print(spaces);
593  print.setup(statName(info.name), info.flags, info.precision, descriptions,
594  info.desc, enableUnits, info.unit->getUnitString(), spaces);
595  print.value = info.result();
596  print.pdf = Nan;
597  print.cdf = Nan;
598 
599  print(*stream);
600 }
601 
602 void
604 {
605  if (noOutput(info))
606  return;
607 
608  size_type size = info.size();
609  VectorPrint print(spaces);
610  print.setup(statName(info.name), info.flags, info.precision, descriptions,
611  info.desc, enableUnits, info.unit->getUnitString(), spaces);
612  print.separatorString = info.separatorString;
613  print.vec = info.result();
614  print.total = info.total();
615  print.forceSubnames = false;
616 
617  if (!info.subnames.empty()) {
618  for (off_type i = 0; i < size; ++i) {
619  if (!info.subnames[i].empty()) {
620  print.subnames = info.subnames;
621  print.subnames.resize(size);
622  for (off_type i = 0; i < size; ++i) {
623  if (!info.subnames[i].empty() &&
624  !info.subdescs[i].empty()) {
625  print.subdescs = info.subdescs;
626  print.subdescs.resize(size);
627  break;
628  }
629  }
630  break;
631  }
632  }
633  }
634 
635  print(*stream);
636 }
637 
638 void
640 {
641  if (noOutput(info))
642  return;
643 
644  bool havesub = false;
645  VectorPrint print(spaces);
646  if (!info.y_subnames.empty()) {
647  for (off_type i = 0; i < info.y; ++i) {
648  if (!info.y_subnames[i].empty()) {
649  print.subnames = info.y_subnames;
650  break;
651  }
652  }
653  }
654  print.flags = info.flags;
655  print.separatorString = info.separatorString;
656  print.descriptions = descriptions;
657  print.enableUnits = enableUnits;
658  print.precision = info.precision;
659  print.forceSubnames = true;
660 
661  if (!info.subnames.empty()) {
662  for (off_type i = 0; i < info.x; ++i)
663  if (!info.subnames[i].empty())
664  havesub = true;
665  }
666 
667  VResult tot_vec(info.y);
668  for (off_type i = 0; i < info.x; ++i) {
669  if (havesub && (i >= info.subnames.size() || info.subnames[i].empty()))
670  continue;
671 
672  off_type iy = i * info.y;
673  VResult yvec(info.y);
674 
675  Result total = 0.0;
676  for (off_type j = 0; j < info.y; ++j) {
677  yvec[j] = info.cvec[iy + j];
678  tot_vec[j] += yvec[j];
679  total += yvec[j];
680  }
681 
682  print.name = statName(
683  info.name + "_" +
684  (havesub ? info.subnames[i] : std::to_string(i)));
685  print.desc = info.desc;
686  print.unitStr = info.unit->getUnitString();
687  print.vec = yvec;
688  print.total = total;
689  print(*stream);
690  }
691 
692  // Create a subname for printing the total
693  std::vector<std::string> total_subname;
694  total_subname.push_back("total");
695 
696  if (info.flags.isSet(statistics::total) && (info.x > 1)) {
697  print.name = statName(info.name);
698  print.subnames = total_subname;
699  print.desc = info.desc;
700  print.unitStr = info.unit->getUnitString();
701  print.vec = VResult(1, info.total());
702  print.flags = print.flags & ~total;
703  print(*stream);
704  }
705 }
706 
707 void
708 Text::visit(const DistInfo &info)
709 {
710  if (noOutput(info))
711  return;
712 
713  DistPrint print(this, info);
714  print(*stream);
715 }
716 
717 void
719 {
720  if (noOutput(info))
721  return;
722 
723  for (off_type i = 0; i < info.size(); ++i) {
724  DistPrint print(this, info, i);
725  print(*stream);
726  }
727 }
728 
729 void
731 {
732  visit((const VectorInfo &)info);
733 }
734 
735 /*
736  This struct implements the output methods for the sparse
737  histogram stat
738 */
739 struct SparseHistPrint : public BasePrint
740 {
741  std::string separatorString;
742 
744 
745  SparseHistPrint(const Text *text, const SparseHistInfo &info);
746  void init(const Text *text, const Info &info);
747  void operator()(std::ostream &stream) const;
748 };
749 
750 /* Call initialization function */
752  : data(info.data)
753 {
754  init(text, info);
755 }
756 
757 /* Initialization function */
758 void
759 SparseHistPrint::init(const Text *text, const Info &info)
760 {
761  setup(text->statName(info.name), info.flags, info.precision,
762  text->descriptions, info.desc, text->enableUnits,
763  info.unit->getUnitString(), text->spaces);
765 }
766 
767 /* Grab data from map and write to output stream */
768 void
769 SparseHistPrint::operator()(std::ostream &stream) const
770 {
771  std::string base = name + separatorString;
772 
773  ScalarPrint print(spaces);
774  print.setup(base + "samples", flags, precision, descriptions, desc,
776  print.pdf = Nan;
777  print.cdf = Nan;
778  print.value = data.samples;
779  print(stream);
780 
781  MCounter::const_iterator it;
782  for (it = data.cmap.begin(); it != data.cmap.end(); it++) {
783  std::stringstream namestr;
784  namestr << base;
785 
786  namestr <<(*it).first;
787  print.name = namestr.str();
788  print.value = (*it).second;
789  print(stream);
790  }
791 }
792 
793 void
795 {
796  if (noOutput(info))
797  return;
798 
799  SparseHistPrint print(this, info);
800  print(*stream);
801 }
802 
803 Output *
804 initText(const std::string &filename, bool desc, bool spaces)
805 {
806  static Text text;
807  static bool connected = false;
808 
809  if (!connected) {
810  text.open(*simout.findOrCreate(filename)->stream());
811  text.descriptions = desc;
812  text.enableUnits = desc; // the units are printed if descs are
813  text.spaces = spaces;
814  connected = true;
815  }
816 
817  return &text;
818 }
819 
820 } // namespace statistics
821 } // namespace gem5
gem5::statistics::Text::stream
std::ostream * stream
Definition: text.hh:64
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:189
gem5::statistics::SparseHistPrint::SparseHistPrint
SparseHistPrint(const Text *text, const SparseHistInfo &info)
Definition: text.cc:751
gem5::statistics::DistData::overflow
Counter overflow
Definition: types.hh:76
gem5::statistics::VectorInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:189
gem5::statistics::Text::spaces
bool spaces
Definition: text.hh:75
gem5::statistics::SparseHistPrint::separatorString
std::string separatorString
Definition: text.cc:741
gem5::statistics::Info::precision
int precision
The display precision.
Definition: info.hh:94
gem5::statistics::DistData::min_val
Counter min_val
Definition: types.hh:73
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::DistData::samples
Counter samples
Definition: types.hh:81
gem5::statistics::units::Base::getUnitString
virtual std::string getUnitString() const =0
gem5::statistics::Text::Text
Text()
Definition: text.cc:76
gem5::statistics::ScalarPrint::nameSpaces
int nameSpaces
Definition: text.cc:245
gem5::statistics::Result
double Result
All results are doubles.
Definition: types.hh:56
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::statistics::BasePrint::unitStr
std::string unitStr
Definition: text.cc:210
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::DistData::sum
Counter sum
Definition: types.hh:78
gem5::statistics::VectorInfo
Definition: info.hh:184
gem5::statistics::Text::mystream
bool mystream
Definition: text.hh:63
gem5::statistics::BasePrint::flags
Flags flags
Definition: text.cc:205
gem5::statistics::ScalarPrint::pdf
Result pdf
Definition: text.cc:243
gem5::statistics::VectorInfo::result
virtual const VResult & result() const =0
gem5::statistics::Text::beginGroup
void beginGroup(const char *name) override
Definition: text.cc:153
gem5::statistics::nozero
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:68
gem5::statistics::SparseHistPrint::operator()
void operator()(std::ostream &stream) const
Definition: text.cc:769
sc_dt::to_string
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:91
gem5::statistics::SparseHistData
Data structure of sparse histogram.
Definition: types.hh:85
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:775
gem5::statistics::ScalarPrint::update
void update(Result val, Result total)
Definition: text.cc:270
gem5::simout
OutputDirectory simout
Definition: output.cc:62
gem5::statistics::DistData::cvec
VCounter cvec
Definition: types.hh:77
cast.hh
gem5::statistics::Vector2dInfo::y_subnames
std::vector< std::string > y_subnames
Definition: info.hh:232
gem5::statistics::ScalarInfo
Definition: info.hh:176
gem5::statistics::BasePrint::desc
std::string desc
Definition: text.cc:208
gem5::statistics::VectorPrint::total
Result total
Definition: text.cc:320
std::vector< std::string >
gem5::statistics::ScalarPrint::cdfstrSpaces
int cdfstrSpaces
Definition: text.cc:248
gem5::statistics::nonan
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:70
gem5::statistics::DistPrint
Definition: text.cc:409
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
gem5::statistics::SparseHistPrint::init
void init(const Text *text, const Info &info)
Definition: text.cc:759
gem5::statistics::VectorPrint::VectorPrint
VectorPrint(bool spaces)
Definition: text.cc:325
gem5::statistics::BasePrint::setup
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)
Definition: text.cc:216
gem5::X86ISA::base
Bitfield< 51, 12 > base
Definition: pagetable.hh:141
gem5::statistics::Text::descriptions
bool descriptions
Definition: text.hh:74
gem5::statistics::DistData::max_val
Counter max_val
Definition: types.hh:74
gem5::statistics::VectorPrint::separatorString
std::string separatorString
Definition: text.cc:316
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
gem5::OutputDirectory::findOrCreate
OutputStream * findOrCreate(const std::string &name, bool binary=false)
Definition: output.cc:262
gem5::statistics::BasePrint::precision
int precision
Definition: text.cc:206
gem5::statistics::Info::flags
Flags flags
The formatting flags.
Definition: info.hh:92
gem5::statistics::VResult
std::vector< Result > VResult
vector of results.
Definition: types.hh:58
gem5::ccprintf
void ccprintf(cp::Print &print)
Definition: cprintf.hh:130
gem5::statistics::Text::endGroup
void endGroup() override
Definition: text.cc:163
gem5::statistics::ScalarInfo::result
virtual Result result() const =0
gem5::statistics::BasePrint::spaces
bool spaces
Definition: text.cc:211
str.hh
gem5::statistics::pdf
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:62
gem5::statistics::VectorPrint::subdescs
std::vector< std::string > subdescs
Definition: text.cc:318
gem5::statistics::Hist
@ Hist
Definition: types.hh:63
gem5::statistics::Text::path
std::stack< std::string > path
Definition: text.hh:67
gem5::statistics::VectorPrint::forceSubnames
bool forceSubnames
Definition: text.cc:321
info.hh
gem5::ArmISA::j
Bitfield< 24 > j
Definition: misc_types.hh:57
gem5::Flags< FlagsType >
gem5::OutputStream::stream
std::ostream * stream() const
Get the output underlying output stream.
Definition: output.hh:62
gem5::statistics::Text::begin
void begin() override
Definition: text.cc:131
gem5::high
high
Definition: intmath.hh:176
gem5::statistics::BasePrint::descriptions
bool descriptions
Definition: text.cc:207
gem5::statistics::off_type
unsigned int off_type
Definition: types.hh:61
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::SparseHistData::samples
Counter samples
Definition: types.hh:88
gem5::Flags::isSet
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
Definition: flags.hh:83
gem5::statistics::SparseHistInfo
Definition: info.hh:251
gem5::statistics::DistData::bucket_size
Counter bucket_size
Definition: types.hh:71
gem5::statistics::ScalarPrint::pdfstrSpaces
int pdfstrSpaces
Definition: text.cc:247
gem5::statistics::ScalarPrint::valueSpaces
int valueSpaces
Definition: text.cc:246
gem5::statistics::VectorPrint::VectorPrint
VectorPrint()=delete
gem5::statistics::DistPrint::data
const DistData & data
Definition: text.cc:414
gem5::statistics::Text::~Text
~Text()
Definition: text.cc:92
gem5::statistics::Info::unit
const units::Base * unit
The unit of the stat.
Definition: info.hh:88
gem5::statistics::ScalarPrint::value
Result value
Definition: text.cc:242
gem5::statistics::ValueToString
std::string ValueToString(Result value, int precision)
Definition: text.cc:182
gem5::statistics::Deviation
@ Deviation
Definition: types.hh:63
gem5::statistics::display
const FlagsType display
Print this stat.
Definition: info.hh:58
gem5::statistics::DistPrint::init
void init(const Text *text, const Info &info)
Definition: text.cc:444
gem5::statistics::DistData::min
Counter min
Definition: types.hh:69
gem5::statistics::Text::visit
void visit(const ScalarInfo &info) override
Definition: text.cc:587
gem5::statistics::cdf
const FlagsType cdf
Print the cumulative percentage of total upto this entry.
Definition: info.hh:64
gem5::statistics::Vector2dInfo::total
virtual Result total() const =0
gem5::statistics::Text::end
void end() override
Definition: text.cc:137
gem5::statistics::size_type
unsigned int size_type
Definition: types.hh:60
gem5::statistics::VectorPrint::vec
VResult vec
Definition: text.cc:319
gem5::statistics::VectorPrint::operator()
void operator()(std::ostream &stream) const
Definition: text.cc:338
gem5::statistics::DistPrint::nameSpaces
int nameSpaces
Definition: text.cc:412
gem5::statistics::BasePrint::printUnits
void printUnits(std::ostream &stream) const
Definition: text.cc:232
gem5::statistics::VectorInfo::total
virtual Result total() const =0
gem5::statistics::ScalarPrint::operator()
void operator()(std::ostream &stream, bool oneLine=false) const
Definition: text.cc:280
gem5::statistics::Text::valid
bool valid() const override
Definition: text.cc:125
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::statistics::BasePrint::BasePrint
BasePrint(bool _spaces=false)
Definition: text.cc:213
gem5::statistics::Vector2dInfo::y
size_type y
Definition: info.hh:235
name
const std::string & name()
Definition: trace.cc:49
gem5::statistics::BasePrint::name
std::string name
Definition: text.cc:204
gem5::statistics::VectorPrint
Definition: text.cc:314
gem5::statistics::statsList
std::list< Info * > & statsList()
Definition: statistics.cc:62
gem5::statistics::BasePrint
Definition: text.cc:202
gem5::statistics::Text
Definition: text.hh:60
text.hh
gem5::statistics::SparseHistPrint
Definition: text.cc:739
gem5::statistics::DistData::max
Counter max
Definition: types.hh:70
gem5::statistics::Text::open
void open(std::ostream &stream)
Definition: text.cc:101
gem5::statistics::VectorDistInfo::subdescs
std::vector< std::string > subdescs
Definition: info.hh:215
gem5::statistics::ScalarPrint::cdf
Result cdf
Definition: text.cc:244
gem5::statistics::SparseHistPrint::data
const SparseHistData & data
Definition: text.cc:743
gem5::statistics::DistPrint::DistPrint
DistPrint(const Text *text, const DistInfo &info)
Definition: text.cc:422
gem5::statistics::VectorDistInfo
Definition: info.hh:208
gem5::statistics::VectorInfo::size
virtual size_type size() const =0
gem5::statistics::DistData::logs
Counter logs
Definition: types.hh:80
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::Text::noOutput
bool noOutput(const Info &info)
Definition: text.cc:170
gem5::statistics::DistData::underflow
Counter underflow
Definition: types.hh:75
gem5::statistics::VectorPrint::nameSpaces
int nameSpaces
Definition: text.cc:322
gem5::statistics::DistData::squares
Counter squares
Definition: types.hh:79
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
logging.hh
gem5::statistics::Text::statName
std::string statName(const std::string &name) const
Definition: text.cc:144
gem5::statistics::Dist
@ Dist
Definition: types.hh:63
gem5::statistics::ScalarPrint
Definition: text.cc:240
gem5::statistics::DistData::type
DistType type
Definition: types.hh:68
gem5::statistics::VectorPrint::subnames
std::vector< std::string > subnames
Definition: text.cc:317
gem5::statistics::Info::separatorString
static std::string separatorString
The separator string used for vectors, dist, etc.
Definition: info.hh:86
std::list
STL list class.
Definition: stl.hh:51
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::DistPrint::separatorString
std::string separatorString
Definition: text.cc:411
gem5::statistics::BasePrint::enableUnits
bool enableUnits
Definition: text.cc:209
gem5::statistics::Text::enableUnits
bool enableUnits
Definition: text.hh:73
gem5::statistics::initText
Output * initText(const std::string &filename, bool desc, bool spaces)
Definition: text.cc:804
gem5::statistics::ScalarPrint::ScalarPrint
ScalarPrint(bool spaces)
Definition: text.cc:250
gem5::statistics::Vector2dInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:230
gem5::statistics::DistPrint::operator()
void operator()(std::ostream &stream) const
Definition: text.cc:458
gem5::statistics::VectorInfo::subnames
std::vector< std::string > subnames
Names and descriptions of subfields.
Definition: info.hh:188
gem5::statistics::Info::name
std::string name
The name of the stat.
Definition: info.hh:84
gem5::statistics::SparseHistData::cmap
MCounter cmap
Definition: types.hh:87
gem5::statistics::FormulaInfo
Definition: info.hh:245
gem5::statistics::Vector2dInfo
Definition: info.hh:226
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:177
gem5::statistics::Info
Definition: info.hh:80

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