Unverified Commit 449ba6b3 by SHIBATA Hiroshi Committed by GitHub

Merge pull request #1150 from scop/ncpus

num_cpu_cores: Prefer getconf over cpuinfo grep, simplify grep usage
parents eabe1f36 67c47603
...@@ -154,7 +154,8 @@ num_cpu_cores() { ...@@ -154,7 +154,8 @@ num_cpu_cores() {
num="$(sysctl -n hw.ncpu 2>/dev/null || true)" num="$(sysctl -n hw.ncpu 2>/dev/null || true)"
;; ;;
* ) * )
num="$(grep ^processor /proc/cpuinfo 2>/dev/null | wc -l | xargs)" num="$({ getconf _NPROCESSORS_ONLN ||
grep -c ^processor /proc/cpuinfo; } 2>/dev/null)"
num="${num#0}" num="${num#0}"
;; ;;
esac esac
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment