Captures GPU counters and writes them to Atrace/Hitrace.
Importing the counters_gather File in the Tool Package
- For a HarmonyOS device, import the counters_gather_ecosystem file in the tool installation directory <installation_folder>\profiling\android\counters_gather on the PC to the adb push counters_gather_ecosystem /data/local/tmp directory on the device.
- For a HarmonyOS NEXT device, import the counters_gather_ecosystem file in the tool installation directory <installation_folder>\profiling\ohos\counters_gather on the PC to the hdc file send counters_gather_ecosystem /data/local/tmp directory on the device.
Using the Built-in System File counters_gather
Only devices running HarmonyOS NEXT released after June 1st, 2025 support the built-in counters_gather file. The file can be used directly without import.
Executing the counters_gather File
- Run the following commands if the counters_gather file in the tool package is used:
adb shell # for HarmonyOS
hdc shell # for HarmonyOS NEXT
cd /data/local/tmp
chmod +x counters_gather_ecosystem
./counters_gather_ecosystem -s <u32> -p <u32>
ctrl+c # Forcibly terminate the counters_gather_ecosystem command execution.
Run the following commands if the built-in counters_gather file is used:
hdc shell
counters_gather -s <u32> -p <u32>
counters_gather -c stop # Forcibly terminate the counters_gather command execution.
- Start any tool that can collect Atrace/Hitrace data to capture counters.
- The captured counters are displayed on the track corresponding to the counters_gather process.
- The counters_gather command automatically terminates after the execution time expires.
Options
- -p <u32>, --period <u32>: sampling period, in ms. Value range: 1–60. Default value: 1.
- -s <u32>, --seconds <u32>: duration, in seconds. Value range: 1–86400. Default value: 20.
- -i <u32>, --set-id <u32>: counter set ID. Default value: 0.
- -c <start/stop>, --command <start/stop>: control command. Default value: start.
- -v, --version: displays the tool version.