Go to the documentation of this file.
41 #include "pybind11/pybind11.h"
42 #include "pybind11/stl.h"
46 #include "config/have_hdf5.hh"
55 namespace py = pybind11;
60 static const py::object
66 #define TRY_CAST(T) do { \
67 auto _stat = dynamic_cast<const T *>(info); \
69 return py::cast(_stat); \
81 return py::cast(info);
93 py::module_
m = py::module_::import(
"m5.stats");
100 py::module_
m = py::module_::import(
"m5.stats");
109 py::module_
m = m_native.def_submodule(
"stats");
114 py::return_value_policy::reference)
118 .def(
"registerPythonStatsHandlers",
130 py::class_<statistics::Output>(
m,
"Output")
139 std::unique_ptr<statistics::Info, py::nodelete>>(
m,
"Info")
159 std::unique_ptr<statistics::ScalarInfo, py::nodelete>>(
161 .def_property_readonly(
"value",
163 .def_property_readonly(
"result",
165 .def_property_readonly(
"total",
170 std::unique_ptr<statistics::VectorInfo, py::nodelete>>(
174 .def_property_readonly(
"size",
176 .def_property_readonly(
"value",
178 .def_property_readonly(
"result",
180 .def_property_readonly(
"total",
185 std::unique_ptr<statistics::FormulaInfo, py::nodelete>>(
187 .def_property_readonly(
"str",
192 std::unique_ptr<statistics::DistInfo, py::nodelete>>(
194 .def_property_readonly(
"min_val",
196 .def_property_readonly(
"max_val",
198 .def_property_readonly(
"bucket_size",
202 .def_property_readonly(
"values",
204 .def_property_readonly(
"overflow",
208 .def_property_readonly(
"underflow",
212 .def_property_readonly(
"sum",
214 .def_property_readonly(
"logs",
216 .def_property_readonly(
"squares",
221 std::unique_ptr<statistics::Group, py::nodelete>>(
m,
"Group")
228 auto stats =
self.getStats();
230 py_stats.reserve(stats.size());
231 std::transform(stats.begin(), stats.end(),
232 std::back_inserter(py_stats),
239 const std::string &
name) -> py::object {
242 throw pybind11::key_error(
"Unknown stat name");
virtual bool check() const =0
Check that this stat has been set up properly and is ready for use.
std::vector< std::string > subdescs
virtual void enable()
Enable the stat for use.
virtual std::string getUnitString() const =0
void registerPythonStatsHandlers()
Register py_...
virtual void endGroup()=0
virtual void visit(Output &visitor)=0
Visitor entry for outputing statistics data.
virtual bool zero() const =0
virtual const VResult & result() const =0
void pybind_init_stats(pybind11::module_ &m_native)
virtual bool valid() const =0
virtual const VCounter & value() const =0
void updateEvents()
Update the events after resuming from a checkpoint.
virtual void resetStats()
Callback to reset stats.
Flags flags
The formatting flags.
static const py::object cast_stat_info(const statistics::Info *info)
virtual void reset()=0
Reset the stat to the default state.
virtual Result result() const =0
virtual Result total() const =0
virtual void prepare()=0
Prepare the stat for dumping.
const units::Base * unit
The unit of the stat.
DistData data
Local storage for the entry values, used for printing.
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
void addStatGroup(const char *name, Group *block)
Add a stat block as a child of this block.
std::unique_ptr< Output > initHDF5(const std::string &filename, unsigned chunking, bool desc, bool formulas)
virtual Result total() const =0
virtual void beginGroup(const char *name)=0
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
const std::string & name()
virtual void regStats()
Callback to set stat parameters.
std::list< Info * > & statsList()
void periodicStatDump(Tick period)
Schedule periodic statistics dumping.
virtual size_type size() const =0
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
std::string desc
The description of the stat.
virtual Counter value() const =0
const std::map< std::string, Group * > & getStatGroups() const
Get all child groups associated with this object.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Output * initText(const std::string &filename, bool desc, bool spaces)
void schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
Schedule statistics dumping.
virtual void preDumpStats()
Callback before stats are dumped.
std::vector< std::string > subnames
Names and descriptions of subfields.
std::string name
The name of the stat.
Generated on Sat Jun 18 2022 08:12:20 for gem5 by doxygen 1.8.17