• MySQL Hardware--CentOS 6查看CPU信息


    查看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
  • 相关阅读:
    【POJ3069】Saruman's Army
    【POJ2453】An Easy Problem
    【POJ2386】Lake Counting
    【POJ2251】Dungeon Master
    【POJ1664】放苹果
    【基础】枚举学习笔记
    算法时空复杂度【OI缩水版】
    【POJ2018】Best Cow Fences
    【POJ3889】Fractal Streets(分形图)
    【BZOJ2296】随机种子(构造)
  • 原文地址:https://www.cnblogs.com/gaogao67/p/10749655.html
Copyright © 2020-2023  润新知