11use crate :: environment:: Environment ;
22use crate :: exec:: { cmd, CmdBuilder } ;
33use crate :: utils:: io:: { count_files, delete_directory} ;
4+ use crate :: utils:: with_log_group;
45use anyhow:: Context ;
56use camino:: { Utf8Path , Utf8PathBuf } ;
67use humansize:: BINARY ;
@@ -108,9 +109,11 @@ pub fn gather_llvm_profiles(
108109) -> anyhow:: Result < LlvmPGOProfile > {
109110 log:: info!( "Running benchmarks with PGO instrumented LLVM" ) ;
110111
111- init_compiler_benchmarks ( env, & [ "Debug" , "Opt" ] , & [ "Full" ] , LLVM_PGO_CRATES )
112- . run ( )
113- . context ( "Cannot gather LLVM PGO profiles" ) ?;
112+ with_log_group ( "Running benchmarks" , || {
113+ init_compiler_benchmarks ( env, & [ "Debug" , "Opt" ] , & [ "Full" ] , LLVM_PGO_CRATES )
114+ . run ( )
115+ . context ( "Cannot gather LLVM PGO profiles" )
116+ } ) ?;
114117
115118 let merged_profile = env. opt_artifacts ( ) . join ( "llvm-pgo.profdata" ) ;
116119 log:: info!( "Merging LLVM PGO profiles to {merged_profile}" ) ;
@@ -141,10 +144,12 @@ pub fn gather_rustc_profiles(
141144
142145 // Here we're profiling the `rustc` frontend, so we also include `Check`.
143146 // The benchmark set includes various stress tests that put the frontend under pressure.
144- init_compiler_benchmarks ( env, & [ "Check" , "Debug" , "Opt" ] , & [ "All" ] , RUSTC_PGO_CRATES )
145- . env ( "LLVM_PROFILE_FILE" , profile_template. as_str ( ) )
146- . run ( )
147- . context ( "Cannot gather rustc PGO profiles" ) ?;
147+ with_log_group ( "Running benchmarks" , || {
148+ init_compiler_benchmarks ( env, & [ "Check" , "Debug" , "Opt" ] , & [ "All" ] , RUSTC_PGO_CRATES )
149+ . env ( "LLVM_PROFILE_FILE" , profile_template. as_str ( ) )
150+ . run ( )
151+ . context ( "Cannot gather rustc PGO profiles" )
152+ } ) ?;
148153
149154 let merged_profile = env. opt_artifacts ( ) . join ( "rustc-pgo.profdata" ) ;
150155 log:: info!( "Merging Rustc PGO profiles to {merged_profile}" ) ;
@@ -164,9 +169,11 @@ pub struct LlvmBoltProfile(pub Utf8PathBuf);
164169pub fn gather_llvm_bolt_profiles ( env : & dyn Environment ) -> anyhow:: Result < LlvmBoltProfile > {
165170 log:: info!( "Running benchmarks with BOLT instrumented LLVM" ) ;
166171
167- init_compiler_benchmarks ( env, & [ "Check" , "Debug" , "Opt" ] , & [ "Full" ] , LLVM_BOLT_CRATES )
168- . run ( )
169- . context ( "Cannot gather LLVM BOLT profiles" ) ?;
172+ with_log_group ( "Running benchmarks" , || {
173+ init_compiler_benchmarks ( env, & [ "Check" , "Debug" , "Opt" ] , & [ "Full" ] , LLVM_BOLT_CRATES )
174+ . run ( )
175+ . context ( "Cannot gather LLVM BOLT profiles" )
176+ } ) ?;
170177
171178 let merged_profile = env. opt_artifacts ( ) . join ( "bolt.profdata" ) ;
172179 let profile_root = Utf8PathBuf :: from ( "/tmp/prof.fdata" ) ;
@@ -178,10 +185,12 @@ pub fn gather_llvm_bolt_profiles(env: &dyn Environment) -> anyhow::Result<LlvmBo
178185 let mut merge_args = vec ! [ "merge-fdata" ] ;
179186 merge_args. extend ( profiles. iter ( ) . map ( |p| p. to_str ( ) . unwrap ( ) ) ) ;
180187
181- cmd ( & merge_args)
182- . redirect_output ( merged_profile. clone ( ) )
183- . run ( )
184- . context ( "Cannot merge BOLT profiles" ) ?;
188+ with_log_group ( "Merging BOLT profiles" , || {
189+ cmd ( & merge_args)
190+ . redirect_output ( merged_profile. clone ( ) )
191+ . run ( )
192+ . context ( "Cannot merge BOLT profiles" )
193+ } ) ?;
185194
186195 log:: info!( "LLVM BOLT statistics" ) ;
187196 log:: info!(
0 commit comments