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+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
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:
         """