From a91c1e69a880dd6eec3cc980801ea18ddcbe7c31 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Thu, 26 Nov 2015 10:11:57 +0000 Subject: sim: Add support for forking This changeset adds forking capabilities to the gem5 python scripts. A fork method is added to simulate.py. This method is responsible for forking the simulator itself, and will direct all output files to a new output directory based on the fork sequence number. The default name of the output directory is the same as the parent with the suffix ".fN" added where N is the fork sequence number. The fork method provides the option to specify if the system should be drained prior to forking, or not. By default the system is drained to ensure that there are no in-flight transactions. When forking the simulator, the fork method returns the PID of the child process, or returns 0 if running in the child. This is in line with the standard Python forking interface. Signed-off-by: Andreas Sandberg [sascha.bischoff@arm.com: Rebased patches onto a newer gem5 version] Signed-off-by: Sascha Bischoff [andreas.sandberg@arm.com: Updated to comply with modern draining semantics ] Signed-off-by: Andreas Sandberg --- src/python/swig/core.i | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/python/swig/core.i') diff --git a/src/python/swig/core.i b/src/python/swig/core.i index 862c0e37e..08fbe01d1 100644 --- a/src/python/swig/core.i +++ b/src/python/swig/core.i @@ -55,6 +55,8 @@ const bool flag_TRACING_ON = TRACING_ON; inline void disableAllListeners() { ListenSocket::disableAll(); } +inline bool listenersDisabled() { return ListenSocket::allDisabled(); } + inline void seedRandom(uint64_t seed) { @@ -71,6 +73,7 @@ seedRandom(uint64_t seed) void setOutputDir(const std::string &dir); void doExitCleanup(); void disableAllListeners(); +bool listenersDisabled(); void seedRandom(uint64_t seed); %immutable compileDate; -- cgit v1.2.3