Skip to content

Commit e78fb95

Browse files
committed
Give the coordinator thread a name.
This is useful when profiling with a profiler like Samply.
1 parent 176610c commit e78fb95

File tree

1 file changed

+4
-3
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+4
-3
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
12571257
// Each LLVM module is automatically sent back to the coordinator for LTO if
12581258
// necessary. There's already optimizations in place to avoid sending work
12591259
// back to the coordinator if LTO isn't requested.
1260-
return B::spawn_thread(cgcx.time_trace, move || {
1260+
return B::spawn_named_thread(cgcx.time_trace, "coordinator".to_string(), move || {
12611261
let mut worker_id_counter = 0;
12621262
let mut free_worker_ids = Vec::new();
12631263
let mut get_worker_id = |free_worker_ids: &mut Vec<usize>| {
@@ -1625,7 +1625,8 @@ fn start_executing_work<B: ExtraBackendMethods>(
16251625
modules: compiled_modules,
16261626
allocator_module: compiled_allocator_module,
16271627
})
1628-
});
1628+
})
1629+
.expect("failed to spawn coordinator thread");
16291630

16301631
// A heuristic that determines if we have enough LLVM WorkItems in the
16311632
// queue so that the main thread can do LLVM work instead of codegen
@@ -1758,7 +1759,7 @@ fn spawn_work<B: ExtraBackendMethods>(cgcx: CodegenContext<B>, work: WorkItem<B>
17581759
})
17591760
};
17601761
})
1761-
.expect("failed to spawn thread");
1762+
.expect("failed to spawn work thread");
17621763
}
17631764

17641765
enum SharedEmitterMessage {

0 commit comments

Comments
 (0)