success! (was: Re: [linux-audio-dev] streaming with 2.4.0test11)

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: success! (was: Re: [linux-audio-dev] streaming with 2.4.0test11)
From: Kai Vehmanen (kaiv_AT_wakkanet.fi)
Date: Wed Nov 22 2000 - 22:23:52 EET


On Wed, 22 Nov 2000, Roger Larsson wrote:

> There has been some discussion on linux-kernel recently about the
> disk elevator algorithms.
[...]
> The conclusion is that read/writes to data at the end of the disk may
> starve... Check out this weeks Linux Weekly News for a
> simplified description: http://www.lwn.net

This had a clear impact! I tuned my drive with elvtune to
read=500/write=1000, and re-run my ecasound tests. I used a buffer of
512*1024 sample frames (2MB), and still got an underrun, but this time
there weren't any sudden schedule blocks between the two
SCHED_FIFO threads (--> I could watch as the threads competed with
each other right to the very end ;)). During the test, amount of
available buffers greatly varies (from 1/4 to full). This clearly
indicates that we're under _heavy_ load. It was great to see that the
server thread was able to catch up even if it sometime was over 1.5MB
Lowering disk-latency thresholds to read=100/write=500 seemed
to be even more robust.

Here's some stats gathered when running my tests. The first timer
takes time of the read() calls (read from the ringbuffer:
10ch, 1024samples, 32bits/sample). Second timer handles the
write call (alsa 0.6.x; 2ch, 1024samples, 16bits/sample). The third
timer is started when snd_pcm_go() is issued (-> after the first
1024sample-block has been written to the device). It is stopped before
the next write to the soundcard, and again, started after the write.
So in other words, timer-3 shows the time spent outside the write()
call.

I've used a bound value of 23ms (the time it takes to play one
audio fragment). This makes the timer stats somewhat easier to read.
Now first, on a heavily loaded system with sched_fifo policy and
double-buffering enabled:

--cut--
Timer-1:
Number of events: 15375
Events over bound: 0 (0.02321900sec)
Events under bound: 15375 (0.02321900sec)
Min duration in seconds: 0.000005000
Max duration in seconds: 0.001319000
Average duration in seconds: 0.000395750

Timer-2:
Number of events: 15375
Events over bound: 328 (0.02321900sec)
Events under bound: 15047 (0.02321900sec)
Min duration in seconds: 0.000504000
Max duration in seconds: 0.074555000
Average duration in seconds: 0.022353019

Timer-3:
Number of events: 15375
Events over bound: 0 (0.02321900sec)
Events under bound: 15375 (0.02321900sec)
Min duration in seconds: 0.000004000
Max duration in seconds: 0.001857000
Average duration in seconds: 0.000807193
--cut--

The same test, but this time without double-buffering (still running
sched_fifo):

--cut--
Timer-1:
Number of events: 296
Events over bound: 3 (0.02321900sec)
Events under bound: 293 (0.02321900sec)
Min duration in seconds: 0.001373000
Max duration in seconds: 0.970847000
Average duration in seconds: 0.007124101

Timer-2:
Number of events: 295
Events over bound: 5 (0.02321900sec)
Events under bound: 290 (0.02321900sec)
Min duration in seconds: 0.000513000
Max duration in seconds: 0.024541000
Average duration in seconds: 0.018114786

Timer-3:
Number of events: 295
Events over bound: 3 (0.02321900sec)
Events under bound: 292 (0.02321900sec)
Min duration in seconds: 0.001752000
Max duration in seconds: 0.971222000
Average duration in seconds: 0.007514864
--cut--

... so we didn't get far, 295*1024 samples and then underrun. Notice
that one read() call took 970ms, while the average was 7.1ms!

And a third listing, this time sched_fifo, no cpu+disk pressure and
without double-buffering:

--cut--
Timer-1:
Number of events: 5426
Events over bound: 1 (0.02321900sec)
Events under bound: 5425 (0.02321900sec)
Min duration in seconds: 0.001277000
Max duration in seconds: 0.169032000
Average duration in seconds: 0.001654864

Timer-2:
Number of events: 5425
Events over bound: 1 (0.02321900sec)
Events under bound: 5424 (0.02321900sec)
Min duration in seconds: 0.000515000
Max duration in seconds: 0.024969000
Average duration in seconds: 0.021034880

Timer-3:
Number of events: 5425
Events over bound: 1 (0.02321900sec)
Events under bound: 5424 (0.02321900sec)
Min duration in seconds: 0.001658000
Max duration in seconds: 0.169427000
Average duration in seconds: 0.002040321
--cut--

All tests were done on a hdparm+elvtune optimized disk.

-- 
 . http://www.eca.cx ... [ audio software for linux ] /\ . 
 . http://www.eca.cx/sculpscape [ my armchair-tunes mp3/ra/wav ]


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Nov 22 2000 - 22:18:47 EET