All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexis Berlemont <berlemont.hauw@domain.hid>
To: Stefan Schaal <sschaal@domain.hid>
Cc: Peter Pastor Sampedro <pastorsa@domain.hid>, xenomai@xenomai.org
Subject: Re: [Xenomai-core] Analogy DIO speed
Date: Thu, 18 Feb 2010 23:34:36 +0100	[thread overview]
Message-ID: <4B7DC07C.5@domain.hid> (raw)
In-Reply-To: <0C632A1C-3B64-462B-9892-380CB14F6AD8@domain.hid>

Hi,

Stefan Schaal wrote:
> Thanks to Alexis's Analogy development, digital I/O is possible with Xenomai using National Instrument DAQs. While the basic DIO functionality works in the most current xenomai-head, I am  wondering how to achieve maximal I/O speed with the 32 bit digital I/O sub-device on my NI6259 card. 
> 
> The options are
> 
> 1) single acquisition with a4l_sync_dio()
> 2) instructions and instruction lists using a4l_snd_insnlist() and a4l_snd_insn()
> 3) streaming acquisition with commands (e.g., a4l_snd_command() and related functions)
> 
> My question concerns how many 32-bit DIO instructions per second I
> should be able to achieve with the various options.
> 
> For instance, option 1) seems to take about 5000 nanoseconds on my
> Ubuntu 8 core i386 computer (3Ghz processors).
> Is this normal? Or should it be faster?
> 
> Option 2) seems to give me about 50% speed up, i.e., roughly 3500
> nanoseconds per DIO.

With a4l_sync_dio and/or instructions, you perform one ioctl for each
acquisition.

With instruction lists, you perform less syscalls but the count of
copies (user <-> kernel space) is the same.

So 3.5 µs for:
- switching from user to kernel space
- copying a little structure from user space
- calling the suitable insn_bits handler
- performing PCI I/O
- copying data back (few bytes) to user space
- switching back to user space
It is not that bad, no ? Does anybody have an accurate idea on the
duration of a common ioctl on such a powerful machine ?

Wasting 1.5 more µs in a4l_sync_dio() is annoying. You already have
noticed that a4l_sync_dio() is a wrapper function which
relies on the instruction ioctl. This function does not make any more
ioctl, it just computes some pointers.

> 
> Would option 3) give me a massive speed up and get me closer to the
> 20Mhz processing power of the NI 6259 board? 
Yes. Instead of making one syscall per acquisition, you would get a far
more sensible ratio. With a4l_mmap, you would even be able to save
copies from kernel space: instead of using a4l_async_read, your user
process would get direct access on the kernel buffer where PCI DMA shots
arrive.

I have some problems with
> implementing commands on my NI6259 so far.
Could you remind me what was the problem ?

> 
> Thanks a lot for any help!
> 
> -Stefan
> 
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
> 
Alexis.


  reply	other threads:[~2010-02-18 22:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 21:23 [Xenomai-core] Analogy DIO speed Stefan Schaal
2010-02-18 22:34 ` Alexis Berlemont [this message]
2010-02-18 22:48   ` Thomas Lockhart
2010-02-19  5:43   ` Stefan Schaal
2010-02-23 23:22     ` Alexis Berlemont
2010-03-01  0:24       ` Alexis Berlemont
2010-03-02 18:00         ` Stefan Schaal
2010-03-03 23:58           ` Alexis Berlemont
2010-03-04  0:54             ` Stefan Schaal
2010-03-04  8:37               ` Alexis Berlemont

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=4B7DC07C.5@domain.hid \
    --to=berlemont.hauw@domain.hid \
    --cc=pastorsa@domain.hid \
    --cc=sschaal@domain.hid \
    --cc=xenomai@xenomai.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 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.