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);
92 py::module_
m = py::module_::import(
"m5.stats");
99 py::module_
m = py::module_::import(
"m5.stats");
108 py::module_
m = m_native.def_submodule(
"stats");
113 py::return_value_policy::reference)
117 .def(
"registerPythonStatsHandlers",
129 py::class_<statistics::Output>(
m,
"Output")
138 std::unique_ptr<statistics::Info, py::nodelete>>(
m,
"Info")
158 std::unique_ptr<statistics::ScalarInfo, py::nodelete>>(
160 .def_property_readonly(
"value",
162 .def_property_readonly(
"result",
164 .def_property_readonly(
"total",
169 std::unique_ptr<statistics::VectorInfo, py::nodelete>>(
173 .def_property_readonly(
"size",
175 .def_property_readonly(
"value",
177 .def_property_readonly(
"result",
179 .def_property_readonly(
"total",
184 std::unique_ptr<statistics::FormulaInfo, py::nodelete>>(
186 .def_property_readonly(
"str",
191 std::unique_ptr<statistics::DistInfo, py::nodelete>>(
193 .def_property_readonly(
"min_val",
195 .def_property_readonly(
"max_val",
197 .def_property_readonly(
"bucket_size",
201 .def_property_readonly(
"values",
203 .def_property_readonly(
"overflow",
207 .def_property_readonly(
"underflow",
211 .def_property_readonly(
"sum",
213 .def_property_readonly(
"logs",
215 .def_property_readonly(
"squares",
220 std::unique_ptr<statistics::Group, py::nodelete>>(
m,
"Group")
227 auto stats =
self.getStats();
229 py_stats.reserve(stats.size());
230 std::transform(stats.begin(), stats.end(),
231 std::back_inserter(py_stats),
238 const std::string &
name) -> py::object {
241 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
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 Sun Jul 30 2023 01:56:52 for gem5 by doxygen 1.8.17