- One Click软件
- 软件功能
- 开发工具
- 支持平台
- 软件实现原理
- CommonCommand
- 命令输入栏
- 功能按钮区
- 输出栏
- simpleperf
- list
- stat
- record
- report
- FlameGraph
- XTS
- adb常用命令一键执行,如获取android设备号(adb devices)、拍照、截屏等
- Linux常用命令一键执行(待开发)
- Git常用命令一键执行(待开发)
- simpleperf(Android性能分析工具)一键执行,并生成火焰图
- XTS测试一键执行,测试结果解析,并针对fail项给出历史解决方案供参考
- Qt5.12
- Linux
运用QThread启动多线程,实现主线程(界面)和子线程(processor)分离,运用QProcess (The QProcess class is used to start external programs and to communicate with them)启动/bin/bash脚本,在UI界面输入命令或点击按钮将命令通过发送信号(emit signal)的形式传递至processor,然后由processor启动bash执行命令,并将执行结果、状态、output同样已信号的方式返回至UI,显示在textEdit。
CommonCommand模块界面包含3个部分
- 命令输入栏
- 功能按钮区
- 输出栏
手动输入执行命令,通常用于自定义带参命令的执行。
输入栏自动补全功能如下:
功能按钮区save command:保存当前输入的命令,以将该命令更新至补全词库(native_cmd_list.txt)
complete regular:补全模式选择
目前已实现的功能有:adb device,root,remount,手机截屏,拍照等
示例:截屏
通过下面输出栏可以看到,这个按钮点击事件其实是在执行:adb shell screencap -p /storage/img_20220420171252.png;adb pull /storage/img_20220420171252.png capture(将图片pull到./capture),另外可以看到在执行命令时,最下方状态栏可以看到有绿灯闪烁,表示命令正在执行过程中,执行结束,灯灭。
执行命令实时回显,如上图。类似shell终端,将输出结果实时显示在textEdit控件。
simpleperfsimpleperf = simple + perf
simple:不是简单的意思,而是采样
perf:performance–性能
list 命令列出设备上所有可用的事件。不同的设备可能支持不同的事件,因为它们具有不同的硬件和内核
stat可以看到输出栏可以拖拽出来方便查看,可双击也可直接拖拽
获取一段时间内,要分析的进程中发生了多少事件。通过传入不同参数,我们可以选择要使用哪些事件、要监听哪些进程/线程,监听多长时间以及打印间隔,当前可支持客制化的参数如图所示,更详细的参数参见‘simpleperf stat -h’,当然你也可以直接在Command中的命令行执行自己客制化的参数
$ simpleperf stat -h
Usage: simpleperf stat [options] [command [command-args]]
Gather performance counter information of running [command].
Options:
-p pid1,pid2,... Stat events on existing processes. #分析进程
-t tid1,tid2,... Stat events on existing threads. #分析线程
-a Collect system-wide information. #收集系统范围的信息
--cpu cpu_item1,cpu_item2,... Collect information only on the selected cpus. #收集选择的cup信息
-e event1[:modifier1],event2[:modifier2],... Select a list of events to count. #选择要统计的事件表
--duration time_in_sec Monitor for time_in_sec seconds. #选择记监听时长(s)
$ simpleperf stat -e cache-references,cache-misses -a --duration 1
Performance counter statistics:
# count event_name # count / runtime, runtime / enabled_time
774,728,087 cache-references # 96.513 M/sec (100%)
31,985,983 cache-misses # 4.128672% miss rate (100%)
Total test time: 1.001893 seconds.
record默认分析命令: adb shell system/bin/simpleperf stat -e cache-references,cache-misses -a --duration 10
以采样方式生成profile data,当前可支持客制化的参数如图所示,更详细的参数参见‘simpleperf stat -h’,当然你也可以直接在Command中的命令行执行自己客制化的参数
默认执行命令:adb shell rm /data/local/tmp/perf.data;adb shell system/bin/simpleperf record -o /data/local/tmp/perf.data -e task-clock:u -f 1000 -g --duration 10 --log info --app com.tcl.camera;adb pull /data/local/tmp/perf.data
记录相机app10s内的性能数据,并pull到本地
$ simpleperf record -h
Usage: simpleperf record [options] [--] [command [command-args]]
Gather sampling information of running [command].
Options:
-p pid1,pid2,... Record events on existing processes. #记录进程事件
-t tid1,tid2,... Record events on existing threads. #记录线程事件
-a System-wide collection. #系统范围收集
--cpu cpu_item1,cpu_item2,... Collect information only on the selected cpus. #同stat
-e event1[:modifier1],event2[:modifier2],... Select a list of events to count. #同stat
-f freq Set event sample frequency. It means recording at most [freq] samples every second. #设置事件采样频率,意味着每秒最多采样[freq]次
--duration time_in_sec Monitor for time_in_sec seconds #同stat
-o record_file_name Set record file name, default is perf.data. #设置profile data文件名,默认perf.data
--call-graph fp | dwarf[,] Enable call graph recording. #启用调用图记录
-g Same as '--call-graph dwarf'.
report
生成数据报告
默认执行命令:python scripts/report_sample.py > out.perf
$ simpleperf report Cmdline: /system/bin/simpleperf record -g sleep 1 Arch: arm64 Event: cpu-cycles (type 0, config 0) Samples: 56 Event count: 13885436 Overhead Command Pid Tid Shared Object Symbol 9.61% sleep 14852 14852 [kernel.kallsyms] vma_link 8.97% sleep 14852 14852 linker64 soinfo_do_lookup_impl 6.42% sleep 14852 14852 linker64 BionicAllocator::alloc_impl 6.11% sleep 14852 14852 [kernel.kallsyms] __follow_mount_rcu 5.83% sleep 14852 14852 [kernel.kallsyms] clear_page ...FlameGraph
将数据报告绘制程火焰图
XTSFlameGraph/stackcollapse-perf.pl out.perf > out.folded;FlameGraph/flamegraph.pl out.folded > graph.svg
- 选择本地xts套件
- 选择要执行的命令
- 选择执行模块(目前只支持camera模块)
- 输入要执行的test(输入为空,则运行整个模块)
- run cts
cts 运行结束之后会自动解析results/latest/result.xml,将结果显示在tableView中,并且会检索fail项的历史解决方案
- 加载results文件



