changeset 648b62f95015 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=648b62f95015
description:
stats: Provide a mechanism to get a callback when stats are dumped.
This mechanism is useful for dumping output that is correlated with
stats
dumping, but isn't tracked by the gem5 statistics.
diffstat:
src/base/statistics.cc | 7 +++++++
src/base/statistics.hh | 6 ++++++
src/python/m5/stats/__init__.py | 2 ++
src/python/swig/stats.i | 8 ++++++++
4 files changed, 23 insertions(+), 0 deletions(-)
diffs (77 lines):
diff -r c7d6e967e692 -r 648b62f95015 src/base/statistics.cc
--- a/src/base/statistics.cc Tue Jun 05 01:23:08 2012 -0400
+++ b/src/base/statistics.cc Tue Jun 05 01:23:08 2012 -0400
@@ -433,6 +433,7 @@
return root ? root->str() : "";
}
+CallbackQueue dumpQueue;
CallbackQueue resetQueue;
void
@@ -458,6 +459,12 @@
_enabled = true;
}
+void
+registerDumpCallback(Callback *cb)
+{
+ dumpQueue.add(cb);
+}
+
} // namespace Stats
void
diff -r c7d6e967e692 -r 648b62f95015 src/base/statistics.hh
--- a/src/base/statistics.hh Tue Jun 05 01:23:08 2012 -0400
+++ b/src/base/statistics.hh Tue Jun 05 01:23:08 2012 -0400
@@ -3135,6 +3135,12 @@
*/
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 -r c7d6e967e692 -r 648b62f95015 src/python/m5/stats/__init__.py
--- a/src/python/m5/stats/__init__.py Tue Jun 05 01:23:08 2012 -0400
+++ b/src/python/m5/stats/__init__.py Tue Jun 05 01:23:08 2012 -0400
@@ -103,6 +103,8 @@
return
lastDump = curTick
+ internal.stats.processDumpQueue()
+
prepare()
for output in outputList:
diff -r c7d6e967e692 -r 648b62f95015 src/python/swig/stats.i
--- a/src/python/swig/stats.i Tue Jun 05 01:23:08 2012 -0400
+++ b/src/python/swig/stats.i Tue Jun 05 01:23:08 2012 -0400
@@ -71,6 +71,13 @@
resetQueue.process();
}
+inline void
+processDumpQueue()
+{
+ extern CallbackQueue dumpQueue;
+ dumpQueue.process();
+}
+
inline char *
PCC(const char *string)
{
@@ -146,6 +153,7 @@
Tick when = curTick(), Tick repeat = 0);
void processResetQueue();
+void processDumpQueue();
void enable();
bool enabled();
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev