summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base/statistics.cc7
-rw-r--r--src/base/statistics.hh6
-rw-r--r--src/python/m5/stats/__init__.py2
-rw-r--r--src/python/swig/stats.i8
4 files changed, 23 insertions, 0 deletions
diff --git a/src/base/statistics.cc b/src/base/statistics.cc
index 545d08cab..8034625be 100644
--- a/src/base/statistics.cc
+++ b/src/base/statistics.cc
@@ -433,6 +433,7 @@ Formula::str() const
return root ? root->str() : "";
}
+CallbackQueue dumpQueue;
CallbackQueue resetQueue;
void
@@ -458,6 +459,12 @@ enable()
_enabled = true;
}
+void
+registerDumpCallback(Callback *cb)
+{
+ dumpQueue.add(cb);
+}
+
} // namespace Stats
void
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 67c09bb6a..c36f8f461 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -3135,6 +3135,12 @@ bool enabled();
*/
void registerResetCallback(Callback *cb);
+/**
+ * Register a callback that should be called whenever statistics are
+ * about to be dumped
+ */
+void registerDumpCallback(Callback *cb);
+
std::list<Info *> &statsList();
} // namespace Stats
diff --git a/src/python/m5/stats/__init__.py b/src/python/m5/stats/__init__.py
index 1d7e3bc5d..765f9a634 100644
--- a/src/python/m5/stats/__init__.py
+++ b/src/python/m5/stats/__init__.py
@@ -103,6 +103,8 @@ def dump():
return
lastDump = curTick
+ internal.stats.processDumpQueue()
+
prepare()
for output in outputList:
diff --git a/src/python/swig/stats.i b/src/python/swig/stats.i
index 14a6966b1..5a6910fa6 100644
--- a/src/python/swig/stats.i
+++ b/src/python/swig/stats.i
@@ -71,6 +71,13 @@ processResetQueue()
resetQueue.process();
}
+inline void
+processDumpQueue()
+{
+ extern CallbackQueue dumpQueue;
+ dumpQueue.process();
+}
+
inline char *
PCC(const char *string)
{
@@ -146,6 +153,7 @@ void schedStatEvent(bool dump, bool reset,
Tick when = curTick(), Tick repeat = 0);
void processResetQueue();
+void processDumpQueue();
void enable();
bool enabled();