File tree 3 files changed +4
-13
lines changed
3 files changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ libc = "0.2"
44
44
log = " 0.4.6"
45
45
libgit2-sys = " 0.13.2"
46
46
memchr = " 2.1.3"
47
+ num_cpus = " 1.0"
47
48
opener = " 0.5"
48
49
os_info = " 3.0.7"
49
50
pathdiff = " 0.2"
Original file line number Diff line number Diff line change 1
1
use crate :: core:: compiler:: CompileKind ;
2
2
use crate :: util:: interning:: InternedString ;
3
3
use crate :: util:: { CargoResult , Config , RustfixDiagnosticServer } ;
4
- use anyhow:: { bail, Context as _ } ;
4
+ use anyhow:: bail;
5
5
use cargo_util:: ProcessBuilder ;
6
6
use serde:: ser;
7
7
use std:: cell:: RefCell ;
8
8
use std:: path:: PathBuf ;
9
- use std:: thread:: available_parallelism;
10
9
11
10
/// Configuration information for a rustc build.
12
11
#[ derive( Debug ) ]
@@ -74,12 +73,7 @@ impl BuildConfig {
74
73
its environment, ignoring the `-j` parameter",
75
74
) ?;
76
75
}
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 ) ;
83
77
if jobs == 0 {
84
78
anyhow:: bail!( "jobs may not be 0" ) ;
85
79
}
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ use anyhow::Context as _;
13
13
use cargo_util:: paths;
14
14
use std:: collections:: HashMap ;
15
15
use std:: io:: { BufWriter , Write } ;
16
- use std:: thread:: available_parallelism;
17
16
use std:: time:: { Duration , Instant , SystemTime } ;
18
17
19
18
pub struct Timings < ' cfg > {
@@ -381,9 +380,6 @@ impl<'cfg> Timings<'cfg> {
381
380
} ;
382
381
let total_time = format ! ( "{:.1}s{}" , duration, time_human) ;
383
382
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 ( ) ) ;
387
383
let max_rustc_concurrency = self
388
384
. concurrency
389
385
. iter ( )
@@ -446,7 +442,7 @@ impl<'cfg> Timings<'cfg> {
446
442
self . total_fresh + self . total_dirty,
447
443
max_concurrency,
448
444
bcx. build_config. jobs,
449
- num_cpus,
445
+ num_cpus:: get ( ) ,
450
446
self . start_str,
451
447
total_time,
452
448
rustc_info,
You can’t perform that action at this time.
0 commit comments