soundcheck wrote: 
> 
> The main intention was an still is for me to figure out why my setup
> with squeezelite doesn't seem to run as efficient as squeezeplay. At
> least that's what the rather large Alsa buffer size and very sensitive
> behaviour  in comparison (on my Touch)  indicates. 
> 
> As you can see on the Touch that - as done by Logitech - you need to
> allign all involved processes, tasks, threads, IRQs if you start
> fiddling around with SCHED_FIFO.
> Or your buffer sizes grow. Logitech put pretty much everything relevant
> on FIFO-40 and some crucial stuff got a little higher prios. For now
> squeezelite just puts
> the output thread on SCHED_FIFO. I'm still not sure if this is
> sufficiant. That's basically the background of my exercise.
> 

Lets concentrate on making it work the same as Touch.  Note we need to
separate the application from the kernel here.  In a standard Touch, the
playback application has the following threads:

Code:
--------------------
    
  0  TS   991      - select /usr/bin/jive
  0  TS   991      - unix_s /usr/bin/jive
  0  TS   991      - futex_ /usr/bin/jive
  0  FF  1016     35 sys_po jive_alsa -d plughw:2,0 -b 20000 -p 2 -s 16 -f 2
  0  FF  1017     45 sys_po jive_alsa -d default -c default -b 20000 -p 2 -s 24 
-f 1
  
--------------------


Its only the two output processes jive_alsa which gets SCHED_FIFO and
the one with a priority of 45 is the main output thread.  (other one is
the effects output which can be killed..)  There are no other user
threads running as SCHED_FIFO on the either device.

Some of the kernel threads also run in real time, but most of the IRQ
tasklets run at 40 which is less that the jive_alsa priority:

Code:
--------------------
    
  0  FF     3     98 posix_ [posixcputmr/0]
  0  FF     4     40 ksofti [sirq-high/0]
  0  FF     5     40 ksofti [sirq-timer/0]
  0  FF     6     40 ksofti [sirq-net-tx/0]
  0  FF     7     40 ksofti [sirq-net-rx/0]
  0  FF     8     40 ksofti [sirq-block/0]
  0  FF     9     89 ksofti [sirq-tasklet/0]
  0  FF    10     40 ksofti [sirq-sched/0]
  0  FF    11     40 ksofti [sirq-hrtimer/0]
  0  FF    12     40 ksofti [sirq-rcu/0]
  0  FF    13     99 watchd [watchdog/0]
  0  FF    16      1 worker [events/0]
  0  FF    49     90 irqd   [IRQ-34]
  0  FF    99     40 irqd   [IRQ-14]
  0  FF   116     40 irqd   [IRQ-10]
  0  FF   125     40 irqd   [IRQ-42]
  0  FF   126     40 irqd   [IRQ-41]
  0  FF   153      1 krcupr [krcupreemptd]
  0  FF   236     40 irqd   [IRQ-22]
  0  FF   258     40 irqd   [IRQ-57]
  0  FF   264     40 irqd   [IRQ-33]
  0  FF   305     40 irqd   [IRQ-37]
  0  FF   334     40 irqd   [IRQ-122]
  0  FF   346     40 irqd   [IRQ-17]
  0  FF   351     40 irqd   [IRQ-123]
  0  FF   356     40 irqd   [IRQ-7]
  0  FF   358     40 irqd   [IRQ-102]
  0  FF   359     40 irqd   [IRQ-8]
  0  FF   367     40 irqd   [IRQ-47]
  0  FF   385     40 irqd   [IRQ-11]
  0  FF   395     40 irqd   [IRQ-12]
  0  FF   407     40 irqd   [IRQ-25]
  0  FF   410     50 hrtime [loadavg]
  0  FF   416     40 irqd   [IRQ-45]
  0  FF   946      1 sdio_i [ksdiorqd]
  
--------------------


Now with squeezelite, if we set the priority of the output thread to 45
we should get to exactly the same position - all the kernel threads will
be unchanged.  Its only the one output thread in the appliction which is
critical and which should have a higher priority - in this case 45 is
probably best to fit in with the preset priorities of the kernel
tasklets.  With usb audio I've found that we also need to raise the
priority of the usb tasklet [IRQ-47] as otherwise async usb can be
compromised.

I find that squeezelite performs similarly to to squeezeplay just by
doing this. Can you confirm which interfaces you are using this with? 
What are you seeing which is different from this?

