diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-07-08 14:27:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 14:27:25 +0200 |
commit | bf54d7c6da5d3ce53f08817b9342b371db971451 (patch) | |
tree | 6912af4977ced445f287d09f42c920bc7c11197c | |
parent | bfc14a6359f6a466999af37f20c71269e9952328 (diff) | |
parent | d07015909496be8eed7cbadc159ef0054565d5ef (diff) |
Merge pull request #50248 from Geometror/scons-add-buildtime-info
SCons: Show elapsed time after build or cleaning process
-rw-r--r-- | SConstruct | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct index e5646a7d0a..8b37bb8285 100644 --- a/SConstruct +++ b/SConstruct @@ -4,10 +4,12 @@ EnsureSConsVersion(3, 0, 0) EnsurePythonVersion(3, 5) # System +import atexit import glob import os import pickle import sys +import time from collections import OrderedDict # Local @@ -25,6 +27,8 @@ active_platform_ids = [] platform_exporters = [] platform_apis = [] +time_at_start = time.time() + for x in sorted(glob.glob("platform/*")): if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"): continue @@ -748,3 +752,12 @@ if "env" in locals(): # TODO: replace this with `env.Dump(format="json")` # once we start requiring SCons 4.0 as min version. 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) |