Only parse a single line from lscpu to get the Cpu(s) count. Avoid localization. (#879)
This commit is contained in:
parent
5ed07ecc93
commit
0b74eeb842
1 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
export LC_ALL=C # lscpu output is localized.
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR
|
||||
|
||||
|
@ -258,7 +260,7 @@ scale_ram_and_cpu() {
|
|||
else
|
||||
avail_gb=$(check_linux_memory)
|
||||
threads_per_core=$(lscpu | awk 'BEGIN {FS=":"} /Thread\(s\) per core/ {print $2}')
|
||||
avail_cores=$((`lscpu | awk '/^CPU\(s\)/ {print $2}'`*${threads_per_core}))
|
||||
avail_cores=$((`lscpu | awk '/^CPU\(s\):[[:blank:]]+[0-9]+[[:blank:]]*$/ {print $2; exit}'`*${threads_per_core}))
|
||||
fi
|
||||
echo "Found ${avail_gb}GB of memory and $avail_cores physical CPU cores"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue