Linux(Android)性能调试基本命令一

CPU Loading

  • uptime  # 查看CPU 1Min, 5Min, 15Min Loading值
  • lscpu or cat /proc/cpuinfo  # 查看cpu信息,核心数
  • top or htop  # 查看CPU实时Loading情况和相关进程占用率

CPU当前运行频率:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq # 800382

CPU当前功耗策略

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  # interactive conservative userspace powersave ondemand performance

CPU当前温度:

  • cat /sys/devices/virtual/thermal/thermal_zone0/temp  # 27800
  • 或安装lm-sensors并利用sensors查看
  • cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp  # 查看CPU critical降频温度

Memory usage:

free -h

Android利用 adb screencap 命令截屏

adb shell screencap -p /sdcard/screenshot.png && adb pull /sdcard/screenshot.png .