File tree Expand file tree Collapse file tree 3 files changed +4
-13
lines changed Expand file tree Collapse file tree 3 files changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ libc = "0.2"
4444log = " 0.4.6"
4545libgit2-sys = " 0.13.2"
4646memchr = " 2.1.3"
47+ num_cpus = " 1.0"
4748opener = " 0.5"
4849os_info = " 3.0.7"
4950pathdiff = " 0.2"
Original file line number Diff line number Diff line change 11use crate :: core:: compiler:: CompileKind ;
22use crate :: util:: interning:: InternedString ;
33use crate :: util:: { CargoResult , Config , RustfixDiagnosticServer } ;
4- use anyhow:: { bail, Context as _ } ;
4+ use anyhow:: bail;
55use cargo_util:: ProcessBuilder ;
66use serde:: ser;
77use std:: cell:: RefCell ;
88use std:: path:: PathBuf ;
9- use std:: thread:: available_parallelism;
109
1110/// Configuration information for a rustc build.
1211#[ derive( Debug ) ]
@@ -74,12 +73,7 @@ impl BuildConfig {
7473 its environment, ignoring the `-j` parameter",
7574 ) ?;
7675 }
77- let jobs = match jobs. or ( cfg. jobs ) {
78- Some ( j) => j,
79- None => available_parallelism ( )
80- . context ( "failed to determine the amount of parallelism available" ) ?
81- . get ( ) as u32 ,
82- } ;
76+ let jobs = jobs. or ( cfg. jobs ) . unwrap_or ( :: num_cpus:: get ( ) as u32 ) ;
8377 if jobs == 0 {
8478 anyhow:: bail!( "jobs may not be 0" ) ;
8579 }
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ use anyhow::Context as _;
1313use cargo_util:: paths;
1414use std:: collections:: HashMap ;
1515use std:: io:: { BufWriter , Write } ;
16- use std:: thread:: available_parallelism;
1716use std:: time:: { Duration , Instant , SystemTime } ;
1817
1918pub struct Timings < ' cfg > {
@@ -381,9 +380,6 @@ impl<'cfg> Timings<'cfg> {
381380 } ;
382381 let total_time = format ! ( "{:.1}s{}" , duration, time_human) ;
383382 let max_concurrency = self . concurrency . iter ( ) . map ( |c| c. active ) . max ( ) . unwrap ( ) ;
384- let num_cpus = available_parallelism ( )
385- . map ( |x| x. get ( ) . to_string ( ) )
386- . unwrap_or_else ( |_| "n/a" . into ( ) ) ;
387383 let max_rustc_concurrency = self
388384 . concurrency
389385 . iter ( )
@@ -446,7 +442,7 @@ impl<'cfg> Timings<'cfg> {
446442 self . total_fresh + self . total_dirty,
447443 max_concurrency,
448444 bcx. build_config. jobs,
449- num_cpus,
445+ num_cpus:: get ( ) ,
450446 self . start_str,
451447 total_time,
452448 rustc_info,
You can’t perform that action at this time.
0 commit comments