Skip to content

Commit 506994c

Browse files
author
Guang Yang
committed
Device telemetry for benchmark
1 parent 311489f commit 506994c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

extension/benchmark/android/benchmark/android-llm-device-farm-test-spec.yml.j2

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ phases:
105105
echo "*.model tokenizer files found in /data/local/tmp/minibench/"
106106
fi
107107

108+
- echo "Collect Device Telemetry CPU scaling configuration"
109+
- |
110+
adb -s $DEVICEFARM_DEVICE_UDID shell '
111+
for core_path in /sys/devices/system/cpu/cpu*/cpufreq; do
112+
if [ -d "$core_path" ]; then
113+
core_name=$(basename $(dirname $core_path))
114+
governor=$(cat $core_path/scaling_governor 2>/dev/null || echo "N/A")
115+
min_freq=$(cat $core_path/scaling_min_freq 2>/dev/null || echo "N/A")
116+
max_freq=$(cat $core_path/scaling_max_freq 2>/dev/null || echo "N/A")
117+
echo "$core_name|$governor|$min_freq|$max_freq"
118+
fi
119+
done
120+
' > $DEVICEFARM_LOG_DIR/cpu_scaling_config.txt
121+
108122
- echo "Collect device state before running"
109123
- |
110124
adb -s $DEVICEFARM_DEVICE_UDID shell 'cat /sys/devices/system/cpu/cpu*/cpufreq/stats/time_in_state /sys/devices/system/cpu/cpu*/cpufreq/stats/trans_table' > $DEVICEFARM_LOG_DIR/state_before.txt
@@ -132,7 +146,7 @@ phases:
132146
adb -s $DEVICEFARM_DEVICE_UDID shell am start -W -n org.pytorch.minibench/.BenchmarkActivity \
133147
--es "model_dir" "/data/local/tmp/minibench"
134148
fi
135-
149+
136150
- echo "Collect device state after running"
137151
- |
138152
adb -s $DEVICEFARM_DEVICE_UDID shell 'cat /sys/devices/system/cpu/cpu*/cpufreq/stats/time_in_state /sys/devices/system/cpu/cpu*/cpufreq/stats/trans_table' > $DEVICEFARM_LOG_DIR/state_after.txt

0 commit comments

Comments
 (0)