rate my xruns: tuning assistance?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

User avatar
ZestieBumwhig
Established Member
Posts: 73
Joined: Fri May 20, 2016 4:56 pm

rate my xruns: tuning assistance?

Post by ZestieBumwhig »

I was going to jump on the coat-tails of "Standard test needed to benchmark XRUNs" but I thought a new thread might be better... I'd happily move it if people felt otherwise, though.

Now that I'm using xruncounter, I'm seeing really different results than other peoples'. I usually end up with hundreds of xruns, and they start pretty soon. I'm using a Scarlett Focusrite 18i20 - this is with the AVLinux2 Low Latency kernel (4.9.76-lowlatency-avl2), and 2 periods (5.33ms latency):

Code: Select all

Samplerate 48000 
Buffersize is 128 
jack running with realtime priority
Xrun 1 at DSP load 65.916183
Xrun 2 at DSP load 65.916183
......
Xrun 113 at DSP load 95.398300
Xrun 114 at DSP load 96.930206
in complete 114 Xruns in 9194 circles
first Xrun happen at DSP load 65.916183 circle 8033
My computer is a 2012 Asus laptop, i7 quad core... I don't know how much of that is relevant. Anyway, everything pretty much runs well enough for me - but if I could get my system better tuned, I'd love to figure out how! The most concerning thing to me is just HOW MANY xruns I get with xruncounter, while other people seem to get two or three.

Thank you for your consideration.
Musicteacher
Established Member
Posts: 194
Joined: Mon Nov 13, 2017 5:54 am
Has thanked: 8 times
Been thanked: 4 times

Re: rate my xruns: tuning assistance?

Post by Musicteacher »

Hi,

take a look at this thread:

viewtopic.php?f=27&t=19858

Even though I started it with KDE-Tuning in mind, it ended in a general tuning thread with a focus on modern notebook-processors. This is probably where your problems come from, too.

If you take a look at the xruncounter.c code, you will see that the loop that increases the load runs until the jack_cpu_load is over 95%. This means that if while xruncounter is running the cpu changes it's clock, everything goes crazy. To get reliable results from xruncounter you must ensure that your cpu runs at a constant rate.

Last thought: If you don't have problems while making music, there is no real need to tune something. I went this route because there were audible cracks from time to time.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: rate my xruns: tuning assistance?

Post by merlyn »

I would think that you're getting Xruns at a low DSP load because your interface prefers a buffer size that is a multiple of (samplerate/1000).

Try a buffer of 96.

Other values that work are : 48, 96, 144, 192 ...
User avatar
ZestieBumwhig
Established Member
Posts: 73
Joined: Fri May 20, 2016 4:56 pm

Re: rate my xruns: tuning assistance?

Post by ZestieBumwhig »

Oh, you people are the greatest.

Yes - I'm getting much better results now that my frames/buffer is related to the sample rate.... 96 and 144 have both given good results of only a few xruns, starting at perfectly acceptable DSP %s.

I had already read in those other threads about trying various other frames values, but somehow I'd missed the important aspect of the frames-to-sampleRate ratio. So, unsurprisingly, Jack wouldn't even START when I asked for some weird (non-multiple) frames/buffer number.

Thank you!
Last edited by ZestieBumwhig on Wed Apr 24, 2019 3:37 am, edited 1 time in total.
User avatar
AlexTheBassist
Established Member
Posts: 353
Joined: Mon May 19, 2014 3:44 am
Location: Russia, Moscow
Been thanked: 1 time

Re: rate my xruns: tuning assistance?

Post by AlexTheBassist »

ZestieBumwhig wrote:Yes - I'm getting much better results now that my frames/buffer is related to the sample rate.... 92 and 144 have both given good results of only a few xruns, starting at perfectly acceptable DSP %s.
While this is really great in means of performance, some plugins still prefer powers of 2 as buffer sizes. Most of Guitarix are like that.
Being creative does not imply being lazy, stupid, or illiterate.

Working in Harrison Mixbus and Ardour on KDE Neon + KXStudio.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: rate my xruns: tuning assistance?

Post by merlyn »

@ZestieBumwhig Glad you got it working. You could post your improved results. Looking at the number of circles you got in your first results I'd estimate you have a 4GHz processor and you should now get around 12000 circles.

@AlexTheBassist Do you have a USB interface? If so have you tried a non-power of two buffer and does it work with Guitarix?

I'm asking because practice is different from theory. The JACK manual says JACK itself prefers a power of two buffer. In practice non-power of two buffers appear to work. Anyone with experience of USB, non-power of two buffers and Guitarix please share.
User avatar
ZestieBumwhig
Established Member
Posts: 73
Joined: Fri May 20, 2016 4:56 pm

Re: rate my xruns: tuning assistance?

Post by ZestieBumwhig »

Well, there's probably still room for improvement, since I'm not regularly cracking 10,000 circles. But I'm still very pleased with the improvement I've made thus far!

Although my processor is actually 2.4GHz, so maybe I'm doing pretty well.

Code: Select all

processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz
Here are my results with a few different kernels. The same settings every time - 2 periods per buffer, 48000 sample rate and 144 buffer size, giving 6ms latency. I'm using my Scarlett Focusrite 18i20, with lightpipe connection to an ART Tube Opto 8.

First, the stock (?) Debian 4.9:

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3 (2019-02-02) x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 76.464172
Xrun 2 at DSP load 97.768112
in complete 2 Xruns in 10942 circles
first Xrun happen at DSP load 76.464172 circle 8774

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 76.640640
Xrun 2 at DSP load 96.541580
in complete 2 Xruns in 10108 circles
first Xrun happen at DSP load 76.640640 circle 8791
Then with the AVL lowlatency kernel. Jack didn't want to start at first. I ran it three times b/c I was surprised at the meh performance of the second run.

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 4.9.76-lowlatency-avl2 #9 SMP PREEMPT Thu Jan 18 01:33:06 EST 2018 x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 83.635223
Xrun 2 at DSP load 97.925880
in complete 2 Xruns in 11109 circles
first Xrun happen at DSP load 83.635223 circle 9786

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 75.176056
Xrun 2 at DSP load 95.479225
Xrun 3 at DSP load 96.353134
in complete 3 Xruns in 10742 circles
first Xrun happen at DSP load 75.176056 circle 8642

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 97.689224
in complete 1 Xruns in 10910 circles
first Xrun happen at DSP load 97.689224 circle 10895
And the AVLinux RT kernel - definitely the best!

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 4.9.76-rt61avl2 #10 SMP PREEMPT RT Sat Jan 20 00:06:48 EST 2018 x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 97.875885
in complete 1 Xruns in 10674 circles
first Xrun happen at DSP load 97.875885 circle 10674

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 96.846375
in complete 1 Xruns in 10507 circles
first Xrun happen at DSP load 96.846375 circle 10498
And just for fun, a Liquorix kernel... I THINK that's compatible! It takes my computer a really long time to finish booting with this one, though.

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 5.0.0-8.1-liquorix-amd64 #1 ZEN SMP PREEMPT liquorix 5.0-7.1~sid (2019-04-17) x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 96.757851
in complete 1 Xruns in 7540 circles
first Xrun happen at DSP load 96.757851 circle 7535

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 96.076691
in complete 1 Xruns in 7540 circles
first Xrun happen at DSP load 96.076691 circle 7540
I hope this info is useful/fun for others. I found running these tests really enlightening. And I always welcome more enlightenment!
Musicteacher
Established Member
Posts: 194
Joined: Mon Nov 13, 2017 5:54 am
Has thanked: 8 times
Been thanked: 4 times

Re: rate my xruns: tuning assistance?

Post by Musicteacher »

Hi,
144 bit is not really a small buffersize. If you want to play funky guitars I'd aim for less.
96 bit would be good, 48 bit would be really good. 144 bit is still ok, depends on what kind of virtual instruments you are playing. Still perfect for organ, synth and strings.

As I said before: Disable all c-states higher than 1, see the linked thread on how to do this. Then your results should be more reproducible.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: rate my xruns: tuning assistance?

Post by merlyn »

ZestieBumwhig wrote:Although my processor is actually 2.4GHz, so maybe I'm doing pretty well.
Yes. That blows my theory out the water. :) From the xruncounter results that have been posted it seemed that the number of circles was a function of clock speed. Does your processor have a turbo mode?

I have a 2.6GHz processor and get around 8000 circles at 128 frames, so you are doing well.

It could be that your processor has a high instructions per clock cycle.

For audio performance it does seem to be pure CPU speed that's important meaning that chips like an AMD Threadripper aren't going to give performance boosts for audio.

Thanks for sharing.
Musicteacher
Established Member
Posts: 194
Joined: Mon Nov 13, 2017 5:54 am
Has thanked: 8 times
Been thanked: 4 times

Re: rate my xruns: tuning assistance?

Post by Musicteacher »

For xruncounter, single core cpu speed is what's counting.

For real world audio-processing this is not true.

To get the most cycles out of xruncounter, you should turn off all cores but one and then set the frequency to the highest possible turbo-boost-frequency. As only one core is running it is highly probable that the cpu will be able to hold that frequency for a longer time. But this won't help you in a real-world audio setup where dozens of plugins are running at the same time and could use a multicore-cpu very well!

As far as I have understood, xruncounter can only do so much as to give you a first hint if there are serious flaws in your system setup. @Tramp , who wrote it in the first place, explained it that way, too, if I remember correcctly.

So the next step would be to put your system under real stress. I recorded a stress-test-song for that.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: rate my xruns: tuning assistance?

Post by merlyn »

Interesting. I started a new topic: viewtopic.php?f=11&t=19927
User avatar
ZestieBumwhig
Established Member
Posts: 73
Joined: Fri May 20, 2016 4:56 pm

Re: rate my xruns: tuning assistance?

Post by ZestieBumwhig »

Well here's a wrench in my well-oiled laptop...

Apparently Supercollider and PD don't like my fancy new frames/period sizes at all! Simple sine waves are very distorted - and they're fine when I go back to powers-of-two.

