New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can you add a name_prefix method to 0.2 runtime ’s builder? #1907
Comments
Or store a closure as a thread name producer? |
@hawkw Thandks for your repl, but looks no effect(Ubuntu 16.04, 1.39 stable, master branch tokio). let mut rt = tokio::runtime::Builder::new()
.num_threads(3)
.threaded_scheduler()
.thread_name("tok-")
.enable_all()
.build()
.unwrap(); top - 15:03:08 up 133 days, 3:07, 4 users, load average: 0.38, 0.37, 0.46
Threads: 5 total, 0 running, 5 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.9 us, 2.7 sy, 0.0 ni, 91.4 id, 1.9 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 32946936 total, 331500 free, 15747280 used, 16868156 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 16646908 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13036 xxx 20 0 295.5m 14.0m 2.2m S 0.0 0.0 0:00.99 toks-threaded2
13039 xxx 20 0 295.5m 14.0m 2.2m S 0.0 0.0 0:00.00 log
13040 xxx 20 0 295.5m 14.0m 2.2m S 0.0 0.0 0:20.78 tok-
13041 xxx 20 0 295.5m 14.0m 2.2m S 0.0 0.0 0:20.83 tok-
13042 xxx 20 0 295.5m 14.0m 2.2m S 0.0 0.0 0:20.84 tok- I only found it about thread::Builder::name from tokio(Master branch): src/runtime/blocking/pool.rs
5:use crate::runtime::{self, io, time, Builder, Callback};
99: builder: &Builder,
239: let mut builder = thread::Builder::new().name(self.inner.thread_name.clone()); |
An Fn to name threads is ok but it would need to be Send + Sync + ‘static |
Of course it should be But if to implement it, should add an api (maybe thread_name_generator?) or just modify the existing method directly(thread_name)? |
Maybe just |
Co-Authored-By: Eliza Weisman <eliza@buoyant.io>
Co-Authored-By: Eliza Weisman <eliza@buoyant.io>
Co-Authored-By: Eliza Weisman <eliza@buoyant.io>
https://docs.rs/tokio/0.2.2/tokio/runtime/struct.Builder.html#method.thread_name
https://docs.rs/tokio/0.1.21/tokio/runtime/struct.Builder.html#method.name_prefix
Why is the name_prefix of 0.1 replaced by the thread_name of 0.2?
I need different thread names to help track task running,incremental id of 0.1 is good.
The text was updated successfully, but these errors were encountered: