Skip to content

Commit

Permalink
Merge pull request #279 from jonhoo/rm-num_cpus
Browse files Browse the repository at this point in the history
Remove dependency on num_cpus
  • Loading branch information
jonhoo authored Feb 11, 2023
2 parents 2d00691 + 1db493b commit d7034f0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- Removed the dependency on `num_cpus` in favor of `std::thread::available_parallelism`. [#279](https://github.com/jonhoo/inferno/pull/279)

## [0.11.14] - 2023-01-21
### Added

Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exclude = ["/tests/**", "/flamegraph/**", "/*.perf"]
[features]
default = ["cli", "multithreaded", "nameattr"]
cli = ["clap", "env_logger"]
multithreaded = ["dashmap", "crossbeam-utils", "crossbeam-channel", "num_cpus"]
multithreaded = ["dashmap", "crossbeam-utils", "crossbeam-channel"]
nameattr = ["indexmap"]

[dependencies]
Expand All @@ -31,7 +31,6 @@ env_logger = { version = "0.9", default-features = false, optional = true }
indexmap = { version = "1.0", optional = true }
itoa = "1"
log = "0.4"
num_cpus = { version = "1.10", optional = true }
num-format = { version = "0.4.3", default-features = false }
quick-xml = { version = "0.26", default-features = false }
rgb = "0.8.13"
Expand Down
2 changes: 1 addition & 1 deletion benches/collapse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const INFILE_PERF: &str = "flamegraph/example-perf-stacks.txt.gz";
const INFILE_SAMPLE: &str = "tests/data/collapse-sample/large.txt.gz";
const SAMPLE_SIZE: usize = 100;

static NTHREADS: Lazy<usize> = Lazy::new(num_cpus::get);
static NTHREADS: Lazy<usize> = Lazy::new(|| std::thread::available_parallelism().unwrap().into());

fn read_infile(infile: &str, buf: &mut Vec<u8>) -> io::Result<()> {
let mut f = File::open(infile)?;
Expand Down
3 changes: 2 additions & 1 deletion src/collapse/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const RUST_HASH_LENGTH: usize = 17;

#[cfg(feature = "multithreaded")]
#[doc(hidden)]
pub static DEFAULT_NTHREADS: Lazy<usize> = Lazy::new(num_cpus::get);
pub static DEFAULT_NTHREADS: Lazy<usize> =
Lazy::new(|| std::thread::available_parallelism().unwrap().into());
#[cfg(not(feature = "multithreaded"))]
#[doc(hidden)]
pub static DEFAULT_NTHREADS: Lazy<usize> = Lazy::new(|| 1);
Expand Down

0 comments on commit d7034f0

Please sign in to comment.