리눅스 CPU 확인 스크립트
####################################
#### Counting of Physical CPUs ####
####################################
Processor Nums : 24
Core per Processor : 6
sibling (Logical CPUs) : 12
==================================
Product Name : Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz
Core Nums(per Processor) : 6
Hyperthreding : Yes
Total Physical Cpus : 2
깔끔하게 출력!!
======================================================
#!/bin/bash
#
# Counting of Physical CPU and Core, HT
#
Info="/proc/cpuinfo"
echo "####################################"
echo "#### Counting of Physical CPUs ####"
echo "####################################"
PName=$(grep name $Info | sort -u | awk -F: '{print $2}')
ProcNum=$(grep processor $Info | sort -u | wc -l)
PhysCPUs=$(grep "physical id" $Info | sort -u | uniq | wc -l)
echo "Processor Nums : $ProcNum"
CoreNum=$(grep cores $Info | sort -u | awk -F: '{print $2}')
echo "Core per Processor : $CoreNum"
sibling=$(grep "sibling" $Info | sort -u | awk -F: '{print $2}')
echo "sibling (Logical CPUs) : $sibling"
echo "=================================="
echo " Product Name : $PName"
echo " Core Nums(per Processor) : $CoreNum "
HT=$(expr $sibling / $CoreNum)
if [ "$HT" -eq 1 ]
then
echo " Hyperthreding : No"
else
echo " Hyperthreding : Yes"
fi
echo " Total Physical Cpus : $PhysCPUs "
exit
================================================