Release of the tool for benchmarking sound server power efficiency
Earlier today (sorry - yesterday!) at the audio mini-summit I promised to release a tool that I used for evaluating sound server energy efficiency. The tool is a shell script, which is attached, together with an example report. It needs to be run as root (in a throwaway VM, if you need), with one argument: the name of a directory to be created and populated with various files. The script needs the "debootstrap" program to be installed.
The script will populate the directory with a Debian Jessie amd64 installation, compile CRAS there, and pack everything into an initramfs file that can be used for evaluation. It will produce two files as the main result: vmlinuz and initramfs.img, near the directory that it creates.
The initramfs will play a sound file in a loop (please use headphones, so that your laptop does not annoy anyone) and log the laptop battery energy or charge. If it drops below 75% of the initial value, the experiment is terminated, the log is saved to the disk, and the laptop is powered off.
You can add this to your boot loader. Example for extlinux:
LABEL battery-pulse7
MENU LABEL Battery Benchmark (pulseaudio 7)
LINUX /boot/battery-benchmark/vmlinuz
INITRD /boot/battery-benchmark/initramfs.img
APPEND quiet root=ram save=/dev/md126p1 test_case=pulse pa_version=7 latency_msec=28 dobenchmark
Here is the meaning of the arguments:
quiet: don't print verbose messages to the console
root=ram: use ramfs (not tmpfs) for the extracted initramfs
save=/dev/...: save the log to this block device at the end. The /battery-reports directory will be created, and the log will be placed there. FAT32, NTFS and EXT4 filesystems are supported. test_case=pulse|alsa|cras: what we want to test. alsa means raw hw device.
pa_version=5|6|7: version of PulseAudio to testlatency_msec: buffer size or its equivalent, in millisecondscras_output: the correct output node for CRAS. Usually 5:0 (the default) or 6:0, please see cras_test_client --dump_server_info
resampler: force a given resampler for PulseAudio (if not given, no resampler is used)
dobenchmark: dpms-blank the screen and perform the measurement automatically
To replicate the results in my presentation, it is sufficient to obtain logs for all three versions of PulseAudio, as well as ALSA and CRAS, for the following latency_msec values: 7, 28, 448. Please send any reports created by this tool to me directly, and mention the laptop model.
A big "thanks" goes to Felipe Sateler for providing Debian packages of PulseAudio that are mostly compatible with Debian Jessie.
Signature · 1 line
Alexander E. Patrakov
# quiet pcie_aspm=force root=ram save=/dev/md126p1 test_case=pulse pa_version=7 latency_msec=28 dobenchmark initrd=/boot/battery-benchmark/initramfs.img BOOT_IMAGE=/boot/battery-benchmark/vmlinuz 1 36360000 103 36360000 205 36360000 308 36360000 410 36360000 512 36360000 614 36360000 717 36230000 819 36120000 921 35990000 1023 35850000 1126 35740000 1228 35640000 1330 35530000 1432 35420000 1535 35330000 1637 35200000 1739 35090000 1842 35010000 1944 34900000 2046 34810000 2148 34680000 2251 34590000 2353 34480000 2455 34380000 2557 34180000 2660 33950000 2762 33740000 2864 33520000 2966 33280000 3069 33110000 3171 32890000 3273 32690000 3375 32460000 3478 32260000 3580 32060000 3682 31870000 3784 31670000 3887 31450000 3989 31260000 4091 31060000 4194 30880000 4296 30680000 4398 30510000 4500 30310000 4603 30140000 4705 29970000 4807 29750000 4909 29570000 5012 29390000 5114 29230000 5216 29000000 5318 28850000 5421 28680000 5523 28460000 5625 28260000 5727 28120000 5830 27940000 5932 27740000 6034 27540000 6136 27370000 6239 27200000