File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ use tokio_util::sync::CancellationToken;
55#[ global_allocator]
66static GLOBAL : MiMalloc = MiMalloc ;
77
8- use std:: net:: { IpAddr , SocketAddr } ;
8+ use std:: {
9+ net:: { IpAddr , SocketAddr } ,
10+ num:: NonZeroUsize ,
11+ } ;
912
1013use pulsebeam:: node;
1114use systemstat:: { IpAddr as SysIpAddr , Platform , System } ;
@@ -20,13 +23,7 @@ fn main() {
2023 . pretty ( )
2124 . init ( ) ;
2225
23- let logical_cpus = num_cpus:: get ( ) ;
24- let physical_cpus = num_cpus:: get_physical ( ) ;
25- // Compute optimal worker threads for CPU-bound SFU tasks
26- let workers = logical_cpus. min ( physical_cpus) ;
27-
28- tracing:: info!( "detected logical CPUs: {}" , logical_cpus) ;
29- tracing:: info!( "detected physical CPUs: {}" , physical_cpus) ;
26+ let workers = std:: thread:: available_parallelism ( ) . map_or ( 1 , NonZeroUsize :: get) ;
3027 tracing:: info!( "using {} worker threads" , workers) ;
3128
3229 let rt = tokio:: runtime:: Builder :: new_multi_thread ( )
You can’t perform that action at this time.
0 commit comments