summaryrefslogtreecommitdiffstats
path: root/testing/framework
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2021-02-08 20:24:06 (GMT)
committerMats Wichmann <mats@linux.com>2021-02-08 20:24:06 (GMT)
commitfb7bb3f969698cbbcdb5af7c97f33c4529ba2e09 (patch)
tree761a6bc94e9bf285bfe1563dd44129ccc09b1ea7 /testing/framework
parent4dbccd6e784a4ea0c79972e79cef1b22ca3d6716 (diff)
downloadSCons-fb7bb3f969698cbbcdb5af7c97f33c4529ba2e09.zip
SCons-fb7bb3f969698cbbcdb5af7c97f33c4529ba2e09.tar.gz
SCons-fb7bb3f969698cbbcdb5af7c97f33c4529ba2e09.tar.bz2
Add timing of sconsign write if --debug
A line is now emitted showing sconsign sync time if --debug=time Some calls to time.time replaced with time.perf_counter, where the objective was to time sections of code (i.e. where there wasn't an actual need to get time-since-epoch) - Python recommends this as getting the best-available timer. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'testing/framework')
-rw-r--r--testing/framework/TestCmdTests.py8
-rw-r--r--testing/framework/TestSCons.py4
2 files changed, 6 insertions, 6 deletions
diff --git a/testing/framework/TestCmdTests.py b/testing/framework/TestCmdTests.py
index e37b90e..01a1390 100644
--- a/testing/framework/TestCmdTests.py
+++ b/testing/framework/TestCmdTests.py
@@ -2169,15 +2169,15 @@ class sleep_TestCase(TestCmdTestCase):
"""Test sleep()"""
test = TestCmd.TestCmd()
- start = time.time()
+ start = time.perf_counter()
test.sleep()
- end = time.time()
+ end = time.perf_counter()
diff = end - start
assert diff > 0.9, "only slept %f seconds (start %f, end %f), not default" % (diff, start, end)
- start = time.time()
+ start = time.perf_counter()
test.sleep(3)
- end = time.time()
+ end = time.perf_counter()
diff = end - start
assert diff > 2.9, "only slept %f seconds (start %f, end %f), not 3" % (diff, start, end)
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py
index 0783da4..c02be7a 100644
--- a/testing/framework/TestSCons.py
+++ b/testing/framework/TestSCons.py
@@ -1887,11 +1887,11 @@ class TimeSCons(TestSCons):
--debug=memory and --debug=time options to have SCons report
its own memory and timing statistics.
"""
- self.startTime = time.time()
+ self.startTime = time.perf_counter()
try:
result = TestSCons.run(self, *args, **kw)
finally:
- self.endTime = time.time()
+ self.endTime = time.perf_counter()
return result
def copy_timing_configuration(self, source_dir, dest_dir):