Android CPU性能文件位置

来源:互联网 发布:软件用户手册英文模板 编辑:程序博客网 时间:2024/06/06 07:00

CPU信息目录:/sys/devices/system/cpu/


通过cpu0、cpu1、cpu2、cpu3这几个文件推断出CPU是四核

cpu0最大频率: /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq

cpu0可以替换成cpu1、cpu2、cpu3等等。



可以看出cpu0的最大频率是1.4GHZ

cpu0最小频率: /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq

cpu0可以替换成cpu1、cpu2、cpu3等等。



可以看出cpu0的最小频率是960MHZ

CPU0当前频率: /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

cpu0可以替换成cpu1、cpu2、cpu3等等。



可以看出cpu0当前频率是960MHZ

内核活动信息: /proc/stat



cpu行表示cpu总的信息,cpu0、cpu1、cpu2、cpu3表示cpu各个核的信息。
intr:给出中断的信息,第一个为自系统启动以来,发生的所有的中断的次数;然后每个数对应一个特定的中断自系统启动以来所发生的次数。
ctxt:给出了自系统启动以来CPU发生的上下文交换的次数。
btime:给出了从系统启动到现在为止的时间,单位为秒。
processes:表示自系统启动以来所创建的任务的个数目。
procs_running:当前运行队列的任务的数目。
procs_blocked:当前被阻塞的任务的数目。

cpu行各个字段含义:
user (952279) 从系统启动开始累计到当前时刻,用户态的CPU时间(单位:jiffies) ,不包含 nice值为负进程。1jiffies=0.01秒
nice (257992) 从系统启动开始累计到当前时刻,nice值为负的进程所占用的CPU时间(单位:jiffies)
system (848804) 从系统启动开始累计到当前时刻,核心时间(单位:jiffies)
idle (2007602) 从系统启动开始累计到当前时刻,除硬盘IO等待时间以外其它等待时间(单位:jiffies)
iowait (50698) 从系统启动开始累计到当前时刻,硬盘IO等待时间(单位:jiffies) ,
irq (124) 从系统启动开始累计到当前时刻,硬中断时间(单位:jiffies)
softirq (115073) 从系统启动开始累计到当前时刻,软中断时间(单位:jiffies)

CPU使用率计算:

CPU时间=user+system+nice+idle+iowait+irq+softirq
CPU利用率可以使用以下两个方法。先取两个采样点,然后计算其差值:
cpu usage=(idle_2-idle_1)/(cpu时间_2-cpu时间_1)*100
cpu usage=[(user_2 +system_2+nice_2) - (user_1 +system_1+nice_1)]/(cpu时间_2 - cpu时间_1)*100

CPU温度:

不同cpu存放温度的文件不同,大致在以下位置:
/sys/devices/system/cpu/cpu0/cpufreq/cpu_temp
/sys/devices/system/cpu/cpu0/cpufreq/FakeShmoo_cpu_temp
/sys/class/thermal/thermal_zone0/temp
/sys/class/i2c-adapter/i2c-4/4-004c/temperature
/sys/devices/platform/tegra-i2c.3/i2c-4/4-004c/temperature
/sys/devices/platform/omap/omap_temp_sensor.0/temperature
/sys/devices/platform/tegra_tmon/temp1_input
/sys/kernel/debug/tegra_thermal/temp_tj
/sys/devices/platform/s5p-tmu/temperature
/sys/class/thermal/thermal_zone1/temp
/sys/class/hwmon/hwmon0/device/temp1_input
/sys/devices/virtual/thermal/thermal_zone1/temp
/sys/devices/platform/s5p-tmu/curr_temp
/sys/devices/virtual/thermal/thermal_zone0/temp
/sys/class/thermal/thermal_zone3/temp
/sys/class/thermal/thermal_zone4/temp

0 0
原创粉丝点击