I only just discovered this. I haven't yet done much to delve into the issue, just enough to see that it doesn't work right away, and that the frames/period is, indeed, the culprit. This is perhaps related to what @AlexTheBassist was saying?
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: rate my xruns: tuning assistance?

Post by lilith »

Did you test if the results below a reproducible? Sometimes I get the first xruns at 20% and sometimes at 98%. I don't know the reason yet for this.

ZestieBumwhig wrote:Well, there's probably still room for improvement, since I'm not regularly cracking 10,000 circles. But I'm still very pleased with the improvement I've made thus far!

Although my processor is actually 2.4GHz, so maybe I'm doing pretty well.

Code: Select all

processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz
Here are my results with a few different kernels. The same settings every time - 2 periods per buffer, 48000 sample rate and 144 buffer size, giving 6ms latency. I'm using my Scarlett Focusrite 18i20, with lightpipe connection to an ART Tube Opto 8.

First, the stock (?) Debian 4.9:

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3 (2019-02-02) x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 76.464172
Xrun 2 at DSP load 97.768112
in complete 2 Xruns in 10942 circles
first Xrun happen at DSP load 76.464172 circle 8774

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 76.640640
Xrun 2 at DSP load 96.541580
in complete 2 Xruns in 10108 circles
first Xrun happen at DSP load 76.640640 circle 8791
Then with the AVL lowlatency kernel. Jack didn't want to start at first. I ran it three times b/c I was surprised at the meh performance of the second run.

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 4.9.76-lowlatency-avl2 #9 SMP PREEMPT Thu Jan 18 01:33:06 EST 2018 x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 83.635223
Xrun 2 at DSP load 97.925880
in complete 2 Xruns in 11109 circles
first Xrun happen at DSP load 83.635223 circle 9786

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 75.176056
Xrun 2 at DSP load 95.479225
Xrun 3 at DSP load 96.353134
in complete 3 Xruns in 10742 circles
first Xrun happen at DSP load 75.176056 circle 8642

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 97.689224
in complete 1 Xruns in 10910 circles
first Xrun happen at DSP load 97.689224 circle 10895
And the AVLinux RT kernel - definitely the best!

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 4.9.76-rt61avl2 #10 SMP PREEMPT RT Sat Jan 20 00:06:48 EST 2018 x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 97.875885
in complete 1 Xruns in 10674 circles
first Xrun happen at DSP load 97.875885 circle 10674

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 96.846375
in complete 1 Xruns in 10507 circles
first Xrun happen at DSP load 96.846375 circle 10498
And just for fun, a Liquorix kernel... I THINK that's compatible! It takes my computer a really long time to finish booting with this one, though.

Code: Select all

scuttlebutt@scuttlebutthost:~$ uname -a
Linux scuttlebutthost 5.0.0-8.1-liquorix-amd64 #1 ZEN SMP PREEMPT liquorix 5.0-7.1~sid (2019-04-17) x86_64 GNU/Linux

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 96.757851
in complete 1 Xruns in 7540 circles
first Xrun happen at DSP load 96.757851 circle 7535

Samplerate 48000 
Buffersize is 144 
jack running with realtime priority
Xrun 1 at DSP load 96.076691
in complete 1 Xruns in 7540 circles
first Xrun happen at DSP load 96.076691 circle 7540
I hope this info is useful/fun for others. I found running these tests really enlightening. And I always welcome more enlightenment!
User avatar
ZestieBumwhig
Established Member
Posts: 73
Joined: Fri May 20, 2016 4:56 pm

Re: rate my xruns: tuning assistance?

Post by ZestieBumwhig »

@lilith - yes, my results (with non-power-of-two frames/buffer sizes) are fairly reproducible. Some variation of course, but nothing as crazy as your 20% occurrences. Of course, now I'm afraid to run at 96 or 144 frames/buffer, since at least two programs (PureData & SuperCollider) don't seem to like that.
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: rate my xruns: tuning assistance?

Post by tramp »

The best advice is the one from @Musicteacher.
Adding the kernel boot parameters

Code: Select all

intel_pstate=disable processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll
this is what I now get:

Code: Select all

************************ SYSTEM ************************

           Chassis: desktop
  Operating System: Debian GNU/Linux buster/sid
            Kernel: Linux 5.0.7-rt4
      Architecture: x86-64
               CPU: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz

***************** jackd start parameter ****************

    /usr/bin/jackd -P85 -dalsa -dhw:0 -r48000 -p128 -n2 -s -S -Xseq

********************** Pulseaudio **********************

    pulse is active

************************* Test *************************

Samplerate is 48000Hz 
Buffersize is 128 
Buffer/Periods  2

jack running with realtime priority
Xrun 1 at DSP load 99.06% use 2.66ms from 2.67ms jack cycle time
in complete 1 Xruns in 9011 cycles                      
first Xrun happen at DSP load 99.06% in cycle 8990
process takes 2.66ms from total 2.67ms jack cycle time
On the road again.
Post Reply