CI: Make processor count consistent
Code formatting script was using `sysctl -n hw.physicalcpu` on macOS machines to get the CPU count. This command returns the physical CPUs. `nproc`, however, returns logical CPU count on Linux machines. It should be `sysctl -n hw.logicalcpu` to make it consistent with its Linux counterpart. But there also another way. `getconf _NPROCESSORS_ONLN` gives the number of logical CPUs on both Linux and macOS.
This commit is contained in:
parent
3c78a8aa8d
commit
6b3479108f
@ -14,10 +14,8 @@ set -o nounset
|
||||
# Get CPU count
|
||||
OS=$(uname)
|
||||
NPROC=1
|
||||
if [[ $OS = "Linux" ]] ; then
|
||||
NPROC=$(nproc)
|
||||
elif [[ ${OS} = "Darwin" ]] ; then
|
||||
NPROC=$(sysctl -n hw.physicalcpu)
|
||||
if [[ $OS = "Linux" || $OS = "Darwin" ]] ; then
|
||||
NPROC=$(getconf _NPROCESSORS_ONLN)
|
||||
fi
|
||||
|
||||
# Discover clang-format
|
||||
|
Loading…
x
Reference in New Issue
Block a user