User manual

Programmer’s Guide Page 63 of 66
4. Appendix A: Estimating Data Transfer Times
The time to transfer a waveform may be a significant part of the execution time of a program, and thus becomes an
important design consideration for new applications. We present here a simple timing model with the aim of
predicting the transfer time for digitizer readout as a function of the number of segments, number of samples, CPU
speed and the operating system.
4.1. Principles & Formulas
The function AcqrsD1_readData for readMode = 0 executes a direct waveform transfer from the digitizer memory
to the user-allocated buffer, for a single segment at a time. Since direct-to-memory access (DMA) is used, this is the
most time-efficient method for segments of 10'000 or more samples. However, each segment requires its own DMA
setup. When segments are very short, the transfer overhead starts to dominate the overall transfer time. After the
transfer the data in the buffer is ready to be used.
The function AcqrsD1_readData for readMode = 1 (ReadModeSeqW) reduces the overhead time by transferring
with a single DMA a complete digitizer memory image to the host computer memory. The memory image is
composed of a number of segments, each of which is a circular buffer. The first data point of interest in the circular
buffer may be anywhere, and its position usually changes randomly between acquisitions. Thus, after the DMA is
terminated, the driver must copy data from the image to the final linear buffer for each segment. This method is
therefore only interesting for relatively short segments. However, if timing is not an important consideration, it offers
the convenience of a single function call for the complete transfer of a waveform sequence.
Formulas for estimating the transfer times in s are:
AcqrsD1_readData for readMode = 0:
XfrNMOvhdMT
DMA1
AcqrsD1_readData for readMode = 1 (ReadModeSeqW):
CpyNMXfrExtraNMOvhdMOvhdT
bufferDMA2
with the following definitions:
M
Number of segments
N
Number of samples per segment
Xfr
Transfer time per sample in s, typically 0.01 ??
DMA
Ovhd
DMA overhead time (per segment) in s
buffer
Ovhd
Circular buffer analysis overhead time (per segment) in s
Extra
Number of 'overhead' data points per segment
Cpy
Time to copy a sample in s
The formulas above assume that M and N correspond to the number segments and samples set with the function
AcqrsD1_configMemory. If fewer segments or samples are transferred, the timing might be somewhat less
favorable than estimated by the formula.
1. The transfer time X
fr
is typically 0.009 to 0.01 s (9 - 10 ns) per 8-bit sample for digitizers directly inserted on
the PCI bus of the host computer or connected through the SBS-Bit3 interface (Acqiris model number IC200). If
a digitizer is connected through the National Instruments MXI-3 interface, X
fr
is typically 0.012 s (12 ns). Of
course, these times would get larger, if there was considerable additional I/O traffic on the PCI bus.
2. The DMA overhead time Ovhd
DMA
is approximately (50'000 sec) / (Pentium CPU speed in MHz). Thus, for a
250 MHz Pentium Ovhd
DMA
is ~ 200 s, and for a 500 MHz Pentium it is ~ 100 s.
With applications running under Windows 95, Ovhd
DMA
has been observed to be ~ 20% lower.
3. The circular buffer analysis overhead time Ovhd
buffer
is ~ (2'500 s) / (Pentium CPU speed in MHz). Thus, for a
250 MHz Pentium Ovhd
buffer
is ~ 10 s, and for a 500 MHz Pentium ~ 5 s.
4. An Extra number of data samples must be transferred to the host computer with the memory image. It depends
on the sampling interval (in ns) and on the digitizer type. Here are some rough values: