On 7/28/25 7:49 AM, André Draszik wrote:
Btw, my complete command was (should probably have added that to the commit message in the first place):
for rw in read write ; do echo "rw: ${rw}" for jobs in 1 8 ; do echo "jobs: ${jobs}" for it in $(seq 1 5) ; do fio --name=rand${rw} --rw=rand${rw} \ --ioengine=libaio --direct=1 \ --bs=4k --numjobs=${jobs} --size=32m \ --runtime=30 --time_based --end_fsync=1 \ --group_reporting --filename=/foo \ | grep -E '(iops|sys=|READ:|WRITE:)' sleep 5 done done done
Please run performance tests in recovery mode against a block device (/dev/block/sd...) instead of running performance tests on top of a filesystem. One possible approach for retrieving the block device name is as follows:
adb shell readlink /dev/block/by-name/userdata
There may be other approaches for retrieving the name of the block device associated with /data. Additionally, tuning for maximum performance is useful because it eliminates impact from the process scheduler on block device performance measurement. An extract from a scrip that I use myself to measure block device performance on Pixel devices is available below.
Best regards,
Bart.
optimize() { local clkgate_enable c d devfreq disable_cpuidle governor nomerges iostats local target_freq ufs_irq_path
if [ "$1" = performance ]; then clkgate_enable=0 devfreq=max disable_cpuidle=1 governor=performance # Enable I/O statistics because the performance impact is low and # because fio reports the I/O statistics. iostats=1 # Disable merging to make tests follow the fio arguments. nomerges=2 target_freq=cpuinfo_max_freq persist_logs=false else clkgate_enable=1 devfreq=min disable_cpuidle=0 governor=sched_pixel iostats=1 nomerges=0 target_freq=cpuinfo_min_freq persist_logs=true fi
for c in $(adb shell "echo /sys/devices/system/cpu/cpu[0-9]*"); do for d in $(adb shell "echo $c/cpuidle/state[1-9]*"); do adb shell "if [ -e $d ]; then echo $disable_cpuidle > $d/disable; fi" done adb shell "cat $c/cpufreq/cpuinfo_max_freq > $c/cpufreq/scaling_max_freq; cat $c/cpufreq/${target_freq} > $c/cpufreq/scaling_min_freq; echo ${governor} > $c/cpufreq/scaling_governor; true" \ 2>/dev/null done
if [ "$(adb shell grep -c ufshcd /proc/interrupts)" = 1 ]; then # No MCQ or MCQ disabled. Make the fastest CPU core process UFS # interrupts. # shellcheck disable=SC2016 ufs_irq_path=$(adb shell 'a=$(echo /proc/irq/*/ufshcd); echo ${a%/ufshcd}') adb shell "echo ${fastest_cpucore} > ${ufs_irq_path}/smp_affinity_list; true" else # MCQ is enabled. Distribute the completion interrupts over the # available CPU cores. local i=0 local irqs irqs=$(adb shell "sed -n 's/:.*GIC.*ufshcd.*//p' /proc/interrupts") for irq in $irqs; do adb shell "echo $i > /proc/irq/$irq/smp_affinity_list; true" i=$((i+1)) done fi
for d in $(adb shell echo /sys/class/devfreq/*); do case "$d" in *gpu0) continue ;; esac local min_freq min_freq=$(adb shell "cat $d/available_frequencies | tr ' ' '\n' | sort -n | case $devfreq in min) head -n1;; max) tail -n1;; esac") adb shell "echo $min_freq > $d/min_freq" # shellcheck disable=SC2086 if [ "$devfreq" = "max" ]; then echo "$(basename $d)/min_freq: $(adb shell cat $d/min_freq) <> $min_freq" fi done
for d in $(adb shell echo /sys/devices/platform/*.ufs); do adb shell "echo $clkgate_enable > $d/clkgate_enable" done
adb shell setprop logd.logpersistd.enable ${persist_logs}
adb shell "for b in /sys/class/block/{sd[a-z],dm*}; do if [ -e $b ]; then [ -e $b/queue/iostats ] && echo ${iostats} >$b/queue/iostats; [ -e $b/queue/nomerges ] && echo ${nomerges} >$b/queue/nomerges; [ -e $b/queue/rq_affinity ] && echo 2 >$b/queue/rq_affinity; [ -e $b/queue/scheduler ] && echo ${iosched} >$b/queue/scheduler; fi done; true"
adb shell "grep -q '^[^[:blank:]]* /sys/kernel/debug' /proc/mounts || mount -t debugfs none /sys/kernel/debug" }