Read/Write Performance Tuning for 82350A/B and 82351A
This section contains information that applies to Windows and Linux, not Windows on ARM.
Problem:
The performance of read and write calls to the 82350A/B PCI GPIB card or 82351A PCIe® GPIB card is insufficient for your application.
Probable Cause:
Your program may not be making optimal use of the Polling and Interrupt modes for your read and write calls.
Suggested Steps:
The read and write calls of Keysight 82350A/B PCI GPIB card or 82351A PCIe GPIB card use one of two modes:
In Polling mode, bytes are
transferred to/from the card, one at a time.
Polling mode is
advantageous for transferring a small number of bytes because the setup
overhead is very low, but it does requires CPU involvement for each byte
transferred.
In Interrupt mode, an entire buffer is transferred to or from the card without CPU involvement. Interrupt mode is advantageous for transferring large buffers, because the higher per-byte transfer rate more than compensates for the relatively long interrupt-setup overhead.
The default behavior of the 82350/82351 driver is to use Polling mode for transfers of 256 bytes or less and to use Interrupt mode for larger transfers. You can modify this default behavior in the following ways:
VISA
The VISA function
viSetAttribute(vi, VI_ATTR_DMA_ALLOW_EN, attrValue)
can be called to modify the read/write behavior for a VISA session.
SICL
The SICL function
ihint(id, hint)
can be called to modify the read/write behavior on a SICL session.
Considerations
- This setting is per-session. Therefore, you can open multiple sessions to a device and set different transfer modes for different sessions. The mode used for a given read/write call will then depend on which session you are using for that call.
- In both SICL (with hint = I_HINT_DONTCARE) and VISA (with VI_ATTR_DMA_ALLOW_EN = VI_TRUE), the size of the read request (as specified by bufsize in a SICL iread() call or count in a VISA viRead() call) will determine the mode used even if the number of bytes actually read is less than the requested number.
- The default read buffer size for formatted I/O is 4096, so, when using this default size, formatted reads in SICL (with hint = I_HINT_DONTCARE) and VISA (with VI_ATTR_DMA_ALLOW_EN = VI_TRUE) will use Interrupt mode even when a small number of bytes is expected.
- The default write buffer size for formatted I/O is 128, so, when using this default size, formatted writes in SICL (with hint = I_HINT_DONTCARE) and VISA (with VI_ATTR_DMA_ALLOW_EN = VI_TRUE) will used Polling mode even when a large number of bytes is being sent.
- In SICL, Polling mode will always be used for the iread(), ifread() and iscanf() calls, regardless of the above settings, when a termchr is set (when itermchr() is not set to -1).
- In VISA, Polling mode will always be used for viRead(), viBufRead() and viScanf() calls, regardless of the above settings, when VI_ATTR_TERM_CHAR_EN = VI_TRUE.
- The crossover point (the size of transfer at which Interrupt mode becomes faster than Polling mode) depends on the CPU speed. A faster CPU has a higher crossover point.