These are a collection of simple workloads designed to induce various levels of power consumption on the CPU and memory subsystems of an SOC. All of these workloads run in an infinite loop and are designed to be measured across a fixed duration. They are not benchmarks and provide no information about the performance of various cores; they are only designed to generate different amounts of load for the purposes of measuring power consumption.
simd
is a large double-precision matrix multiplication using Eigenmemcpy
copies a 1GB buffer to a second 1GB buffer using bionic memcpy
memcpy-16kb
copies a 16KB buffer to a second 16KB buffer using bionic memcpy
memcpy-2048kb
copies a 2048KB buffer to a second 2048KB buffer using bionic memcpy
memcpy-byte
copies a 1GB buffer to a second 1GB buffer using byte assignmentwhile-true
stalls at a while (true);
, which becomes an unconditional branch to the same instructionpss
allocates a 1GB buffer and repeatedly measures the process's PSSmm
.adb push out/target/product/<device target>/system/bin/simd /data/local/tmp
stop
mkdir /dev/cpuset/cpu7
echo 0 > /dev/cpuset/cpu7/mems
echo 7 > /dev/cpuset/cpu7/cpus
echo $$ > /dev/cpuset/cpu7/cgroup.procs
cat /sys/devices/system/cpu/cpu7/cpufreq/scaling_available_frequencies
# 500000 851000 984000 1106000 1277000 1426000 1582000 1745000 1826000 2048000 2188000 2252000 2401000 2507000 2630000 2704000 2802000 2850000
echo 1826000 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq
echo 1826000 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq
dumpsys android.hardware.power.stats.IPowerStats/default | tail -27 && sleep 120 && killall memcpy-2048kb && echo "done" && dumpsys android.hardware.power.stats.IPowerStats/default | tail -27
from a separate adb shell
to the shell running the test. Alternately, a breakout board with per-rail measurements or a separate battery monitor could be used.