From: Pavel Hofman <pavhofman@gmail.com>
To: Alsa-devel@alsa-project.org
Subject: Re: [alsa-devel] Measuring Device Throughput - MMAP vs. RW
Date: Mon, 9 Sep 2019 18:30:14 +0200 [thread overview]
Message-ID: <CA+SWvNyUAyBQd9ktaZpvV8R7XcK8opA1_VQeMEnPfmr6jcSANQ@mail.gmail.com> (raw)
In-Reply-To: <CA+SWvNx9hGJN0v9erykioJUKyd726VzfP4b77u0RUHh_mgFooQ@mail.gmail.com>
On Sun, Sep 8, 2019 at 5:23 PM Pavel Hofman <pavhofman@gmail.com> wrote:
> Hi,
> Gathering data for USB async gadget feedback (
> https://mailman.alsa-project.org/pipermail/alsa-devel/2019-August/154819.html
> ) requires measuring average data rate to/from a device. For testing I
> added measuring/averaging code to methods snd_pcm_hw_writei, snd_pcm_hw_readi,
> and snd_pcm_hw_mmap_commit in
> https://github.com/alsa-project/alsa-lib/blob/master/src/pcm/pcm_hw.c .
> In all cases I take the parameter "size" of all the three methods as the
> number of samples written/read.
>
> MMAP: When mmap is used (e.g. plughw:X + sample format conversion), I get
> very stable results for MMAP playback on all soundcards I have tested. But
> for capture I get identical results to playback for one soundcard (PCI
> Envy24), while the averaged rate calculated from "size" in
> snd_pcm_hw_mmap_commit fluctuates for capture on Intel HDA.
>
>
> I suspect the size parameter of snd_pcm_hw_mmap_commit is not the actual
> amount of samples read during the MMAP capture. Please how to calculate the
> number of samples read from the variables available in that method?
>
The mmap fluctuations seem to be fixed by using increases in hardware
pointer pcm->hw.ptr values instead of frames variable. Please do these
values wrap up or do they grow to max long? Still contiguous after 10
minutes of running.
I see the hw.ptr gets zeroed at XRUN. If I do not check for xruns (
snd_pcm_state(snd_pcm_t *pcm)?), can I just monitor continuity of hw.ptr
and restart the averaging if the new hw.ptr is lower than the previous one,
or are there any quirks to watch out?
Thanks a lot,
Pavel.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2019-09-09 16:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-08 15:23 [alsa-devel] Measuring Device Throughput - MMAP vs. RW Pavel Hofman
2019-09-09 16:30 ` Pavel Hofman [this message]
2019-09-09 17:44 ` Takashi Iwai
2019-09-09 19:31 ` Pavel Hofman
2019-09-10 7:18 ` Takashi Iwai
2019-09-10 7:48 ` Pavel Hofman
2019-09-10 7:59 ` Pavel Hofman
2019-09-10 19:27 ` Pavel Hofman
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=CA+SWvNyUAyBQd9ktaZpvV8R7XcK8opA1_VQeMEnPfmr6jcSANQ@mail.gmail.com \
--to=pavhofman@gmail.com \
--cc=Alsa-devel@alsa-project.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).