博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android 系统查看sys-devices-system-cpu-cpu0 目录结构
阅读量:4147 次
发布时间:2019-05-25

本文共 8468 字,大约阅读时间需要 28 分钟。

一、 /sys/devices/system/cpu/cpu0 目录结构

/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

二、重要信息获取

1. CPU 频率

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

cat cpuinfo_cur_freq299000

2.CPU 所支持的主频率列表(KHZ)

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 调频需要选择对应的档位,且参数不同机器该配置不同

3.CPU 策略policy

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
  1. ondemand 表示使用内核提供的功能,可以动态调节频率
  2. userspace 表示用户模式,在此模式下允许其他用户程序调节CPU频率
  3. powersvae 表示省电模式,通常是在最低频率下运行
  4. interactive ondemand相似,规则是“快升慢降”
  5. performance 表示不降频,最高性能
  6. sched 基于调度器的 CPU 调频机制

4.查看当前 CPU 的运行模式

通过echo命令,能够改变当前处理器的governor类型

Z91:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_governorcat scaling_governorsched

三、 目录详情

1. cpufreq

主要获取 CPU 的频率、调频档位及策略等

2. cpuidle

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

2.1 cpuidle/driver

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
2.1.1 cpuidle/driver/name
Z91:/sys/devices/system/cpu/cpu0/cpuidle/driver # cat namecat namemt67xx_acao_cpuidle

2.2 cpuidle/state0

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
2.2.2 cpuidle/state0/desc
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat desccat descwfi
2.2.2 cpuidle/state0/disable
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat disablecat disable0
2.2.2 cpuidle/state0/latency
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat latencycat latency1
2.2.2 cpuidle/state0/name
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat namecat namergidle
2.2.2 cpuidle/state0/power
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat powercat power0
2.2.2 cpuidle/state0/residency
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat residencycat residency1
2.2.2 cpuidle/state0/usage
Z91:/sys/devices/system/cpu/cpu0/cpuidle/state0 # cat usagecat usage11611074

2.3 cpuidle/state1

目录结构和 state0 一致

3. of_node

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
3.1 /of_node/clock-frequency
1|Z91:/sys/devices/system/cpu/cpu0/of_node # cat clock-frequencycat clock-frequencyw5?
3.2 /of_node/compatible

获取CPU架构信息

w5?Z91:/sys/devices/system/cpu/cpu0/of_node # cat compatiblecat compatiblearm,cortex-a53
3.3 /of_node/cpu-idle-states

cat 不出

3.4 /of_node/cpu-release-addr

cat 不出

3.5 /of_node/device_type
Z91:/sys/devices/system/cpu/cpu0/of_node # cat device_typecat device_typecpu
3.6 /of_node/enable-method
psci
3.7 /of_node/linux,phandle

cat 不出

3.8 /of_node/name
cpu
3.9 /of_node/phandle

cat 不出

3.10 /of_node/reg

cat 不出

4. online

查询结果如下

Z91:/sys/devices/system/cpu/cpu0 # cat onlinecat online1

表示当前 CPU 正在使用

5. power

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
5.1 /power/autosuspend_delay_ms

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
5.2 /power/control
cat controlauto
5.3 /power/runtime_active_time
cat runtime_active_time0
5.4 /power/runtime_status
cat runtime_statusunsupported
5.5 /power/runtime_suspended_time
cat runtime_suspended_time0

6. subsystem

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
6.1 /subsystem/devices
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
6.2 /subsystem/drivers

空文件夹

6.3 /subsystem/drivers_autoprobe
Z91:/sys/devices/system/cpu/cpu0/subsystem # cat drivers_autoprobecat drivers_autoprobe1
6.4 /subsystem/drivers_probe
Z91:/sys/devices/system/cpu/cpu0/subsystem # cat drivers_probecat drivers_probe/system/bin/sh: cat: drivers_probe: Permission denied
6.5 /subsystem/uevent
1|Z91:/sys/devices/system/cpu/cpu0/subsystem # cat ueventcat uevent/system/bin/sh: cat: uevent: Permission denied

7. topology

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

7.1 topology/core_id

cat core_id0

7.2 topology/core_siblings

cat core_siblingsf

7.3 topology/core_siblings_list

cat core_siblings_list0-3

7.4 topology/physical_package_id

cat physical_package_id0

7.5 topology/thread_siblings

cat thread_siblings1

7.6 topology/thread_siblings_list

cat thread_siblings_list0

8. uevent

查询结果如下

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/

你可能感兴趣的文章
如何防止sql注入
查看>>
springmvc传值
查看>>
在Eclipse中查看Android源码
查看>>
Android使用webservice客户端实例
查看>>
[转]C语言printf
查看>>
C 语言学习 --设置文本框内容及进制转换
查看>>
C 语言 学习---判断文本框取得的数是否是整数
查看>>
C 语言 学习---ComboBox相关、简单计算器
查看>>
C 语言 学习---ComboBox相关、简易“假”管理系统
查看>>
C 语言 学习---回调、时间定时更新程序
查看>>
C 语言 学习---复选框及列表框的使用
查看>>
第十一章 - 直接内存
查看>>
JDBC核心技术 - 上篇
查看>>
一篇搞懂Java反射机制
查看>>
Single Number II --出现一次的数(重)
查看>>
Palindrome Partitioning --回文切割 深搜(重重)
查看>>
对话周鸿袆:从程序员创业谈起
查看>>
Mysql中下划线问题
查看>>
Xcode 11 报错,提示libstdc++.6 缺失,解决方案
查看>>
idea的安装以及简单使用
查看>>