Name previously unnamed thread pool threads (#104)

Several rayon and tokio threadpools did not have names; give them names
to make tracking them in debug tools easier
This commit is contained in:
steviez 2024-03-06 17:03:02 -06:00 committed by GitHub
parent 184b31c6b7
commit 8887cd19a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 4 deletions

View File

@ -173,7 +173,11 @@ pub fn ip_echo_server(
) -> IpEchoServer { ) -> IpEchoServer {
tcp_listener.set_nonblocking(true).unwrap(); tcp_listener.set_nonblocking(true).unwrap();
let runtime = Runtime::new().expect("Failed to create Runtime"); let runtime = tokio::runtime::Builder::new_multi_thread()
.thread_name("solIpEchoSrvrRt")
.enable_all()
.build()
.expect("new tokio runtime");
runtime.spawn(run_echo_server(tcp_listener, shred_version)); runtime.spawn(run_echo_server(tcp_listener, shred_version));
runtime runtime
} }

View File

@ -1483,7 +1483,10 @@ impl Bank {
let epoch = self.epoch(); let epoch = self.epoch();
let slot = self.slot(); let slot = self.slot();
let (thread_pool, thread_pool_time) = measure!( let (thread_pool, thread_pool_time) = measure!(
ThreadPoolBuilder::new().build().unwrap(), ThreadPoolBuilder::new()
.thread_name(|i| format!("solBnkNewEpch{i:02}"))
.build()
.expect("new rayon threadpool"),
"thread_pool_creation", "thread_pool_creation",
); );

View File

@ -418,9 +418,10 @@ impl SnapshotStorageRebuilder {
/// Builds thread pool to rebuild with /// Builds thread pool to rebuild with
fn build_thread_pool(&self) -> ThreadPool { fn build_thread_pool(&self) -> ThreadPool {
ThreadPoolBuilder::default() ThreadPoolBuilder::default()
.thread_name(|i| format!("solRbuildSnap{i:02}"))
.num_threads(self.num_threads) .num_threads(self.num_threads)
.build() .build()
.unwrap() .expect("new rayon threadpool")
} }
} }

View File

@ -816,7 +816,11 @@ pub async fn connect(ledger_path: &Path) -> std::result::Result<gen_client::Clie
} }
pub fn runtime() -> Runtime { pub fn runtime() -> Runtime {
Runtime::new().expect("new tokio runtime") tokio::runtime::Builder::new_multi_thread()
.thread_name("solAdminRpcRt")
.enable_all()
.build()
.expect("new tokio runtime")
} }
#[derive(Default, Deserialize, Clone)] #[derive(Default, Deserialize, Clone)]