本文共 8468 字,大约阅读时间需要 28 分钟。
/sys/devices/system/cpu/cpu0
Z91:/sys/devices/system/cpu/cpu0 # ls -alls -altotal 0drwxr-xr-x 5 root root 0 2018-01-09 11:17 .drwxr-xr-x 13 root root 0 2018-01-09 11:17 ..lrwxrwxrwx 1 root root 0 2018-01-09 11:17 cpufreq -> ../cpufreq/policy0drwxr-xr-x 5 root root 0 2018-01-09 11:17 cpuidlelrwxrwxrwx 1 root root 0 2018-01-09 11:17 of_node -> ../../../../firmware/devicetree/base/cpus/cpu@0-rw-r--r-- 1 root root 4096 2018-01-09 11:17 onlinedrwxr-xr-x 2 root root 0 2018-01-09 11:17 powerlrwxrwxrwx 1 root root 0 2018-01-09 11:17 subsystem -> ../../../../bus/cpudrwxr-xr-x 2 root root 0 2018-01-09 11:17 topology-rw-r--r-- 1 root root 4096 2018-01-09 11:17 uevent
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
cat cpuinfo_cur_freq299000
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
Z91:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_frequenciescat scaling_available_frequencies1274000 1235000 1196000 1170000 1105000 1053000 1001000 962000 910000 845000 702000 624000 546000 416000 338000 299000
CPU 调频需要选择对应的档位,且参数不同机器该配置不同
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
Z91:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_governorscat scaling_available_governorsondemand userspace powersave interactive performance sched
通过echo命令,能够改变当前处理器的governor类型
Z91:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_governorcat scaling_governorsched
主要获取 CPU 的频率、调频档位及策略等
Z91:/sys/devices/system/cpu/cpu0/cpuidle # ls -alls -altotal 0drwxr-xr-x 5 root root 0 2018-01-09 11:17 .drwxr-xr-x 5 root root 0 2018-01-09 11:17 ..drwxr-xr-x 2 root root 0 2018-01-09 11:17 driverdrwxr-xr-x 2 root root 0 2018-01-09 11:17 state0drwxr-xr-x 2 root root 0 2018-01-09 11:17 state1
Z91:/sys/devices/system/cpu/cpu0/cpuidle/driver # ls -alls -altotal 0drwxr-xr-x 2 root root 0 2018-01-09 11:17 .drwxr-xr-x 5 root root 0 2018-01-09 11:17 ..-r--r--r-- 1 root root 4096 2018-01-09 11:17 name
Z91:/sys/devices/system/cpu/cpu0/cpuidle/driver # cat namecat namemt67xx_acao_cpuidle
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # ls -alls -altotal 0drwxr-xr-x 2 root root 0 2018-01-09 11:17 .drwxr-xr-x 5 root root 0 2018-01-09 11:17 ..-r--r--r-- 1 root root 4096 2018-01-09 11:17 desc-rw-r--r-- 1 root root 4096 2018-01-09 11:17 disable-r--r--r-- 1 root root 4096 2018-01-09 11:17 latency-r--r--r-- 1 root root 4096 2018-01-09 11:17 name-r--r--r-- 1 root root 4096 2018-01-09 11:17 power-r--r--r-- 1 root root 4096 2018-01-09 11:17 residency-r--r--r-- 1 root root 4096 2018-01-09 11:17 time-r--r--r-- 1 root root 4096 2018-01-09 11:17 usage
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat desccat descwfi
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat disablecat disable0
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat latencycat latency1
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat namecat namergidle
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat powercat power0
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat residencycat residency1
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat usagecat usage11611074
目录结构和 state0 一致
Z91:/sys/devices/system/cpu/cpu0/of_node # ls -alls -altotal 0drwxr-xr-x 2 root root 0 2018-01-10 14:56 .drwxr-xr-x 8 root root 0 2018-01-10 14:56 ..-r--r--r-- 1 root root 4 2018-01-10 14:56 clock-frequency-r--r--r-- 1 root root 15 2018-01-10 14:56 compatible-r--r--r-- 1 root root 28 2018-01-10 14:56 cpu-idle-states-r--r--r-- 1 root root 8 2018-01-10 14:56 cpu-release-addr-r--r--r-- 1 root root 4 2018-01-10 14:56 device_type-r--r--r-- 1 root root 5 2018-01-10 14:56 enable-method-r--r--r-- 1 root root 4 2018-01-10 14:56 linux,phandle-r--r--r-- 1 root root 4 2018-01-10 14:56 name-r--r--r-- 1 root root 4 2018-01-10 14:56 phandle-r--r--r-- 1 root root 4 2018-01-10 14:56 reg
1|Z91:/sys/devices/system/cpu/cpu0/of_node # cat clock-frequencycat clock-frequencyw5?
获取CPU架构信息
w5?Z91:/sys/devices/system/cpu/cpu0/of_node # cat compatiblecat compatiblearm,cortex-a53
cat 不出
cat 不出
Z91:/sys/devices/system/cpu/cpu0/of_node # cat device_typecat device_typecpu
psci
cat 不出
cpu
cat 不出
cat 不出
查询结果如下
Z91:/sys/devices/system/cpu/cpu0 # cat onlinecat online1
表示当前 CPU 正在使用
Z91:/sys/devices/system/cpu/cpu0/power # ls -allls -alltotal 0drwxr-xr-x 2 root root 0 2018-01-09 11:17 .drwxr-xr-x 5 root root 0 2018-01-09 11:17 ..-rw-r--r-- 1 root root 4096 2018-01-09 11:17 autosuspend_delay_ms-rw-r--r-- 1 root root 4096 2018-01-09 11:17 control-r--r--r-- 1 root root 4096 2018-01-09 11:17 runtime_active_time-r--r--r-- 1 root root 4096 2018-01-09 11:17 runtime_status-r--r--r-- 1 root root 4096 2018-01-09 11:17 runtime_suspended_time
cat 不出
Z91:/sys/devices/system/cpu/cpu0/power # cat autosuspend_delay_mscat autosuspend_delay_ms/system/bin/sh: cat: autosuspend_delay_ms: I/O error1
cat controlauto
cat runtime_active_time0
cat runtime_statusunsupported
cat runtime_suspended_time0
Z91:/sys/devices/system/cpu/cpu0/subsystem # ls -allls -alltotal 0drwxr-xr-x 4 root root 0 2018-01-10 15:15 .drwxr-xr-x 19 root root 0 2018-01-09 11:17 ..drwxr-xr-x 2 root root 0 2018-01-10 15:15 devicesdrwxr-xr-x 2 root root 0 2018-01-10 15:15 drivers-rw-r--r-- 1 root root 4096 2018-01-10 15:15 drivers_autoprobe--w------- 1 root root 4096 2018-01-10 15:15 drivers_probe--w------- 1 root root 4096 2018-01-10 15:15 uevent
Z91:/sys/devices/system/cpu/cpu0/subsystem/devices # ls -allls -alltotal 0drwxr-xr-x 2 root root 0 2018-01-10 15:15 .drwxr-xr-x 4 root root 0 2018-01-10 15:15 ..lrwxrwxrwx 1 root root 0 2018-01-10 15:17 cpu0 -> ../../../devices/system/cpu/cpu0lrwxrwxrwx 1 root root 0 2018-01-10 15:17 cpu1 -> ../../../devices/system/cpu/cpu1lrwxrwxrwx 1 root root 0 2018-01-10 15:17 cpu2 -> ../../../devices/system/cpu/cpu2lrwxrwxrwx 1 root root 0 2018-01-10 15:17 cpu3 -> ../../../devices/system/cpu/cpu3
空文件夹
Z91:/sys/devices/system/cpu/cpu0/subsystem # cat drivers_autoprobecat drivers_autoprobe1
Z91:/sys/devices/system/cpu/cpu0/subsystem # cat drivers_probecat drivers_probe/system/bin/sh: cat: drivers_probe: Permission denied
1|Z91:/sys/devices/system/cpu/cpu0/subsystem # cat ueventcat uevent/system/bin/sh: cat: uevent: Permission denied
Z91:/sys/devices/system/cpu/cpu0/topology # ls -allls -alltotal 0drwxr-xr-x 2 root root 0 2018-01-09 11:17 .drwxr-xr-x 5 root root 0 2018-01-09 11:17 ..-r--r--r-- 1 root root 4096 2018-01-09 11:17 core_id-r--r--r-- 1 root root 4096 2018-01-09 11:17 core_siblings-r--r--r-- 1 root root 4096 2018-01-09 11:17 core_siblings_list-r--r--r-- 1 root root 4096 2018-01-09 11:17 physical_package_id-r--r--r-- 1 root root 4096 2018-01-09 11:17 thread_siblings-r--r--r-- 1 root root 4096 2018-01-09 11:17 thread_siblings_list
cat core_id0
cat core_siblingsf
cat core_siblings_list0-3
cat physical_package_id0
cat thread_siblings1
cat thread_siblings_list0
查询结果如下
Z91:/sys/devices/system/cpu/cpu0 # cat ueventcat ueventOF_NAME=cpuOF_FULLNAME=/cpus/cpu@0OF_TYPE=cpuOF_COMPATIBLE_0=arm,cortex-a53OF_COMPATIBLE_N=1MODALIAS=cpu:type:aarch64:feature:,0000,0001,0002,0003,0004,0005,0006,0007
转载地址:http://yocti.baihongyu.com/