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

Change subject: base-stats,python: Expose FormulaInfo via PyBind11
......................................................................

base-stats,python: Expose FormulaInfo via PyBind11

Change-Id: If7d3e7a386e138d5f4e05bb1ec4b920d6caef836
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39300
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/python/pybind11/stats.cc
1 file changed, 13 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 50013cf..e6912e2 100644
--- a/src/python/pybind11/stats.cc
+++ b/src/python/pybind11/stats.cc
@@ -67,6 +67,11 @@
     } while (0)

     TRY_CAST(Stats::ScalarInfo);
+    /* FormulaInfo is a subclass of VectorInfo. Therefore, a cast to
+     * FormulaInfo must be attempted before a cast to VectorInfo. Otherwise
+     * instances of ForumlaInfo will be cast to VectorInfo.
+     */
+    TRY_CAST(Stats::FormulaInfo);
     TRY_CAST(Stats::VectorInfo);
     TRY_CAST(Stats::DistInfo);

@@ -168,6 +173,14 @@
             })
         ;

+    py::class_<Stats::FormulaInfo, Stats::VectorInfo,
+               std::unique_ptr<Stats::FormulaInfo, py::nodelete>>(
+                      m, "FormulaInfo")
+        .def_property_readonly("str", [](const Stats::FormulaInfo &info) {
+                return info.str();
+            })
+        ;
+
     py::class_<Stats::DistInfo, Stats::Info,
                 std::unique_ptr<Stats::DistInfo, py::nodelete>>(
                     m, "DistInfo")

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39300
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: If7d3e7a386e138d5f4e05bb1ec4b920d6caef836
Gerrit-Change-Number: 39300
Gerrit-PatchSet: 6
Gerrit-Owner: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Ciro Santilli <ciro.santi...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to