base-stats,python: Expose VectorInfo via Pybind11
Change-Id: Iba5fd1dfd1e4c35f01bf4a6fc28481c1be3dd028
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39299
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/python/pybind11/stats.cc b/src/python/pybind11/stats.cc
index d07ccbf..50013cf 100644
--- a/src/python/pybind11/stats.cc
+++ b/src/python/pybind11/stats.cc
@@ -67,6 +67,7 @@
} while (0)
TRY_CAST(Stats::ScalarInfo);
+ TRY_CAST(Stats::VectorInfo);
TRY_CAST(Stats::DistInfo);
return py::cast(info);
@@ -148,6 +149,25 @@
.def("total", &Stats::ScalarInfo::total)
;
+ py::class_<Stats::VectorInfo, Stats::Info,
+ std::unique_ptr<Stats::VectorInfo, py::nodelete>>(
+ m, "VectorInfo")
+ .def_readwrite("subnames", &Stats::VectorInfo::subnames)
+ .def_readwrite("subdescs", &Stats::VectorInfo::subdescs)
+ .def_property_readonly("size", [](const Stats::VectorInfo &info) {
+ return info.size();
+ })
+ .def_property_readonly("value", [](const Stats::VectorInfo &info) {
+ return info.value();
+ })
+ .def_property_readonly("result", [](const Stats::VectorInfo &info) {
+ return info.result();
+ })
+ .def_property_readonly("total", [](const Stats::VectorInfo &info) {
+ return info.total();
+ })
+ ;
+
py::class_<Stats::DistInfo, Stats::Info,
std::unique_ptr<Stats::DistInfo, py::nodelete>>(
m, "DistInfo")