1
1
use crate :: environment:: Environment ;
2
2
use crate :: exec:: { cmd, CmdBuilder } ;
3
3
use crate :: utils:: io:: { count_files, delete_directory} ;
4
+ use crate :: utils:: with_log_group;
4
5
use anyhow:: Context ;
5
6
use camino:: { Utf8Path , Utf8PathBuf } ;
6
7
use humansize:: BINARY ;
@@ -108,9 +109,11 @@ pub fn gather_llvm_profiles(
108
109
) -> anyhow:: Result < LlvmPGOProfile > {
109
110
log:: info!( "Running benchmarks with PGO instrumented LLVM" ) ;
110
111
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
+ } ) ?;
114
117
115
118
let merged_profile = env. opt_artifacts ( ) . join ( "llvm-pgo.profdata" ) ;
116
119
log:: info!( "Merging LLVM PGO profiles to {merged_profile}" ) ;
@@ -141,10 +144,12 @@ pub fn gather_rustc_profiles(
141
144
142
145
// Here we're profiling the `rustc` frontend, so we also include `Check`.
143
146
// 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
+ } ) ?;
148
153
149
154
let merged_profile = env. opt_artifacts ( ) . join ( "rustc-pgo.profdata" ) ;
150
155
log:: info!( "Merging Rustc PGO profiles to {merged_profile}" ) ;
@@ -164,9 +169,11 @@ pub struct LlvmBoltProfile(pub Utf8PathBuf);
164
169
pub fn gather_llvm_bolt_profiles ( env : & dyn Environment ) -> anyhow:: Result < LlvmBoltProfile > {
165
170
log:: info!( "Running benchmarks with BOLT instrumented LLVM" ) ;
166
171
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
+ } ) ?;
170
177
171
178
let merged_profile = env. opt_artifacts ( ) . join ( "bolt.profdata" ) ;
172
179
let profile_root = Utf8PathBuf :: from ( "/tmp/prof.fdata" ) ;
@@ -178,10 +185,12 @@ pub fn gather_llvm_bolt_profiles(env: &dyn Environment) -> anyhow::Result<LlvmBo
178
185
let mut merge_args = vec ! [ "merge-fdata" ] ;
179
186
merge_args. extend ( profiles. iter ( ) . map ( |p| p. to_str ( ) . unwrap ( ) ) ) ;
180
187
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
+ } ) ?;
185
194
186
195
log:: info!( "LLVM BOLT statistics" ) ;
187
196
log:: info!(
0 commit comments