mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 21:11:44 +00:00
Revert #10427: switch from num_cpus
This reverts commit6d11f9e7d4
, reversing changes made toc5cdd25c14
.
This commit is contained in:
parent
85e457e158
commit
8345cf5037
|
@ -44,6 +44,7 @@ libc = "0.2"
|
||||||
log = "0.4.6"
|
log = "0.4.6"
|
||||||
libgit2-sys = "0.13.2"
|
libgit2-sys = "0.13.2"
|
||||||
memchr = "2.1.3"
|
memchr = "2.1.3"
|
||||||
|
num_cpus = "1.0"
|
||||||
opener = "0.5"
|
opener = "0.5"
|
||||||
os_info = "3.0.7"
|
os_info = "3.0.7"
|
||||||
pathdiff = "0.2"
|
pathdiff = "0.2"
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
use crate::core::compiler::CompileKind;
|
use crate::core::compiler::CompileKind;
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::{CargoResult, Config, RustfixDiagnosticServer};
|
use crate::util::{CargoResult, Config, RustfixDiagnosticServer};
|
||||||
use anyhow::{bail, Context as _};
|
use anyhow::bail;
|
||||||
use cargo_util::ProcessBuilder;
|
use cargo_util::ProcessBuilder;
|
||||||
use serde::ser;
|
use serde::ser;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::thread::available_parallelism;
|
|
||||||
|
|
||||||
/// Configuration information for a rustc build.
|
/// Configuration information for a rustc build.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -74,12 +73,7 @@ impl BuildConfig {
|
||||||
its environment, ignoring the `-j` parameter",
|
its environment, ignoring the `-j` parameter",
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
let jobs = match jobs.or(cfg.jobs) {
|
let jobs = jobs.or(cfg.jobs).unwrap_or(::num_cpus::get() as u32);
|
||||||
Some(j) => j,
|
|
||||||
None => available_parallelism()
|
|
||||||
.context("failed to determine the amount of parallelism available")?
|
|
||||||
.get() as u32,
|
|
||||||
};
|
|
||||||
if jobs == 0 {
|
if jobs == 0 {
|
||||||
anyhow::bail!("jobs may not be 0");
|
anyhow::bail!("jobs may not be 0");
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ use anyhow::Context as _;
|
||||||
use cargo_util::paths;
|
use cargo_util::paths;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::{BufWriter, Write};
|
use std::io::{BufWriter, Write};
|
||||||
use std::thread::available_parallelism;
|
|
||||||
use std::time::{Duration, Instant, SystemTime};
|
use std::time::{Duration, Instant, SystemTime};
|
||||||
|
|
||||||
pub struct Timings<'cfg> {
|
pub struct Timings<'cfg> {
|
||||||
|
@ -381,9 +380,6 @@ impl<'cfg> Timings<'cfg> {
|
||||||
};
|
};
|
||||||
let total_time = format!("{:.1}s{}", duration, time_human);
|
let total_time = format!("{:.1}s{}", duration, time_human);
|
||||||
let max_concurrency = self.concurrency.iter().map(|c| c.active).max().unwrap();
|
let max_concurrency = self.concurrency.iter().map(|c| c.active).max().unwrap();
|
||||||
let num_cpus = available_parallelism()
|
|
||||||
.map(|x| x.get().to_string())
|
|
||||||
.unwrap_or_else(|_| "n/a".into());
|
|
||||||
let max_rustc_concurrency = self
|
let max_rustc_concurrency = self
|
||||||
.concurrency
|
.concurrency
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -446,7 +442,7 @@ impl<'cfg> Timings<'cfg> {
|
||||||
self.total_fresh + self.total_dirty,
|
self.total_fresh + self.total_dirty,
|
||||||
max_concurrency,
|
max_concurrency,
|
||||||
bcx.build_config.jobs,
|
bcx.build_config.jobs,
|
||||||
num_cpus,
|
num_cpus::get(),
|
||||||
self.start_str,
|
self.start_str,
|
||||||
total_time,
|
total_time,
|
||||||
rustc_info,
|
rustc_info,
|
||||||
|
|
Loading…
Reference in a new issue