Skip to content

Commit b20e061

Browse files
committed
[NFC] Print build-script timings to stderr
1 parent 1513975 commit b20e061

File tree

1 file changed

+8
-8
lines changed
  • utils/swift_build_support/swift_build_support

1 file changed

+8
-8
lines changed

utils/swift_build_support/swift_build_support/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ def log_analyzer():
7575
Analyze .build_script_log and provide a summary of the time execution.
7676
"""
7777
build_script_log_path = log_time_path()
78-
print("--- Build Script Analyzer ---")
78+
print("--- Build Script Analyzer ---", file=sys.stderr)
7979
build_events = []
8080
total_duration = 0
8181
if os.path.exists(build_script_log_path):
82-
print("Build Script Log: {}".format(build_script_log_path))
82+
print("Build Script Log: {}".format(build_script_log_path), file=sys.stderr)
8383
with open(build_script_log_path) as f:
8484
for event in f:
8585
build_event = json.loads(event)
@@ -89,16 +89,16 @@ def log_analyzer():
8989
finish_events = [x for x in build_events if x["event"] == "end"]
9090
finish_events.sort(key=lambda x: x["duration"], reverse=True)
9191

92-
print("Build Percentage \t Build Duration (sec) \t Build Phase")
93-
print("================ \t ==================== \t ===========")
92+
print("Build Percentage \t Build Duration (sec) \t Build Phase", file=sys.stderr)
93+
print("================ \t ==================== \t ===========", file=sys.stderr)
9494
event_row = '{:<17.1%} \t {:<21} \t {}'
9595
for build_event in finish_events:
9696
duration_percentage = \
9797
(float(build_event["duration"]) / float(total_duration))
9898
print(event_row.format(duration_percentage,
9999
build_event["duration"],
100-
build_event["command"]))
101-
print("Total Duration: {}".format(total_duration))
100+
build_event["command"]), file=sys.stderr)
101+
print("Total Duration: {}".format(total_duration), file=sys.stderr)
102102
else:
103-
print("Skip build script analyzer")
104-
print(".build_script_log file not found at {}".format(build_script_log_path))
103+
print("Skip build script analyzer", file=sys.stderr)
104+
print(".build_script_log file not found at {}".format(build_script_log_path), file=sys.stderr)

0 commit comments

Comments
 (0)