@@ -204,6 +204,9 @@ pub(crate) fn target_machine_factory(
204
204
optlvl : config:: OptLevel ,
205
205
target_features : & [ String ] ,
206
206
) -> TargetMachineFactoryFn < LlvmCodegenBackend > {
207
+ // Self-profile timer for creating a _factory_.
208
+ let _prof_timer = sess. prof . generic_activity ( "target_machine_factory" ) ;
209
+
207
210
let reloc_model = to_llvm_relocation_model ( sess. relocation_model ( ) ) ;
208
211
209
212
let ( opt_level, _) = to_llvm_opt_settings ( optlvl) ;
@@ -259,6 +262,9 @@ pub(crate) fn target_machine_factory(
259
262
. into_string ( )
260
263
. unwrap_or_default ( ) ;
261
264
let command_line_args = quote_command_line_args ( & sess. expanded_args ) ;
265
+ // Self-profile counter for the number of bytes produced by command-line quoting.
266
+ // Values are summed, so the summary result is cumulative across all TM factories.
267
+ sess. prof . artifact_size ( "quoted_command_line_args" , "-" , command_line_args. len ( ) as u64 ) ;
262
268
263
269
let debuginfo_compression = sess. opts . debuginfo_compression . to_string ( ) ;
264
270
match sess. opts . debuginfo_compression {
@@ -281,7 +287,11 @@ pub(crate) fn target_machine_factory(
281
287
282
288
let use_wasm_eh = wants_wasm_eh ( sess) ;
283
289
290
+ let prof = SelfProfilerRef :: clone ( & sess. prof ) ;
284
291
Arc :: new ( move |config : TargetMachineFactoryConfig | {
292
+ // Self-profile timer for invoking a factory to create a target machine.
293
+ let _prof_timer = prof. generic_activity ( "target_machine_factory_inner" ) ;
294
+
285
295
let path_to_cstring_helper = |path : Option < PathBuf > | -> CString {
286
296
let path = path. unwrap_or_default ( ) ;
287
297
let path = path_mapping
0 commit comments