[LAD] JACK + PA Latency

From: Patrick Shirkey <pshirkey@email-addr-hidden>
Date: Fri Sep 27 2013 - 17:42:26 EEST

Hi,

Moving this to the LAD list as it seems to be getting to a more technical
and challenging stage now. This may be a simple answer and if so that is
great but suspect it is a bit more complex than that so might require the
brain power of the LAD list rather than just my capabilities.

To recap I am trying to get hard data on the best case latency while
running a combination of JACK + PA. There are various reasons for and
against doing this but discussing them is not the purpose of this thread.

- I am using jack_delay to measure the round trip latency between

    jack -> PA -> JACK

- I also have been testing a complete loop including system i/o but for
the purposes of this thread we can ignore those results.

- I have seen some interesting numbers come up today. If I run the
following command:

  pactl list sink-inputs

I get numbers similar to this:

        Buffer Latency: 8000 usec
        Sink Latency: 3166 usec

The combination of the two shows the actual PA Stream Buffer latency
(approx 10 - 11ms). This number stays approximately static while polling
with this command. To be clear there is also the additional latency that
occurs as the data is transferred from PA to the output but I am told it
is negligible although it might turn out to be a key player.

The results from jack_delay are somewhat different. I have included a
snapshot below*.

For reference sake it was also suggested that I open /dev/cpu_dma_latency
and give it a value of 0. /dev/cpu_dma_latency allows to write the latency
you can tolerate (in ms). The kernel will translate this to the deepest
C-state the processor can enter. I have been running my tests with this
value at zero in case it helps. I have checked with powertop and turbostat
but it doesn't appear to make any difference on this machine. Possibly
because it is an older cpu.

Armed with that preliminary information there are a couple of issues that
I am interested in at this juncture.

1: Why PA is reporting 10ms for the stream buffer but jack_delay is giving
the results below.

2: Why PA is reporting 10ms for the stream buffer when I am running jack
at 64 frames/period and ecasound too.

3: Where the fluctuating measurements from jack_delay are coming from in
the graph as PA Stream Buffer is static at 10ms and ecasound is basically
in pass through with a 64/48k buffer same as JACK. A back of the envelop
estimation suggests latency should be stable well under 20ms including the
10ms set aside for the PA Stream buffer.

---------
RESULTS
---------

jack_delay -> pa -> ecasound -> pa -> jack_delay

hda_intel driver
dual core Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz

jack is run at 64/48000/2
ecasound has a period size of 64
PA is configured to run at 48khz too

[*] Here's the snapshot from jack_delay:

 62784.000 frames 1308.000 ms total roundtrip latency
        extra loopback latency: 62784 frames
        use 31392 for the backend arguments -I and -O
 62784.000 frames 1308.000 ms total roundtrip latency
        extra loopback latency: 62784 frames
        use 31392 for the backend arguments -I and -O ?? Inv
 63168.000 frames 1316.000 ms total roundtrip latency
        extra loopback latency: 63168 frames
        use 31584 for the backend arguments -I and -O
 63743.999 frames 1328.000 ms total roundtrip latency
        extra loopback latency: 63743 frames
        use 31871 for the backend arguments -I and -O
 64639.999 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64640.000 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64639.999 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64640.000 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64640.000 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64639.999 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64640.000 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64640.000 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 64640.000 frames 1346.667 ms total roundtrip latency
        extra loopback latency: 64639 frames
        use 32319 for the backend arguments -I and -O
 65088.000 frames 1356.000 ms total roundtrip latency
        extra loopback latency: 65088 frames
        use 32544 for the backend arguments -I and -O
 65088.000 frames 1356.000 ms total roundtrip latency
        extra loopback latency: 65088 frames
        use 32544 for the backend arguments -I and -O
 65087.999 frames 1356.000 ms total roundtrip latency
        extra loopback latency: 65087 frames
        use 32543 for the backend arguments -I and -O
 65152.000 frames 1357.333 ms total roundtrip latency
        extra loopback latency: 65151 frames
        use 32575 for the backend arguments -I and -O
 65152.000 frames 1357.333 ms total roundtrip latency
        extra loopback latency: 65151 frames
        use 32575 for the backend arguments -I and -O
 65152.000 frames 1357.333 ms total roundtrip latency
        extra loopback latency: 65152 frames
        use 32576 for the backend arguments -I and -O
 65152.000 frames 1357.333 ms total roundtrip latency
        extra loopback latency: 65151 frames
        use 32575 for the backend arguments -I and -O
 65216.000 frames 1358.667 ms total roundtrip latency
        extra loopback latency: 65216 frames
        use 32608 for the backend arguments -I and -O
    64.000 frames 1.333 ms total roundtrip latency
        extra loopback latency: 63 frames
        use 31 for the backend arguments -I and -O
    64.000 frames 1.333 ms total roundtrip latency
        extra loopback latency: 63 frames
        use 31 for the backend arguments -I and -O ?? Inv
   256.000 frames 5.333 ms total roundtrip latency
        extra loopback latency: 256 frames
        use 128 for the backend arguments -I and -O
   256.000 frames 5.333 ms total roundtrip latency
        extra loopback latency: 256 frames
        use 128 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 640 frames
        use 320 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 640 frames
        use 320 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 639 frames
        use 319 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 640 frames
        use 320 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 640 frames
        use 320 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 639 frames
        use 319 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 639 frames
        use 319 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 639 frames
        use 319 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 640 frames
        use 320 for the backend arguments -I and -O
   640.000 frames 13.333 ms total roundtrip latency
        extra loopback latency: 640 frames
        use 320 for the backend arguments -I and -O
   768.001 frames 16.000 ms total roundtrip latency
        extra loopback latency: 768 frames
        use 384 for the backend arguments -I and -O
   832.000 frames 17.333 ms total roundtrip latency
        extra loopback latency: 832 frames
        use 416 for the backend arguments -I and -O
   832.000 frames 17.333 ms total roundtrip latency
        extra loopback latency: 832 frames
        use 416 for the backend arguments -I and -O
   832.000 frames 17.333 ms total roundtrip latency
        extra loopback latency: 831 frames
        use 415 for the backend arguments -I and -O
   832.000 frames 17.333 ms total roundtrip latency
        extra loopback latency: 832 frames
        use 416 for the backend arguments -I and -O
  1024.000 frames 21.333 ms total roundtrip latency
        extra loopback latency: 1024 frames
        use 512 for the backend arguments -I and -O ??
  1024.000 frames 21.333 ms total roundtrip latency
        extra loopback latency: 1024 frames
        use 512 for the backend arguments -I and -O
  1024.000 frames 21.333 ms total roundtrip latency
        extra loopback latency: 1023 frames
        use 511 for the backend arguments -I and -O
  1024.000 frames 21.333 ms total roundtrip latency
        extra loopback latency: 1023 frames
        use 511 for the backend arguments -I and -O
  1344.000 frames 28.000 ms total roundtrip latency
        extra loopback latency: 1344 frames
        use 672 for the backend arguments -I and -O

--
Patrick Shirkey
Boost Hardware Ltd
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sat Sep 28 04:15:03 2013

This archive was generated by hypermail 2.1.8 : Sat Sep 28 2013 - 04:15:03 EEST