Add elapsed time print statement to build system
(cherry picked from commit d070159094
)
This commit is contained in:
parent
c0ccc34eeb
commit
55dbf24b98
1 changed files with 13 additions and 0 deletions
13
SConstruct
13
SConstruct
|
@ -3,10 +3,12 @@
|
||||||
EnsureSConsVersion(0, 98, 1)
|
EnsureSConsVersion(0, 98, 1)
|
||||||
|
|
||||||
# System
|
# System
|
||||||
|
import atexit
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
# Local
|
# Local
|
||||||
|
@ -25,6 +27,8 @@ active_platform_ids = []
|
||||||
platform_exporters = []
|
platform_exporters = []
|
||||||
platform_apis = []
|
platform_apis = []
|
||||||
|
|
||||||
|
time_at_start = time.time()
|
||||||
|
|
||||||
for x in sorted(glob.glob("platform/*")):
|
for x in sorted(glob.glob("platform/*")):
|
||||||
if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"):
|
if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"):
|
||||||
continue
|
continue
|
||||||
|
@ -676,3 +680,12 @@ if "env" in locals():
|
||||||
# TODO: replace this with `env.Dump(format="json")`
|
# TODO: replace this with `env.Dump(format="json")`
|
||||||
# once we start requiring SCons 4.0 as min version.
|
# once we start requiring SCons 4.0 as min version.
|
||||||
methods.dump(env)
|
methods.dump(env)
|
||||||
|
|
||||||
|
|
||||||
|
def print_elapsed_time():
|
||||||
|
elapsed_time_sec = round(time.time() - time_at_start, 3)
|
||||||
|
time_ms = round((elapsed_time_sec % 1) * 1000)
|
||||||
|
print(f"[Time elapsed: {time.strftime('%H:%M:%S', time.gmtime(elapsed_time_sec))}.{time_ms:03}]")
|
||||||
|
|
||||||
|
|
||||||
|
atexit.register(print_elapsed_time)
|
||||||
|
|
Loading…
Reference in a new issue