mixxx prep script for laptops to help performance

Here is a simple script I run after starting up mixxx in a separate terminal as root, i.e.

sudo bash mixxx-max-perf.sh

This is to get maximum CPU performance if the laptop you are running MIXXX on is plugged into wall power, by setting the CPU power management policy to “performance” – so don’t run if you are on batteries!

Also it gets the pid of the running MIXXX process and sets it to use the real time scheduler. I’m not sure how much this helps with the lowlatency kernel loaded, but I’m just letting MIXXX get first choice as while I’m playing music it is the app that I want to get precedence.

I’m running 4 separate “cpufreq-set” commands, one for every CPU core on my laptop, but reading the man page I might be able to use the “-r” option to set all related CPUS with one command?

cat mixxx-max-perf.sh
sudo cpufreq-set --cpu 0 --governor performance
sudo cpufreq-set --cpu 1 --governor performance
sudo cpufreq-set --cpu 2 --governor performance
sudo cpufreq-set --cpu 3 --governor performance
sudo ionice -c 1 -p `pidof mixxx`