@@ -75,11 +75,11 @@ def log_analyzer():
75
75
Analyze .build_script_log and provide a summary of the time execution.
76
76
"""
77
77
build_script_log_path = log_time_path ()
78
- print ("--- Build Script Analyzer ---" )
78
+ print ("--- Build Script Analyzer ---" , file = sys . stderr )
79
79
build_events = []
80
80
total_duration = 0
81
81
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 )
83
83
with open (build_script_log_path ) as f :
84
84
for event in f :
85
85
build_event = json .loads (event )
@@ -89,15 +89,17 @@ def log_analyzer():
89
89
finish_events = [x for x in build_events if x ["event" ] == "end" ]
90
90
finish_events .sort (key = lambda x : x ["duration" ], reverse = True )
91
91
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" ,
93
+ file = sys .stderr )
94
+ print ("================ \t ==================== \t ===========" ,
95
+ file = sys .stderr )
94
96
event_row = '{:<17.1%} \t {:<21} \t {}'
95
97
for build_event in finish_events :
96
98
duration_percentage = \
97
99
(float (build_event ["duration" ]) / float (total_duration ))
98
100
print (event_row .format (duration_percentage ,
99
101
build_event ["duration" ],
100
- build_event ["command" ]))
102
+ build_event ["command" ]), file = sys . stderr )
101
103
102
104
hours , remainder = divmod (total_duration , 3600 )
103
105
minutes , seconds = divmod (remainder , 60 )
@@ -111,7 +113,8 @@ def log_analyzer():
111
113
formatted_duration = ""
112
114
113
115
print ("Total Duration: {:.2f} seconds" .format (
114
- total_duration ) + formatted_duration )
116
+ total_duration ) + formatted_duration , file = sys . stderr )
115
117
else :
116
- print ("Skip build script analyzer" )
117
- print (".build_script_log file not found at {}" .format (build_script_log_path ))
118
+ print ("Skip build script analyzer" , file = sys .stderr )
119
+ print (".build_script_log file not found at {}" .format (build_script_log_path ),
120
+ file = sys .stderr )
0 commit comments