码迷,mamicode.com
首页 > 数据库 > 详细

MySQL Hardware--CentOS 6查看CPU信息

时间:2019-04-22 13:48:41      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:class   flags   sibling   res   txt   span   服务器   服务   线程   

查看CPU信息

cpu_model=`cat /proc/cpuinfo |grep "model name"|awk -F : {print $2} |uniq`
cpu_mhz=`cat /proc/cpuinfo |grep "cpu MHz"|awk -F : {print $2} |uniq`
cpu_cache_size=`cat /proc/cpuinfo |grep "cache size"|awk -F : {print $2} |uniq`
physical_cpu_count=`cat /proc/cpuinfo| grep "physical id"| sort -u | wc -l`
logic_cpu_count=`cat /proc/cpuinfo| grep "processor"| wc -l`
core_count_per_cpu=`cat /proc/cpuinfo| grep "cpu cores"|awk -F : {print $2} | uniq`
support_64_count=`cat /proc/cpuinfo | grep flags | grep  lm |wc -l`
sibling_count=`cat /proc/cpuinfo |grep "sibling" |awk -F : {print $2}|uniq`

if [[ $support_64_count -gt 0 ]]
then
is_support_64=1
else
is_support_64=0
fi

if [[ $sibling_count -gt $core_count_per_cpu ]]
then
is_supper_thread=1
else
is_supper_thread=0
fi

echo "当前服务器CPU信息:" > /tmp/cpu_info.txt
echo "物理CPU数量 : ${physical_cpu_count}" >> /tmp/cpu_info.txt
echo "逻辑CPU数量 : ${logic_cpu_count}" >>/tmp/cpu_info.txt
echo "每CPU物理Core数 : ${core_count_per_cpu}" >>/tmp/cpu_info.txt
echo "是否超线程 : ${is_supper_thread}" >>/tmp/cpu_info.txt
echo "是否支持64位 : ${is_support_64}" >>/tmp/cpu_info.txt
echo "CPU型号 : ${cpu_model}" >>/tmp/cpu_info.txt
echo "CPU频率 : ${cpu_mhz}" >>/tmp/cpu_info.txt
echo "CPU缓存 : ${cpu_cache_size}" >>/tmp/cpu_info.txt

cat /tmp/cpu_info.txt

 

MySQL Hardware--CentOS 6查看CPU信息

标签:class   flags   sibling   res   txt   span   服务器   服务   线程   

原文地址:https://www.cnblogs.com/gaogao67/p/10749655.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!