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>
This commit is contained in:
@@ -67,6 +67,7 @@ cast_stat_info(const Stats::Info *info)
|
||||
} while (0)
|
||||
|
||||
TRY_CAST(Stats::ScalarInfo);
|
||||
TRY_CAST(Stats::VectorInfo);
|
||||
TRY_CAST(Stats::DistInfo);
|
||||
|
||||
return py::cast(info);
|
||||
@@ -148,6 +149,25 @@ pybind_init_stats(py::module_ &m_native)
|
||||
.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")
|
||||
|
||||
Reference in New Issue
Block a user