收集GPU Counter并写入Atrace/Hitrace中。
导入工具包counters_gather文件
- HarmonyOS设备:打开工具安装目录下“<installation_folder>\profiling\android\counters_gather”,导入counters_gather_ecosystem文件到指定目录adb push counters_gather_ecosystem /data/local/tmp
- HarmonyOS 5.0及以上版本设备:打开工具安装目录下“<installation_folder>\profiling\ohos\counters_gather”,导入counters_gather_ecosystem文件到指定目录hdc file send counters_gather_ecosystem /data/local/tmp
使用系统内置counters_gather文件
仅HarmonyOS 5.0及以上版本设备支持系统内置counters_gather文件,且系统版本为2025年6月1日之后的版本才支持,无需导入即可直接使用
执行counters_gather文件
- 工具包counters_gather文件输入命令:
adb shell # for HarmonyOS
hdc shell # for HarmonyOS 5.0及以上版本
cd /data/local/tmp
chmod +x counters_gather_ecosystem
./counters_gather_ecosystem -s <u32> -p <u32>
ctrl+c #提前结束命令
系统内置counters_gather文件输入命令:
hdc shell
counters_gather -s <u32> -p <u32>
counters_gather -c stop #提前结束命令
- 同步启动任意可以收集Atrace/Hitrace的工具即可收集counter数据。
- 收集到的counter数据展示在counters_gather进程对应的track上。
- counters_gather执行时间到期之后自动结束。
可选选项
- -p <u32>,--period <u32>:以毫秒为单位的采样周期,范围1-60,默认值为1。
- -s <u32>,--seconds <u32>:以秒为单位的持续时间,范围1-86400,默认值为20。
- -i <u32>,--set-id <u32>:counter set ID,默认值为0。
- -c <start/stop>,--command <start/stop>:控制命令,默认是开始。
- -v,--version:显示工具版本。