Android获取CPU频率和温度

2,079 阅读1分钟

  • 查看CPU是几核

    cat /proc/cpuinfo | grep ^processor | wc -l

    8

  • 查看CPU有几个核在运行

    cat /sys/devices/system/cpu/online

    0-1,4-7

  • 查看系统支持多少个核:

    cat /sys/devices/system/cpu/present

    0-7

  • 开启某个CPU核

    echo 1 > /sys/devices/system/cpu/cpu#/online

    注: #为数字,标识哪个CPU核,如八核CPU, 则#取值为0~7

  • 查看CPU核的运行频率

    cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

    960000

  • 查看CPU核动态调频的Governor

    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

    interactive

  • 查看当前CPU核的温度

    cat /sys/class/thermal/thermal_zone9/temp

    42000 42或者42000,代表约42度等 注: SoC系统往往有多个thermal sensor, 需要分辨监测CPU核温度的是哪些sensor,Qualcomm平台可参考/system/etc/thermal-engine.conf文件.

  • 查看CPU类型

    cat /sys/class/thermal/thermal_zone7/type mtktscpu注: MTK的CPU名称类似为mtktscpu,Qualcomm的CPU名称类似为tsens_tz_sensor