mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 22:53:56 +08:00
🌴 Sync 2026-10-28 19:48:41
This commit is contained in:
1 parent
6777dc608e
commit
edb4912e45
8 files changed
+116
-37
No files matched your search
+11
-1
@@ -11,7 +11,17 @@ cpu_arch="$(awk -F ': ' '/model name/ {print $2}' "$CPUINFO_PATH" | head -n1)"
|
||||
|
||||
case "$DISTRIB_TARGET" in
|
||||
"x86"/*)
|
||||
cpu_cores="$(grep "core id" "$CPUINFO_PATH" | sort -u | wc -l)C $(grep -c "processor" "$CPUINFO_PATH")T" ;;
|
||||
procs="$(grep -c "processor" "$CPUINFO_PATH")"
|
||||
sibs="$(awk -F ': *' '/^siblings/ {print $2; exit}' "$CPUINFO_PATH")"
|
||||
case "$sibs" in ''|*[!0-9]*) sibs="" ;; esac
|
||||
if [ -n "$sibs" ] && [ "$procs" -lt "$sibs" ]; then
|
||||
# Partial CPU view (e.g. LXC container): host core ids leak
|
||||
# through /proc/cpuinfo and can repeat - count the assigned
|
||||
# CPUs as cores/threads
|
||||
cpu_cores="${procs}C ${procs}T"
|
||||
else
|
||||
cpu_cores="$(grep "core id" "$CPUINFO_PATH" | sort -u | wc -l)C ${procs}T"
|
||||
fi ;;
|
||||
*)
|
||||
cpu_cores="$(grep -c "processor" "$CPUINFO_PATH")" ;;
|
||||
esac
|
||||
|
||||
Reference in new issue
Block a user