@@ -211,7 +211,8 @@ def get_timestamp() -> float:
211
211
TimerSection = Union [Duration , "Timer" ]
212
212
213
213
214
- def iterate_sections (section : TimerSection , name : str , level : int = 0 ) -> Iterator [Tuple [int , str , Duration ]]:
214
+ def iterate_sections (section : TimerSection , name : str , level : int = 0 ) -> Iterator [
215
+ Tuple [int , str , Duration ]]:
215
216
"""
216
217
Hierarchically iterate the sections of a timer, in a depth-first order.
217
218
"""
@@ -239,7 +240,7 @@ def section(self, name: str) -> "Timer":
239
240
start = get_timestamp ()
240
241
exc = None
241
242
242
- child_timer = Timer (parent_names = self .parent_names + (name , ))
243
+ child_timer = Timer (parent_names = self .parent_names + (name ,))
243
244
full_name = " > " .join (child_timer .parent_names )
244
245
try :
245
246
LOGGER .info (f"Section `{ full_name } ` starts" )
@@ -648,6 +649,16 @@ def print_binary_sizes(pipeline: Pipeline):
648
649
LOGGER .info (f"Rustc binary size\n { output .getvalue ()} " )
649
650
650
651
652
+ def print_free_disk_space (pipeline : Pipeline ):
653
+ usage = shutil .disk_usage (pipeline .opt_artifacts ())
654
+ total = usage .total
655
+ used = usage .used
656
+ free = usage .free
657
+
658
+ logging .info (
659
+ f"Free disk space: { format_bytes (free )} out of total { format_bytes (total )} ({ (used / total ) * 100 :.2f} % used)" )
660
+
661
+
651
662
def execute_build_pipeline (timer : Timer , pipeline : Pipeline , final_build_args : List [str ]):
652
663
# Clear and prepare tmp directory
653
664
shutil .rmtree (pipeline .opt_artifacts (), ignore_errors = True )
@@ -666,6 +677,7 @@ def execute_build_pipeline(timer: Timer, pipeline: Pipeline, final_build_args: L
666
677
667
678
with stage1 .section ("Gather profiles" ):
668
679
gather_llvm_profiles (pipeline )
680
+ print_free_disk_space (pipeline )
669
681
670
682
clear_llvm_files (pipeline )
671
683
final_build_args += [
@@ -683,6 +695,7 @@ def execute_build_pipeline(timer: Timer, pipeline: Pipeline, final_build_args: L
683
695
684
696
with stage2 .section ("Gather profiles" ):
685
697
gather_rustc_profiles (pipeline )
698
+ print_free_disk_space (pipeline )
686
699
687
700
clear_llvm_files (pipeline )
688
701
final_build_args += [
@@ -702,6 +715,7 @@ def execute_build_pipeline(timer: Timer, pipeline: Pipeline, final_build_args: L
702
715
with stage3 .section ("Gather profiles" ):
703
716
gather_llvm_bolt_profiles (pipeline )
704
717
718
+ print_free_disk_space (pipeline )
705
719
clear_llvm_files (pipeline )
706
720
final_build_args += [
707
721
"--llvm-bolt-profile-use" ,
@@ -733,5 +747,6 @@ def execute_build_pipeline(timer: Timer, pipeline: Pipeline, final_build_args: L
733
747
raise e
734
748
finally :
735
749
timer .print_stats ()
750
+ print_free_disk_space (pipeline )
736
751
737
752
print_binary_sizes (pipeline )
0 commit comments