Go to the documentation of this file.
41 #include "config/use_hdf5.hh"
43 #include "pybind11/pybind11.h"
44 #include "pybind11/stl.h"
55 namespace py = pybind11;
57 static const py::object
63 #define TRY_CAST(T) do { \
64 auto _stat = dynamic_cast<const T *>(info); \
66 return py::cast(_stat); \
78 return py::cast(info);
88 py::module_
m = py::module_::import(
"m5.stats");
95 py::module_
m = py::module_::import(
"m5.stats");
104 py::module_
m = m_native.def_submodule(
"stats");
112 .def(
"registerPythonStatsHandlers",
124 py::class_<Stats::Output>(
m,
"Output")
132 py::class_<Stats::Info, std::unique_ptr<Stats::Info, py::nodelete>>(
135 .def_property_readonly(
"unit", [](
const Stats::Info &info) {
140 .def_property_readonly(
"flags", [](
const Stats::Info &info) {
153 std::unique_ptr<Stats::ScalarInfo, py::nodelete>>(
167 std::unique_ptr<Stats::VectorInfo, py::nodelete>>(
186 std::unique_ptr<Stats::FormulaInfo, py::nodelete>>(
194 std::unique_ptr<Stats::DistInfo, py::nodelete>>(
202 .def_property_readonly(
"bucket_size", [](
const Stats::DistInfo &info) {
225 py::class_<Stats::Group, std::unique_ptr<Stats::Group, py::nodelete>>(
233 auto stats =
self.getStats();
235 py_stats.reserve(stats.size());
236 std::transform(stats.begin(), stats.end(),
237 std::back_inserter(py_stats),
244 const std::string &
name) -> py::object {
247 throw pybind11::key_error(
"Unknown stat name");
virtual void regStats()
Callback to set stat parameters.
virtual bool zero() const =0
virtual const VCounter & value() const =0
virtual void visit(Output &visitor)=0
Visitor entry for outputing statistics data.
virtual void endGroup()=0
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
virtual void beginGroup(const char *name)=0
void periodicStatDump(Tick period)
Schedule periodic statistics dumping.
const std::map< std::string, Group * > & getStatGroups() const
Get all child groups associated with this object.
virtual void preDumpStats()
Callback before stats are dumped.
void pybind_init_stats(py::module_ &m_native)
virtual Result result() const =0
void registerPythonStatsHandlers()
Register py_...
virtual Result total() const =0
virtual bool check() const =0
Check that this stat has been set up properly and is ready for use.
virtual void resetStats()
Callback to reset stats.
virtual void enable()
Enable the stat for use.
virtual Counter value() const =0
const Units::Base * unit
The unit of the stat.
virtual Result total() const =0
virtual const VResult & result() const =0
std::vector< std::string > subdescs
virtual void prepare()=0
Prepare the stat for dumping.
void updateEvents()
Update the events after resuming from a checkpoint.
std::list< Info * > & statsList()
virtual void reset()=0
Reset the stat to the default state.
virtual size_type size() const =0
static const py::object cast_stat_info(const Stats::Info *info)
const std::string & name()
void schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
Schedule statistics dumping.
std::vector< std::string > subnames
Names and descriptions of subfields.
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
virtual bool valid() const =0
Flags flags
The formatting flags.
std::string name
The name of the stat.
std::unique_ptr< Output > initHDF5(const std::string &filename, unsigned chunking, bool desc, bool formulas)
virtual std::string getUnitString() const =0
DistData data
Local storage for the entry values, used for printing.
std::string desc
The description of the stat.
Output * initText(const std::string &filename, bool desc, bool spaces)
void addStatGroup(const char *name, Group *block)
Add a stat block as a child of this block.
Generated on Tue Jun 22 2021 15:28:26 for gem5 by doxygen 1.8.17