MySQL Hardware--CentOS 6查看CPU信息

cpufrequtils命令

## 安装:
yum install cpufrequtils

## 查看CPU信息:
cpufreq-info -m

输出CPU信息为:

analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.20 GHz - 2.60 GHz
  available frequency steps: 2.60 GHz, 2.60 GHz, 2.50 GHz, 2.40 GHz, 2.30 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.60 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz
  available cpufreq governors: ondemand, userspace, performance
  current policy: frequency should be within 1.20 GHz and 2.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz (asserted by call to hardware).

hardware limits显示CPU支持的频率范围
current CPU frequency表示当前的CPU运行频率
available cpufreq governors表示CPU支持的运行模式

当前CPU运行在最低频率下,需要将CPU改为高性能模式。

 

修改CPU运行模式

## 安装cpuspeed包
yum -y install cpuspeed

## 编辑cpuspeed配置文件
vim /etc/sysconfig/cpuspeed

## 设置GOVERNOR属性
GOVERNOR=performance

## 重启cpuspeed
/etc/init.d/cpuspeed restart

 

修改后使用“cpufreq-info -m”进行查看:

cpufreq-info -m 
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.20 GHz - 2.60 GHz
  available frequency steps: 2.60 GHz, 2.60 GHz, 2.50 GHz, 2.40 GHz, 2.30 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.60 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz
  available cpufreq governors: userspace, performance
  current policy: frequency should be within 1.20 GHz and 2.60 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 2.60 GHz (asserted by call to hardware).

发现当前频率为最高频率,修改成功。

 

查看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

 

上一篇:2019 年市面上不需独立供电的显卡有哪些?


下一篇:入手评测 RedmiBook Pro 14s/15s 怎么样