Skip to main content

Getting Started

You can begin using the statistics API by adding the following code to your configuration file:

### ....
### The rest of your configuration

from m5.stats.gem5stats import get_simstat

simstats = get_simstat(system)

### Do stuff with the stats

Once you have the simstats, you can access all information that would normally be printed to the stats.txt file as a python dictionary or by accessing elements like how you created your system:

print(simstats.cpu[0].numCycles)  # prints the number of cycles cpu[0] executed
print(simstats['cpu'][0]['numCycles']) # same as the above