Commit ec29e744 authored by Dylan Araps's avatar Dylan Araps

cpu: Simplify cpu_cores

parent a2769a93
......@@ -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
;;
......
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