cpu: Simplify cpu_cores

This commit is contained in:
Dylan Araps 2018-05-29 08:48:03 +10:00
parent a2769a93ed
commit ec29e74406
1 changed files with 3 additions and 3 deletions

View File

@ -1002,9 +1002,9 @@ get_distro() {
*) machine_arch="$(uname -m)" ;;
esac
if [[ "$os_arch" == "on" ]]; then
[[ "$os_arch" == "on" ]] && \
distro+=" ${machine_arch}"
fi
[[ "${ascii_distro:-auto}" == "auto" ]] && \
ascii_distro="$(trim "$distro")"
@ -1793,7 +1793,7 @@ get_cpu() {
# Get CPU cores.
case "$cpu_cores" in
"logical" | "on") cores="$(grep -c "^processor" "$cpu_file")" ;;
"physical") cores="$(grep "^core id" "$cpu_file" | sort -u | wc -l)" ;;
"physical") cores="$(awk '/^core id/&&!a[$0]++{++i}END{print i}' "$cpu_file")" ;;
esac
;;