All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Henningsson <coding@diwic.se>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH v2] sound: rawmidi: Add framing mode
Date: Mon, 5 Apr 2021 14:13:27 +0200	[thread overview]
Message-ID: <c70cf21a-ec81-955f-f6da-fe502e9b0715@diwic.se> (raw)
In-Reply-To: <s5hwntng495.wl-tiwai@suse.de>


On 2021-03-31 09:40, Takashi Iwai wrote:
> On Tue, 30 Mar 2021 21:35:11 +0200,
> David Henningsson wrote:
>>
>> Well, I believe that rawmidi provides less jitter than seq is not a
>> theoretical problem but a known fact (see e g [1]), so I haven't tried
>> to "prove" it myself. And I cannot read your mind well enough to know
>> what you would consider a sufficient proof - are you expecting to see
>> differences on a default or RT kernel, on a Threadripper or a
>> Beaglebone, idle system or while running RT torture tests? Etc.
> There is certainly difference, and it might be interesting to see the
> dependency on the hardware or on the configuration.  But, again, my
> primary question is: have you measured how *your patch* really
> provides the improvement?  If yes, please show the numbers in the
> patch description.

As you requested, I have now performed such testing.

Results:

Seq - idle: 5.0 ms

Seq - hackbench: 1.3 s (yes, above one second)

Raw + framing - idle: 2.8 ms

Raw + framing - hackbench: 2.8 ms

Setup / test description:

I had an external midi sequencer connected through USB. The system under 
test was a Celeron N3150 with internal graphics. The sequencer was set 
to generate note on/note off commands exactly 10 times per second.

For the seq tests I used "arecordmidi" and analyzed the delta values of 
resulting midi file. For the raw + framing tests I used a home-made 
application to write a midi file. The monotonic clock option was used to 
rule out differences between monotonic and monotonic_raw. The result 
shown above is the maximum amount of delta value, converted to 
milliseconds, minus the expected 100 ms between notes. Each test was run 
for a minute or two.

For the "idle" test, the machine was idle (running a normal desktop), 
and for the "hackbench" test, "chrt -r 10 hackbench" was run a few times 
in parallel with the midi recording application (which was run with 
"chrt -r 15").

I also tried a few other stress tests but hackbench was the one that 
stood out as totally destroying the timestamps of seq midi. (E g, 
running "rt-migrate-test" in parallel with "arecordmidi" gave a max 
jitter value of 13 ms.)

Conclusion:

I still believe the proposed raw + framing mode is a valuable 
improvement in the normal/idle case, but even more so because it is more 
stable in stressed conditions. Do you agree?

If so, I'll send out a v4 with 32 byte framing (16 byte header, 16 byte 
data).

  // David

  reply	other threads:[~2021-04-05 12:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24  5:42 [PATCH v2] sound: rawmidi: Add framing mode David Henningsson
2021-03-24 10:03 ` Takashi Iwai
2021-03-24 11:18   ` David Henningsson
2021-03-24 13:29     ` Takashi Sakamoto
2021-03-24 12:44 ` Takashi Sakamoto
2021-03-24 15:57   ` David Henningsson
2021-03-26  4:46     ` Takashi Sakamoto
2021-03-26  7:55       ` Takashi Iwai
2021-03-26 16:29         ` David Henningsson
2021-03-26 16:44           ` Takashi Iwai
2021-03-27  1:51             ` Takashi Sakamoto
2021-03-28  6:39             ` David Henningsson
2021-03-28  7:40               ` Takashi Iwai
2021-03-30 19:35                 ` David Henningsson
2021-03-31  7:40                   ` Takashi Iwai
2021-04-05 12:13                     ` David Henningsson [this message]
2021-04-06 12:01                       ` Takashi Iwai
2021-04-10 11:41                         ` David Henningsson
2021-04-12 16:03                           ` Takashi Iwai
2021-03-27  3:44           ` Takashi Sakamoto
2021-03-27  3:10         ` Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c70cf21a-ec81-955f-f6da-fe502e9b0715@diwic.se \
    --to=coding@diwic.se \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.