@@ -706,13 +706,33 @@ def print_free_disk_space(pipeline: Pipeline):
706
706
f"Free disk space: { format_bytes (free )} out of total { format_bytes (total )} ({ (used / total ) * 100 :.2f} % used)" )
707
707
708
708
709
+ def log_metrics (step : BuildStep ):
710
+ substeps : List [Tuple [int , BuildStep ]] = []
711
+
712
+ def visit (step : BuildStep , level : int ):
713
+ substeps .append ((level , step ))
714
+ for child in step .children :
715
+ visit (child , level = level + 1 )
716
+
717
+ visit (step , 0 )
718
+
719
+ output = StringIO ()
720
+ for (level , step ) in substeps :
721
+ label = f"{ '.' * level } { step .type } "
722
+ print (f"{ label :<65} { step .duration :>8.2f} s" , file = output )
723
+ logging .info (f"Build step durations\n { output .getvalue ()} " )
724
+
725
+
709
726
def record_metrics (pipeline : Pipeline , timer : Timer ):
710
727
metrics = load_last_metrics (pipeline .metrics_path ())
711
728
if metrics is None :
712
729
return
713
- llvm_steps = metrics .find_all_by_type ("bootstrap::native::Llvm" )
730
+ llvm_steps = tuple (metrics .find_all_by_type ("bootstrap::native::Llvm" ))
731
+ assert len (llvm_steps ) > 0
714
732
llvm_duration = sum (step .duration for step in llvm_steps )
715
- rustc_steps = metrics .find_all_by_type ("bootstrap::compile::Rustc" )
733
+
734
+ rustc_steps = tuple (metrics .find_all_by_type ("bootstrap::compile::Rustc" ))
735
+ assert len (rustc_steps ) > 0
716
736
rustc_duration = sum (step .duration for step in rustc_steps )
717
737
718
738
# The LLVM step is part of the Rustc step
@@ -721,6 +741,8 @@ def record_metrics(pipeline: Pipeline, timer: Timer):
721
741
timer .add_duration ("LLVM" , llvm_duration )
722
742
timer .add_duration ("Rustc" , rustc_duration )
723
743
744
+ log_metrics (metrics )
745
+
724
746
725
747
def execute_build_pipeline (timer : Timer , pipeline : Pipeline , final_build_args : List [str ]):
726
748
# Clear and prepare tmp directory
0 commit comments