@@ -204,6 +204,9 @@ pub(crate) fn target_machine_factory(
204204 optlvl : config:: OptLevel ,
205205 target_features : & [ String ] ,
206206) -> TargetMachineFactoryFn < LlvmCodegenBackend > {
207+ // Self-profile timer for creating a _factory_.
208+ let _prof_timer = sess. prof . generic_activity ( "target_machine_factory" ) ;
209+
207210 let reloc_model = to_llvm_relocation_model ( sess. relocation_model ( ) ) ;
208211
209212 let ( opt_level, _) = to_llvm_opt_settings ( optlvl) ;
@@ -259,6 +262,9 @@ pub(crate) fn target_machine_factory(
259262 . into_string ( )
260263 . unwrap_or_default ( ) ;
261264 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 ) ;
262268
263269 let debuginfo_compression = sess. opts . debuginfo_compression . to_string ( ) ;
264270 match sess. opts . debuginfo_compression {
@@ -281,7 +287,11 @@ pub(crate) fn target_machine_factory(
281287
282288 let use_wasm_eh = wants_wasm_eh ( sess) ;
283289
290+ let prof = SelfProfilerRef :: clone ( & sess. prof ) ;
284291 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+
285295 let path_to_cstring_helper = |path : Option < PathBuf > | -> CString {
286296 let path = path. unwrap_or_default ( ) ;
287297 let path = path_mapping
0 commit comments