This is the debug from playing the default 0.9beta11 build (output
thread left at priority of 40 which is in the current code) on a Touch
with jive killed and the watchdog stopped. This is playing a 96/24 flac:

Code:
--------------------
    
  # ./squeezelite-armv6 -o hw:CARD=TXRX -d output=debug
  [20:57:47.705717] output_init:1265 init output
  [20:57:47.707753] output_init:1268 outputbuf size: 3528000
  [20:57:47.708326] output_init:1298 requested buffer_time: 20000 period_count: 
4 format: any mmap: 1
  [20:57:47.728535] output_init:1322 output: hw:CARD=TXRX maxrate: 96000
  [20:57:47.731625] output_thread:562 open output device: hw:CARD=TXRX
  [20:57:47.736933] alsa_open:257 opened device hw:CARD=TXRX using format: 
S24_LE sample rate: 44100 mmap: 1
  [20:57:47.739939] alsa_open:305 buffer time: 20045 period count: 4 buffer 
size: 884 period size: 221
  [20:57:52.079238] output_flush:1347 flush output buffer
  [20:57:52.327715] output_thread:748 track start sample rate: 96000 
replay_gain: 0
  [20:57:52.328282] output_thread:562 open output device: hw:CARD=TXRX
  [20:57:52.331411] alsa_open:257 opened device hw:CARD=TXRX using format: 
S24_LE sample rate: 96000 mmap: 1
  [20:57:52.332047] alsa_open:305 buffer time: 20000 period count: 4 buffer 
size: 1920 period size: 480
  [21:07:07.135143] output_thread:748 track start sample rate: 96000 
replay_gain: 0
  
--------------------


The file is ~10 minutes and this debug captures it playing twice without
any xruns (and I don't believe there are any if I leave it for longer)

Just to make sure we are comparing like with like, here's all the
processes which have SCHED_FIFO (from ps -Leo
uid,cls,pid,rtprio,wchan,cmd | grep FF):

Code:
--------------------
    
  0  FF     3     98 posix_ [posixcputmr/0]
  0  FF     4     40 ksofti [sirq-high/0]
  0  FF     5     40 ksofti [sirq-timer/0]
  0  FF     6     40 ksofti [sirq-net-tx/0]
  0  FF     7     40 ksofti [sirq-net-rx/0]
  0  FF     8     40 ksofti [sirq-block/0]
  0  FF     9     89 ksofti [sirq-tasklet/0]
  0  FF    10     40 ksofti [sirq-sched/0]
  0  FF    11     40 ksofti [sirq-hrtimer/0]
  0  FF    12     40 ksofti [sirq-rcu/0]
  0  FF    13     99 watchd [watchdog/0]
  0  FF    16      1 worker [events/0]
  0  FF    49     90 irqd   [IRQ-34]
  0  FF    99     40 irqd   [IRQ-14]
  0  FF   116     40 irqd   [IRQ-10]
  0  FF   125     40 irqd   [IRQ-42]
  0  FF   126     40 irqd   [IRQ-41]
  0  FF   153      1 krcupr [krcupreemptd]
  0  FF   236     40 irqd   [IRQ-22]
  0  FF   258     40 irqd   [IRQ-57]
  0  FF   264     40 irqd   [IRQ-33]
  0  FF   305     40 irqd   [IRQ-37]
  0  FF   334     40 irqd   [IRQ-122]
  0  FF   346     40 irqd   [IRQ-17]
  0  FF   351     40 irqd   [IRQ-123]
  0  FF   356     40 irqd   [IRQ-7]
  0  FF   358     40 irqd   [IRQ-102]
  0  FF   359     40 irqd   [IRQ-8]
  0  FF   367     40 irqd   [IRQ-47]
  0  FF   385     40 irqd   [IRQ-11]
  0  FF   395     40 irqd   [IRQ-12]
  0  FF   407     40 irqd   [IRQ-25]
  0  FF   410     50 hrtime [loadavg]
  0  FF   416     40 irqd   [IRQ-45]
  0  FF   946      1 sdio_i [ksdiorqd]
  0  FF  1376     40 sys_po ./squeezelite-armv6 -o hw:CARD=TXRX -d output debug
  0  TS  1643      - pipe_w grep FF
  
--------------------


So this is the default settings for all kernel tasks + the squeezelite
output thread.


------------------------------------------------------------------------
Triode's Profile: http://forums.slimdevices.com/member.php?userid=17
View this thread: http://forums.slimdevices.com/showthread.php?t=97046

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to