diff options
author | Andrew Bardsley <Andrew.Bardsley@arm.com> | 2014-10-16 05:49:32 -0400 |
---|---|---|
committer | Andrew Bardsley <Andrew.Bardsley@arm.com> | 2014-10-16 05:49:32 -0400 |
commit | d8502ee46d356830698d7b96b29e4b27906a2d79 (patch) | |
tree | c7d052a7e276126bd1630658b386ac715f75238d /src/base | |
parent | a63ba6c7b7fe6620478c0d8d7812661c6a36d55a (diff) | |
download | gem5-d8502ee46d356830698d7b96b29e4b27906a2d79.tar.xz |
config: Add a --without-python option to build process
Add the ability to build libgem5 without embedded Python or the
ability to configure with Python.
This is a prelude to a patch to allow config.ini files to be loaded
into libgem5 using only C++ which would make embedding gem5 within
other simulation systems easier.
This adds a few registration interfaces to things which cross
between Python and C++. Namely: stats dumping and SimObject resolving
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/statistics.cc | 40 | ||||
-rw-r--r-- | src/base/statistics.hh | 19 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/base/statistics.cc b/src/base/statistics.cc index 2bd34d3db..5ab837410 100644 --- a/src/base/statistics.cc +++ b/src/base/statistics.cc @@ -462,10 +462,32 @@ Formula::str() const return root ? root->str() : ""; } +Handler resetHandler = NULL; +Handler dumpHandler = NULL; + +void +registerHandlers(Handler reset_handler, Handler dump_handler) +{ + resetHandler = reset_handler; + dumpHandler = dump_handler; +} + CallbackQueue dumpQueue; CallbackQueue resetQueue; void +processResetQueue() +{ + resetQueue.process(); +} + +void +processDumpQueue() +{ + dumpQueue.process(); +} + +void registerResetCallback(Callback *cb) { resetQueue.add(cb); @@ -489,6 +511,24 @@ enable() } void +dump() +{ + if (dumpHandler) + dumpHandler(); + else + fatal("No registered Stats::dump handler"); +} + +void +reset() +{ + if (resetHandler) + resetHandler(); + else + fatal("No registered Stats::reset handler"); +} + +void registerDumpCallback(Callback *cb) { dumpQueue.add(cb); diff --git a/src/base/statistics.hh b/src/base/statistics.hh index a6edde2f9..f4b12e847 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -3209,6 +3209,15 @@ void enable(); bool enabled(); /** + * Register reset and dump handlers. These are the functions which + * will actually perform the whole statistics reset/dump actions + * including processing the reset/dump callbacks + */ +typedef void (*Handler)(); + +void registerHandlers(Handler reset_handler, Handler dump_handler); + +/** * Register a callback that should be called whenever statistics are * reset */ @@ -3220,6 +3229,16 @@ void registerResetCallback(Callback *cb); */ void registerDumpCallback(Callback *cb); +/** + * Process all the callbacks in the reset callbacks queue + */ +void processResetQueue(); + +/** + * Process all the callbacks in the dump callbacks queue + */ +void processDumpQueue(); + std::list<Info *> &statsList(); typedef std::map<const void *, Info *> MapType; |