GithubHelp home page GithubHelp logo

orchingly / android-cpu-mem Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8 KB

Android 性能统计工具,统计系统cpu,内存,同时统计多个app的cpu和内存,输出表格

License: Apache License 2.0

Shell 100.00%

android-cpu-mem's Introduction

android-cpu-mem

通过循环执行 top, dumpsys meminfo, free来输出某个应用以及系统的内存和CPU,并将结果保存到.csv文件,可以通过Excel绘制图表直观展示应用性能 脚本可以同时统计多个app和系统本身的内存cpu使用数据

脚本通过的测试环境:

Android P(9) API 28

top --version: toybox 0.7.6-android

awk version 20121220

Android S(12) API 31

adb shell top --version

top --version: toybox 0.8.4-android

awk version 20210215

输出样例

seconds user_cpu sys_cpu com.android.systemui-MEM com.android.systemui-CPU sys_mem
1 58% 139% 80133 0.0 3768308
2 65% 57% 80101 0.0 3770012
3 43% 162% 79976 0.0 3766488
4 74% 100% 79989 0.0 3771724
5 107% 86% 79951 0.0 3774908
6 57% 146% 79948 0.0 3771672
7 74% 50% 79949 0.0 3773032

使用

修改参数

修改必要的参数,比如要监听的应用包名 PACKAGE_LIST,文件输出路径 OUTPUT_PATH,监控时间 TOTAL_TIME_SECONDS

运行并获取结果

#推送到系统目录
adb push sysui-settings-mem-cpu.sh /sdcard
#执行脚本
adb shell sh /sdcard/sysui-settings-mem-cpu.sh
#以下是输出类容
#监控的应用包名
packages: com.android.settings com.android.systemui
#表头字段
FIELDS: seconds,user_cpu,sys_cpu,com.android.settings-MEM,com.android.systemui-MEM,com.android.settings-CPU,com.android.systemui-CPU,sys_mem
#过滤的正则表达式
EXPR: $12 == "com.android.settings" || $12 == "com.android.systemui" || /%user/ && $12 !~ /awk/  
#文件输出路径
output path: /sdcard/cpu-mem.csv

更多

更多解析参考 Android 性能统计

android-cpu-mem's People

Contributors

orchingly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.