python: Add support for introspecting scalar stats
authorAndreas Sandberg <andreas.sandberg@arm.com>
Fri, 21 Aug 2020 14:55:53 +0000 (15:55 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Fri, 28 Aug 2020 09:27:58 +0000 (09:27 +0000)
commitd6a37c466061be4d51b2fd60ca21c480dbe2a4dd
treefb7fe05b0e3b274ec3cc425c3a71bbac683c9d00
parentc9f613a84f565494f394d97b7b70cd1de8a0fb3f
python: Add support for introspecting scalar stats

This change adds a wrapper for the ScalarInfo stat type to enable
introspection of scalar stats from Python. Due to the slightly
confusing use of proxy objects in the stat system, PyBind11 fails to
automatically cast to the right wrapper type. This is worked around in
the by explicitly casting to the relevant type's Python wrapper.

To make the interface more Python-friendly, this change also changes
the semantics of resolveStat to raise an exception if the stat can't
be found.

Change-Id: If1fc6fe238fc9d69d4e22369a4988a06407d2f7c
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33176
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/python/pybind11/stats.cc