Skip to content

Commit

Permalink
fix method of getting cpu nums
Browse files Browse the repository at this point in the history
- related PRs: tikv#8425, tikv#8427

Signed-off-by: baurine <2008.hbl@gmail.com>
  • Loading branch information
baurine committed Sep 21, 2020
1 parent 11d0f85 commit 6efdb72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/tikv_util/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub mod sys_quota {
}

pub fn cpu_cores_quota(&self) -> f64 {
let cpu_num = sysinfo::get_logical_cores() as f64;
let cpu_num = num_cpus::get() as f64;
match self.cgroup.cpu_cores_quota() {
Some(cgroup_quota) if cgroup_quota > 0.0 && cgroup_quota < cpu_num => cgroup_quota,
_ => cpu_num,
Expand Down Expand Up @@ -64,7 +64,7 @@ pub mod sys_quota {
}

pub fn cpu_cores_quota(&self) -> f64 {
sysinfo::get_logical_cores() as f64
num_cpus::get() as f64
}

pub fn memory_limit_in_bytes(&self) -> u64 {
Expand Down

0 comments on commit 6efdb72

Please sign in to comment.