diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-10-20 20:40:59 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-10-20 20:40:59 (GMT) |
commit | f335e6b2af2f554da43d4ae7896bc8fa3a487be7 (patch) | |
tree | 41986d1296089a17984af09fe07dce00eb691c01 /src/engine | |
parent | 9d1dbea5f930d2c86430ddc58eadaa24d0b47803 (diff) | |
download | SCons-f335e6b2af2f554da43d4ae7896bc8fa3a487be7.zip SCons-f335e6b2af2f554da43d4ae7896bc8fa3a487be7.tar.gz SCons-f335e6b2af2f554da43d4ae7896bc8fa3a487be7.tar.bz2 |
Add printing time processing each SConscript when --debug=time is specified on command line
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Script/SConscript.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index 8fea9c4..db6552c 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -44,12 +44,15 @@ import SCons.Script.Main import SCons.Tool import SCons.Util +from . import Main + import collections import os import os.path import re import sys import traceback +import time class SConscriptReturn(Exception): pass @@ -247,11 +250,17 @@ def _SConscript(fs, *files, **kw): try: try: # _file_ = SCons.Util.to_str(_file_) + if Main.print_time: + time1 = time.time() exec(compile(_file_.read(), _file_.name, 'exec'), call_stack[-1].globals) except SConscriptReturn: pass finally: + if Main.print_time: + time2 = time.time() + print('SConscript:%s took %0.3f ms' % (f.get_abspath(), (time2 - time1) * 1000.0)) + if old_file is not None: call_stack[-1].globals.update({__file__:old_file}) else: |