Basic command
Qualcomm
Following command is used to query GPU busy ratio on Qualcomm SOC.
adb shell cat /sys/class/kgsl/kgsl-3d0/gpu_busy_percentage
MTK
Following command is used to query GPU idle ratio on MTK SOC.
adb shell cat /sys/module/ged/parameters/gpu_idle
Useful Script
Following script is used to query realtime GPU usage ratio every 0.1 second.
#!/bin/bash
manufacturer=`adb shell getprop ro.product.product.manufacturer`
if [ $manufacturer == "QUALCOMM" ]; then
while true
do
rst=`adb shell cat /sys/class/kgsl/kgsl-3d0/gpu_busy_percentage`
rst=`echo $rst | awk '{ gsub(/%/,""); print $0 }' `
echo -n "$rst "
sleep 0.1
done
else
while true
do
rst=`expr 100 - $(adb shell cat /sys/module/ged/parameters/gpu_idle)`
echo -n "$rst "
sleep 0.1
done
fi