summaryrefslogtreecommitdiff
path: root/src/python/m5/util
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2016-11-28 16:40:45 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-03-21 10:30:02 +0000
commit7110d2313e44bf4b611534bbc921ec9808476a37 (patch)
treeaf438d63af1c2c2f0a99b71908beb761033b1e60 /src/python/m5/util
parent065bb8c65569004704183ee0eb9eb1b55b9ed574 (diff)
downloadgem5-7110d2313e44bf4b611534bbc921ec9808476a37.tar.xz
python: Automatically disable listeners in batch setups
Determine if gem5 is running in a batch environment by checking if STDIN is wired to a TTY or not. If the simulator is running in a batch environment, disable all listeners by default. This behavior can be overridden using the --enable-listeners option. Change-Id: I404c709135339144216bf08a2769c016c543333c Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Sean McGoogan <sean.mcgoogan@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2322 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/python/m5/util')
-rw-r--r--src/python/m5/util/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py
index a832f0e93..573674879 100644
--- a/src/python/m5/util/__init__.py
+++ b/src/python/m5/util/__init__.py
@@ -1,3 +1,15 @@
+# Copyright (c) 2016 ARM Limited
+# All rights reserved.
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder. You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
# Copyright (c) 2008-2009 The Hewlett-Packard Development Company
# Copyright (c) 2004-2006 The Regents of The University of Michigan
# All rights reserved.
@@ -195,3 +207,8 @@ def makeDir(path):
raise AttributeError, "%s exists but is not directory" % path
else:
os.mkdir(path)
+
+def isInteractive():
+ """Check if the simulator is run interactively or in a batch environment"""
+
+ return sys.__stdin__.isatty()