From 10cccabd156907a65fc540689d9633bda0981d6f Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Sun, 17 Jan 2021 20:43:58 -0800 Subject: [PATCH] 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 Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/python/pybind11/stats.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/python/pybind11/stats.cc b/src/python/pybind11/stats.cc index d07ccbfabd..50013cf98c 100644 --- a/src/python/pybind11/stats.cc +++ b/src/python/pybind11/stats.cc @@ -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_>( + 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_>( m, "DistInfo")