* snd_pcm_writei vs snd_pcm_mmap_writei
@ 2005-04-18 9:40 Dino
2005-04-18 9:54 ` Clemens Ladisch
0 siblings, 1 reply; 7+ messages in thread
From: Dino @ 2005-04-18 9:40 UTC (permalink / raw)
To: alsa-devel
Hi all,
these functions are similar : snd_pcm_writei and snd_pcm_mmap_writei
but witch is the best or witch is fastest?
bye,
Dino
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: snd_pcm_writei vs snd_pcm_mmap_writei
2005-04-18 9:40 Dino
@ 2005-04-18 9:54 ` Clemens Ladisch
0 siblings, 0 replies; 7+ messages in thread
From: Clemens Ladisch @ 2005-04-18 9:54 UTC (permalink / raw)
To: Dino; +Cc: alsa-devel
Dino wrote:
> these functions are similar : snd_pcm_writei and snd_pcm_mmap_writei
> but witch is the best or witch is fastest?
Using mmap access can speed up some programs that are able to
construct generate their audio data directly in the output buffer,
because copying from the application's buffer to the sound card buffer
can be avoided. This hypothetical speed advantage is nullified when
using snd_pcm_mmap_writei because this function copies the buffer,
too.
Using snd_pcm_mmap_writei makes sense only when you do have an mmapped
device but want to copy some data from elsewhere anyway.
HTH
Clemens
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: snd_pcm_writei vs snd_pcm_mmap_writei
[not found] <1113818692.4263864449a32@mail.e4a.it>
@ 2005-04-18 12:08 ` Clemens Ladisch
2005-04-18 12:18 ` Dino
0 siblings, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2005-04-18 12:08 UTC (permalink / raw)
To: Dino; +Cc: alsa-devel
Dino wrote:
> So i have to use the pairs: snd_pcm_mmap_begin snd_pcm_mmap_commit to make use
> of a "real" mmap pcm, instead of snd_pcm_mmap_writei?
Yes. snd_pcm_mmap_writei just calls the _begin/_commit functions
before/after copying the buffer. If you call them yourself, you can
do something else instead of simple copying.
HTH
Clemens
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: snd_pcm_writei vs snd_pcm_mmap_writei
2005-04-18 12:08 ` snd_pcm_writei vs snd_pcm_mmap_writei Clemens Ladisch
@ 2005-04-18 12:18 ` Dino
0 siblings, 0 replies; 7+ messages in thread
From: Dino @ 2005-04-18 12:18 UTC (permalink / raw)
To: alsa-devel
Perfect!
BTW i suggest to modify online documentation as it's no so clear, and has some
minors errors.
bye,
Dino
Scrive Clemens Ladisch <clemens@ladisch.de>:
> Dino wrote:
> > So i have to use the pairs: snd_pcm_mmap_begin snd_pcm_mmap_commit to make
> use
> > of a "real" mmap pcm, instead of snd_pcm_mmap_writei?
>
> Yes. snd_pcm_mmap_writei just calls the _begin/_commit functions
> before/after copying the buffer. If you call them yourself, you can
> do something else instead of simple copying.
>
>
> HTH
> Clemens
>
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
^ permalink raw reply [flat|nested] 7+ messages in thread
* snd_pcm_writei VS snd_pcm_mmap_writei
@ 2010-11-19 6:52 Irfan Shaikh
2010-11-19 7:09 ` Jaroslav Kysela
0 siblings, 1 reply; 7+ messages in thread
From: Irfan Shaikh @ 2010-11-19 6:52 UTC (permalink / raw)
To: alsa-devel@alsa-project.org
Hello,
Please tell me
a) Difference between working of snd_pcm_mmap_writei and snd_pcm_writei ?
b) Performance wise which is better ?
When i use gettimeofday almost profile time comes almost same for both of them.
Thanks and Regards,
Irfan
SASKEN BUSINESS DISCLAIMER: This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any
virus transmitted by this email.
Read Disclaimer at http://www.sasken.com/extras/mail_disclaimer.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: snd_pcm_writei VS snd_pcm_mmap_writei
2010-11-19 6:52 snd_pcm_writei VS snd_pcm_mmap_writei Irfan Shaikh
@ 2010-11-19 7:09 ` Jaroslav Kysela
2010-11-19 8:21 ` Clemens Ladisch
0 siblings, 1 reply; 7+ messages in thread
From: Jaroslav Kysela @ 2010-11-19 7:09 UTC (permalink / raw)
To: Irfan Shaikh; +Cc: alsa-devel@alsa-project.org
On Fri, 19 Nov 2010, Irfan Shaikh wrote:
> Hello,
>
> Please tell me
> a) Difference between working of snd_pcm_mmap_writei and snd_pcm_writei ?
> b) Performance wise which is better ?
The mmap functions does not require user space / kernel context switches.
> When i use gettimeofday almost profile time comes almost same for both of them.
With current hw power, there are no major differences.
Jaroslav
-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: snd_pcm_writei VS snd_pcm_mmap_writei
2010-11-19 7:09 ` Jaroslav Kysela
@ 2010-11-19 8:21 ` Clemens Ladisch
0 siblings, 0 replies; 7+ messages in thread
From: Clemens Ladisch @ 2010-11-19 8:21 UTC (permalink / raw)
To: Irfan Shaikh; +Cc: alsa-devel@alsa-project.org
Jaroslav Kysela wrote:
> On Fri, 19 Nov 2010, Irfan Shaikh wrote:
> > Please tell me
> > a) Difference between working of snd_pcm_mmap_writei and snd_pcm_writei ?
>
> The mmap functions does not require user space / kernel context switches.
>
> > b) Performance wise which is better ?
> >
> > When i use gettimeofday almost profile time comes almost same for both of them.
>
> With current hw power, there are no major differences.
Yes, the context switches have no noticeable impact on latency or
throughput.
The only case where using the mmap functions makes sense is when the
program generates the samples on the fly and can write them directly
into the device's buffer. If, however, the samples are already in some
other buffer and are to be copied into the device's buffer, then this is
_exactly_ the same situation as snd_pcm_writei.
If your algorithm requires that you always use snd_pcm_mmap_writei,
then you shouldn't have used mmap in the first place.
Regards,
Clemens
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-11-19 8:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-19 6:52 snd_pcm_writei VS snd_pcm_mmap_writei Irfan Shaikh
2010-11-19 7:09 ` Jaroslav Kysela
2010-11-19 8:21 ` Clemens Ladisch
[not found] <1113818692.4263864449a32@mail.e4a.it>
2005-04-18 12:08 ` snd_pcm_writei vs snd_pcm_mmap_writei Clemens Ladisch
2005-04-18 12:18 ` Dino
-- strict thread matches above, loose matches on Subject: below --
2005-04-18 9:40 Dino
2005-04-18 9:54 ` Clemens Ladisch
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.