Bobby R. Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/39298 )

Change subject: base-stats,python: Expose DistInfo via Pybind11
......................................................................

base-stats,python: Expose DistInfo via Pybind11

Change-Id: If3ac9a0da52b929559e3cde3c2bab95b59ab16ce
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39298
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/python/pybind11/stats.cc
1 file changed, 33 insertions(+), 0 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/python/pybind11/stats.cc b/src/python/pybind11/stats.cc
index 5d52872..d07ccbf 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::DistInfo);

     return py::cast(info);

@@ -147,6 +148,38 @@
         .def("total", &Stats::ScalarInfo::total)
         ;

+    py::class_<Stats::DistInfo, Stats::Info,
+                std::unique_ptr<Stats::DistInfo, py::nodelete>>(
+                    m, "DistInfo")
+        .def_property_readonly("min_val", [](const Stats::DistInfo &info) {
+                return info.data.min_val;
+            })
+        .def_property_readonly("max_val", [](const Stats::DistInfo &info) {
+                return info.data.max_val;
+            })
+ .def_property_readonly("bucket_size", [](const Stats::DistInfo &info) {
+                return info.data.bucket_size;
+            })
+        .def_property_readonly("values", [](const Stats::DistInfo &info) {
+                return info.data.cvec;
+            })
+ .def_property_readonly("overflow", [](const Stats::DistInfo &info) {
+                return info.data.overflow;
+            })
+ .def_property_readonly("underflow", [](const Stats::DistInfo &info) {
+                return info.data.underflow;
+            })
+        .def_property_readonly("sum", [](const Stats::DistInfo &info) {
+                return info.data.sum;
+            })
+        .def_property_readonly("logs", [](const Stats::DistInfo &info) {
+                return info.data.logs;
+            })
+        .def_property_readonly("squares", [](const Stats::DistInfo &info) {
+                return info.data.squares;
+            })
+        ;
+
     py::class_<Stats::Group, std::unique_ptr<Stats::Group, py::nodelete>>(
         m, "Group")
         .def("regStats", &Stats::Group::regStats)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39298
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If3ac9a0da52b929559e3cde3c2bab95b59ab16ce
Gerrit-Change-Number: 39298
Gerrit-PatchSet: 5
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Ciro Santilli <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to