Discussion:
NI DAQmx 8.3 and CPU usage
(too old to reply)
Artem ViTec
2007-01-11 13:10:14 UTC
Permalink
I have similar problem as described on page http://forums.ni.com/ni/board/message?board.id=250&message.id=23831but have solution and some reflections.first of all, about systemsystem use 2x PCI-6143 and take data from 16 channels with maximum rate (250 kS/s)program
was created about year ago (with LV 7.1.1, DAQmx 7.4) and on PC with
PIV (3.2 GHz) processor and 1 Gb of RAM work properly (CPU usage less
30%).Now I've recompile program with LV8.2 and update drivers to DAQmx 8.3. now program can't work properly because CPU usage 100%I create test VI for research this problem.First version (daq_test1) - simple code - configure daqtask and get data.I found:if
sample rate less or equal 90 kS/s (on PCI-6143) CPU usage less 5%, but
when rate more 95 kS/s CPU usage jump to 60% (for one or more channels
on one or two devises).Then I create simulated devise PCI-6143 in MAX and the same vi (daq_test1) require not more than 5-10% of CPU.also
I have examine devise 16E-4 and find the same problem: if samle rate
more than "boundary" rate, CPU usage is too much (50-70%).Then I add configure parameters (daq_test2) - add manualy DMA "on". There are no effects (CPU usage jump to 60% on "fast" rates)Then I  "play" with WaitMode (daq_test3). There are no effects (even if WaitMode=Sleep and SleepTime>1s CPU usage about 60%)Finally
I create vi (daq_test4), where "manually" check
AvailableSamplesPerChannel and call DAQmx Read only when bufer has more
samples, that I need.So I'd wound solution, but think driver
MUST check available samples carefully (also, why DAQmx 7.4 can fast
scan, but&nbsp; DAQmx 8.3 can't do it <a>at least the same way as previous version).</a>


daq_test.zip:
http://forums.ni.com/attachments/ni/250/27200/1/daq_test.zip
Kenn N
2007-01-12 21:10:11 UTC
Permalink
Artem,Thank you for contacting National Instruments support.&nbsp; This is expected behavior. When the wait mode is set to Sleep, DAQmx will only sleep if and only if
there is no data available to process. So, for example,&nbsp; at 200 kS/s, data is filling up the
buffer fairly quickly and should always be available to read, which means that
the process will not sleep at all. When data is always available, the CPU is
going to handle it as quickly as possible and thus the CPU will appear to be
running at near 100%. Specifying a wait mode of Sleep is really only beneficial
when the acquisition is running slowly enough that a lot of time is spent in
DAQmx Read waiting for the data to arrive. In the past, the CPu was maxed out even at extremely slow sampling rates.&nbsp; Sleep mode
alleviates this problem by putting the process to sleep when no data is ready
for processing; however, if data is available, it will be handled immediately
and no sleeping will occur. If data is constantly available for processing, the
CPU is expected to deal with it right away and the usage will appear to be high.Regards,
mitulatbati
2008-07-28 10:40:08 UTC
Permalink
Hello,
I just try to set up my system so that I get 1000 samples/s, always the actual aquired values, and without high CPU usage. Quite a simple task.
On the schreenshot you can see how I set up my channels. With this setup I get the values at low CPU usage. It is cool! But I just don´t understand what WaitMode=Sleep and SleepTime mean? In the helpfile stands: "Check for available samples once per the amount of time specified in SleepTime".
Does it mean, if I query a read from my task, it will pull the data only once a second? If I set SleepTime=0, I get the same (I hope the same...) data as at SleepMode=1sec, but the CPU usage is 100%.
So can anybody describe, how does WaitMode=Sleep work?
Thanks in advance
MB


DAQmx_init.JPG:
Loading Image...
G Lo
2008-07-29 16:10:11 UTC
Permalink
MB,
&nbsp;
Your definition of wait mode is correct, if sleep is set as the wait mode then the DAQmx Read will check for available samples once per the sleep time.&nbsp; As Kenn N. had stated in his post, this sleep mode will only function if there are no samples available in the buffer.&nbsp; I would recommend looking at Kenn's post again if you have further questions about this.&nbsp; For example, if you are filling the buffer continuously at a high rate, the sleep will never take effect because there are always available samples.&nbsp; I have attached a piece of sample code which utilizes this wait mode for a finite&nbsp;acquisition.&nbsp; If you change the the sleep time on the block diagram, you will notice that the samples take longer to graph due to the wait.&nbsp; Basically, if no samples are available then the Sleep will take effect&nbsp;and the process will be put to sleep for a specified amount of time.&nbsp; Hope this&nbsp;helps!&nbsp;


Measure Voltage.llb:
http://forums.ni.com/attachments/ni/250/41938/1/Measure Voltage.llb
mitulatbati
2008-07-30 10:40:07 UTC
Permalink
Hi,
I would accept your explanation, but if I set SleepTime=0.1, then the CPU usage is low. When SlepTime=0, then 100%...
This is what I don´t understand.
regards
MB
G Lo
2008-07-31 17:10:13 UTC
Permalink
MB,
By placing SleepTime as 0&nbsp;this means that the process will not sleep at all. This implies that the CPU is going to handle the data as quickly as possible and the usage will appear to be&nbsp;100%.&nbsp; By&nbsp;having some kind of sleep value (.i.e. .1) you will have&nbsp;given the CPU a chance to rest&nbsp;or&nbsp;process other tasks.&nbsp;
Loading...