diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-06-22 08:58:48 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-06-26 09:14:45 +1000 |
| commit | 666b1b68a7200513872303f1bc8136088a09d4ad (patch) | |
| tree | b9c22e09f5b6b4a9a246e762a5292e8bfc35ecc0 /compiler/rustc_monomorphize/src | |
| parent | 487bdeb519a821298b76a35d8c437ef2e733da0d (diff) | |
| download | rust-666b1b68a7200513872303f1bc8136088a09d4ad.tar.gz rust-666b1b68a7200513872303f1bc8136088a09d4ad.zip | |
Tweak thread names for CGU processing.
For non-incremental builds on Unix, currently all the thread names look like `opt regex.f10ba03eb5ec7975-cgu.0`. But they are truncated by `pthread_setname` to `opt regex.f10ba`, hiding the numeric suffix that distinguishes them. This is really annoying when using a profiler like Samply. This commit changes these thread names to a form like `opt cgu.0`, which is much better.
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/partitioning.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 10a496cf993..e663f4486f7 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -431,6 +431,9 @@ fn merge_codegen_units<'tcx>( codegen_units.sort_by_key(|cgu| cmp::Reverse(cgu.size_estimate())); let num_digits = codegen_units.len().ilog10() as usize + 1; for (index, cgu) in codegen_units.iter_mut().enumerate() { + // Note: `WorkItem::short_description` depends on this name ending + // with `-cgu.` followed by a numeric suffix. Please keep it in + // sync with this code. let suffix = format!("{index:0num_digits$}"); let numbered_codegen_unit_name = cgu_name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(suffix)); |
