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.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,11 @@ cast_stat_info(const Stats::Info *info)
|
||||
} 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 @@ pybind_init_stats(py::module_ &m_native)
|
||||
})
|
||||
;
|
||||
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user