[alsa-devel] snd_pcm_writei VS snd_pcm_mmap_writei
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
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.
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
participants (3)
-
Clemens Ladisch
-
Irfan Shaikh
-
Jaroslav Kysela