Bobby Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/63272?usp=email )
(
7 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: stdlib: Add 'get_simstats' function to simulator
......................................................................
stdlib: Add 'get_simstats' function to simulator
Change-Id: Iedf937a66f33c5a5feada4ffbf550540f65680d1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63272
Tested-by: kokoro <noreply+kok...@google.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
---
M src/python/gem5/simulate/simulator.py
1 file changed, 29 insertions(+), 4 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/python/gem5/simulate/simulator.py
b/src/python/gem5/simulate/simulator.py
index 5a4ab17..8be915e 100644
--- a/src/python/gem5/simulate/simulator.py
+++ b/src/python/gem5/simulate/simulator.py
@@ -27,7 +27,7 @@
import m5
import m5.ticks
from m5.stats import addStatVisitor
-from m5.stats.gem5stats import get_simstat
+from m5.ext.pystats.simstat import SimStat
from m5.objects import Root
from m5.util import warn
@@ -275,8 +275,20 @@
Obtain the current simulation statistics as a Dictionary,
conforming
to a JSON-style schema.
- **Warning:** Will throw an Exception if called before `run()`. The
- board must be initialized before obtaining statistics
+ :raises Exception: An exception is raised if this function is
called
+ before `run()`. The board must be initialized before obtaining
+ statistics.
+ """
+
+ return self.get_simstats().to_json()
+
+ def get_simstats(self) -> SimStat:
+ """
+ Obtains the SimStat of the current simulation.
+
+ :raises Exception: An exception is raised if this function is
called
+ before `run()`. The board must be initialized before obtaining
+ statistics.
"""
if not self._instantiated:
@@ -284,7 +296,7 @@
"Cannot obtain simulation statistics prior to
inialization."
)
- return get_simstat(self._root).to_json()
+ return m5.stats.gem5stats.get_simstat(self._root)
def add_text_stats_output(self, path: str) -> None:
"""
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/63272?usp=email
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: Iedf937a66f33c5a5feada4ffbf550540f65680d1
Gerrit-Change-Number: 63272
Gerrit-PatchSet: 15
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
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