File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,12 @@ pub fn get_physical() -> usize {
110110} 
111111
112112
113- #[ cfg( not( any( target_os = "linux" ,  target_os = "windows" ,  target_os="macos" ,  target_os="openbsd" ) ) ) ]  
113+ #[ cfg( not( any(  
114+     target_os = "linux" ,  
115+     target_os = "windows" ,  
116+     target_os = "macos" ,  
117+     target_os = "openbsd" ,  
118+     target_os = "aix" ) ) ) ]  
114119#[ inline]  
115120fn  get_num_physical_cpus ( )  -> usize  { 
116121    // Not implemented, fall back 
@@ -327,11 +332,31 @@ fn get_num_physical_cpus() -> usize {
327332    cpus as  usize 
328333} 
329334
335+ #[ cfg( target_os = "aix" ) ]  
336+ fn  get_num_physical_cpus ( )  -> usize  { 
337+     match  get_smt_threads_aix ( )  { 
338+         Some ( num)  => get_num_cpus ( )  / num, 
339+         None  => get_num_cpus ( ) , 
340+     } 
341+ } 
342+ 
343+ #[ cfg( target_os = "aix" ) ]  
344+ fn  get_smt_threads_aix ( )  -> Option < usize >  { 
345+     let  smt = unsafe  { 
346+         libc:: getsystemcfg ( libc:: SC_SMT_TC ) 
347+     } ; 
348+     if  smt == u64:: MAX  { 
349+         return  None ; 
350+     } 
351+     Some ( smt as  usize ) 
352+ } 
353+ 
330354#[ cfg( any(  
331355    target_os = "nacl" ,  
332356    target_os = "macos" ,  
333357    target_os = "ios" ,  
334358    target_os = "android" ,  
359+     target_os = "aix" ,  
335360    target_os = "solaris" ,  
336361    target_os = "illumos" ,  
337362    target_os = "fuchsia" )  
@@ -413,6 +438,7 @@ fn get_num_cpus() -> usize {
413438    target_os = "macos" ,  
414439    target_os = "ios" ,  
415440    target_os = "android" ,  
441+     target_os = "aix" ,  
416442    target_os = "solaris" ,  
417443    target_os = "illumos" ,  
418444    target_os = "fuchsia" ,  
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments