diff options
author | Mats Wichmann <mats@linux.com> | 2021-02-08 20:24:06 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2021-02-08 20:24:06 (GMT) |
commit | fb7bb3f969698cbbcdb5af7c97f33c4529ba2e09 (patch) | |
tree | 761a6bc94e9bf285bfe1563dd44129ccc09b1ea7 /SCons/SConsign.py | |
parent | 4dbccd6e784a4ea0c79972e79cef1b22ca3d6716 (diff) | |
download | SCons-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 'SCons/SConsign.py')
-rw-r--r-- | SCons/SConsign.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/SCons/SConsign.py b/SCons/SConsign.py index 95b8096..c488ef9 100644 --- a/SCons/SConsign.py +++ b/SCons/SConsign.py @@ -27,11 +27,12 @@ import SCons.compat import os import pickle +import time import SCons.dblite import SCons.Warnings - from SCons.compat import PICKLE_PROTOCOL +from SCons.Util import print_time def corrupt_dblite_warning(filename): @@ -100,6 +101,10 @@ normcase = os.path.normcase def write(): global sig_files + + if print_time(): + time1 = time.perf_counter() + for sig_file in sig_files: sig_file.write(sync=0) for db in DB_sync_list: @@ -116,6 +121,10 @@ def write(): else: closemethod() + if print_time(): + time2 = time.perf_counter() + print('Total SConsign sync time: %f seconds' % (time2 - time1)) + class SConsignEntry: """ |