Skip to content

Commit cb829d8

Browse files
authored
Log timestamps in the bootstrap scripts (#8113)
### Motivation: This enables detailed analysis of timings of different build phases of the bootstrap scripts. ### Modifications: Log messages as produced by `Utilities/helpers.py` also output timestamps in the ISO format. ### Result: It's easier to analyze build phases timing.
1 parent d7a31a0 commit cb829d8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Utilities/bootstrap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import platform
2222
import re
2323
import shutil
2424
import subprocess
25-
from helpers import note, error, symlink_force, mkdir_p, call, call_output
25+
from helpers import note, error, symlink_force, mkdir_p, call, call_output, log_timestamp
2626

2727
g_macos_deployment_target = '12.0'
2828

@@ -840,4 +840,6 @@ def get_swiftpm_flags(args):
840840
return build_flags
841841

842842
if __name__ == '__main__':
843+
log_timestamp("start")
843844
main()
845+
log_timestamp("end")

Utilities/helpers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@
1111
##
1212
##===----------------------------------------------------------------------===##
1313

14+
import datetime
1415
import subprocess
1516
import sys
1617
import os
1718
import errno
1819

20+
def log_timestamp(marker):
21+
print("--- %s: note: %s %s" % (os.path.basename(sys.argv[0]), marker, datetime.datetime.now().isoformat()))
22+
1923
def note(message):
2024
print("--- %s: note: %s" % (os.path.basename(sys.argv[0]), message))
25+
log_timestamp("timestamp")
2126
sys.stdout.flush()
2227

2328
def error(message):
2429
print("--- %s: error: %s" % (os.path.basename(sys.argv[0]), message))
30+
log_timestamp("timestamp")
2531
sys.stdout.flush()
2632
raise SystemExit(1)
2733

0 commit comments

Comments
 (0)