Questions like this are very important when running pro audio applications. As you see, and as I have experienced myself many times in the past, Askubuntu.com has a tendency to tell us that we don't need an answer to these kinds of questions. For these narrowly focused questions, you'll find more friendly help on places like the LinuxMusicians forum or the OpenSourceMusicians IRC channel (# opensourcemusicians).
I run KX Studio (which is a pro audio distribution on top of Kubuntu) and I have gotten a lot of help at both #kxstudio and #ardour IRC channels.
Anyway, here's how you do it now that I have figured it out with help from the above resources.
Use these commands to discover the USB bus and IRQ of your audio device:
- lsusb (or lsusb -t)
- lspci (or lspci -v)
- cat /proc/interrupts
In my case, my USB audio interface is ehci_hcd:usb2 on IRQ 23. It may not be easy to figure it out, but if you cross reference the above listings you'll figure out which IRQ is of interest after some detective work. See below for more tips.
Next, install rtirq
See the Ubuntu Wiki:
https://wiki.edubuntu.org/UbuntuStudio/rtirq
Now edit the file /etc/default/rtirq (as sudo). And look for the line that contains RTIRQ_NAME_LIST=
If you want IRQ 23 to have the highest priority, add it to the front of the list like so:
RTIRQ_NAME_LIST="23 usb i8042 snd"
However, in my case, I would rather use the name of the device in case the IRQ assignment changes for some unknown reaason. So I specify it like this:
RTIRQ_NAME_LIST="ehci_hcd:usb2 usb i8042 snd"
Just put the device (or IRQ) at the front of the list for highest priority. It is a space delimited list.
Save the file, then run:
sudo /etc/init.d/rtirq restart
There is no need to reboot. You'll see the resulting IRQ priorities listed from the command above. But if you want to see them again later, run:
sudo /etc/init.d/rtirq status
And check cat /proc/interrupts
if desired.
Some extra tips, as promised:
Using lsusb
I found that my audio interface was on USB Bus 001 Device 003.
Next, using lspci -v
I found that I have 3 USB controllers. I found one listed like this: 00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1
. The flags in that listed included these: Flags: bus master, medium devsel, latency 0, IRQ 23
. So, assuming I picked the right USB controller (the one controlling Bus 01), those flags told me that I am interested in IRQ 23.
Next, /proc/interrupts
told me that IRQ 23 has the device name ehci_hcd:usb2
associated with it.
I also used tree /sys/bus/usb/drivers/usb/
and cat /proc/asound/cards
to cross reference info to pick the correct USB controller.
You might also find the following Perl script useful:
realTimeConfigQuickScan.pl
Best Answer
Note: This solution only works with the cfq scheduler, as explained here. You should check which one is used by issuing
and change it if necessary.
If I understood correctly, you want some
ionice
setting to be applied every time you start a command. You can do it this way:First command creates a file
VirtualBox
with the single-quoted text as its content. This should have the full path to the program, because if one only specifyVirtualBox
it can interpret it as the file we just created and create a "loop".Second command makes it executable, and third moves this new file in a folder which is in front of the "system" bin folder
/usr/bin
, so our new file gets executed instead of the original. The "$@" part contains all the arguments the command was invoked with, so they get forwarded to the real VirtualBox command.According to answer ("yes") to this Super User question Do children processes inherit ionice priorities from their parents? How do you check the IO priority of a running process?, it should be enough to
ionice
the parent process, like this:From
ionice
man page, following I/O scheduling class values are available:A number or class name can be used.
Also,
-n level
option is applicable for realtime and best-effort classes, with 0-7 as valid data (priority levels).