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); \
71 return py::cast(info);
81 py::module
m = py::module::import(
"m5.stats");
88 py::module
m = py::module::import(
"m5.stats");
97 py::module
m = m_native.def_submodule(
"stats");
105 .def(
"registerPythonStatsHandlers",
117 py::class_<Stats::Output>(
m,
"Output")
125 py::class_<Stats::Info, std::unique_ptr<Stats::Info, py::nodelete>>(
130 .def_property_readonly(
"flags", [](
const Stats::Info &info) {
143 std::unique_ptr<Stats::ScalarInfo, py::nodelete>>(
150 py::class_<Stats::Group, std::unique_ptr<Stats::Group, py::nodelete>>(
158 auto stats =
self.getStats();
160 py_stats.reserve(stats.size());
161 std::transform(stats.begin(), stats.end(),
162 std::back_inserter(py_stats),
169 const std::string &
name) -> py::object {
172 throw pybind11::key_error(
"Unknown stat name");
virtual void regStats()
Callback to set stat parameters.
virtual bool zero() 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.
Output * initText(const string &filename, bool desc, bool spaces)
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.
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
virtual void prepare()=0
Prepare the stat for dumping.
void updateEvents()
Update the events after resuming from a checkpoint.
list< Info * > & statsList()
virtual void reset()=0
Reset the stat to the default state.
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.
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)
std::string desc
The description of the stat.
void pybind_init_stats(py::module &m_native)
void addStatGroup(const char *name, Group *block)
Add a stat block as a child of this block.
Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17