Statistics: Add a function to configure periodic stats dumping

This patch adds a function, periodicStatDump(long long period), which will dump
and reset the statistics every period. This function is designed to be called
from the python configuration scripts. This allows the periodic stats dumping to
be configured more easilly at run time.

The period is currently specified as a long long as there are issues passing
Tick into the C++ from the python as they have conflicting definitions. If the
period is less than curTick, the first occurance occurs at curTick. If the
period is set to 0, then the event is descheduled and the stats are not
periodically dumped.

Due to issues when resumung from a checkpoint, the StatDump event must be moved
forward such that it occues AFTER the current tick. As the function is called
from the python, the event is scheduled before the system resumes from the
checkpoint. Therefore, the event is moved using the updateEvents() function.
This is called from simulate.py once the system has resumed from the checkpoint.

NOTE: It should be noted that this is a fairly temporary patch which re-adds the
capability to extract temporal information  from the communication monitors. It
should not be used at the same time as anything that relies on dumping the
statistics based on in simulation events i.e. a context switch.
This commit is contained in:
Sascha Bischoff
2012-09-25 11:49:41 -05:00
parent acbb7a2eed
commit 74ab69c7ea
4 changed files with 113 additions and 2 deletions

View File

@@ -52,6 +52,7 @@ import SimObject
import ticks
import objects
from m5.util.dot_writer import do_dot
from m5.internal.stats import updateEvents as updateStatEvents
from util import fatal
from util import attrdict
@@ -123,6 +124,10 @@ def instantiate(ckpt_dir=None):
else:
for obj in root.descendants(): obj.initState()
# Check to see if any of the stat events are in the past after resuming from
# a checkpoint, If so, this call will shift them to be at a valid time.
updateStatEvents()
# Reset to put the stats in a consistent state.
stats.reset()

View File

@@ -152,6 +152,10 @@ Output *initText(const std::string &filename, bool desc);
void schedStatEvent(bool dump, bool reset,
Tick when = curTick(), Tick repeat = 0);
void periodicStatDump(long long period = 0);
void updateEvents();
void processResetQueue();
void processDumpQueue();
void enable();