Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CPU load on asynchronous operations

I've some curious effect:
Every time I use a kind of asynchronous operation like
AnalogMultiChannelReader.BeginReadMultiSample and call this function again
in the callback-routine I've got a CPU-load of 50-60% (it's an 2,8GHz CPU).
IMO this is a little too much. Is this a konwn bug and is there any solution
for this problem?

thanks

Exaple code:
(the timing-parameters and the number of samples have no crucial effect)

//at task config
Task AITask = new Task("AITask");
AITask.AIChannels.CreateVoltageChannel("Dev1/ai0","",AITerminalConfiguration
..Differential,-10,10,AIVoltageUnits.Volts);

AITask.Timing.ConfigureSampleClock("",
1000,
SampleClockActiveEdge.Rising,
SampleQuantityMode.ContinuousSamples);

AnalogMultiChannelReader.anal
ogInReader= new
AnalogMultiChannelReader(AITask.Stream);
analogCallback = new AsyncCallback(AnalogInCallback);
analogInReader.BeginReadMultiSample(1000,analogCallback, null);

//at AnalogInCallback(IAsyncResult ar)
data = analogInReader.EndReadMultiSample(ar);
//make something with data...
analogInReader.BeginReadMultiSample(this.pointsToRead,analogCallback, null);
0 Kudos
Message 1 of 3
(3,675 Views)
Hello

This is not really a problem. Check out this KB. Basically, the CPU yeilds to any process that needs to use the CPU, so it should not affect the other processes.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(3,674 Views)
The problem is: it has effect to my application....
exp:
I acquire 5000 samples with an (max) AI convert rate of 100000 saples/sec by
using the AnalogMultiReader.BeginReadSample - method called in an loop at a
separat thread.
So i start the thread and additionally call every 10ms the
AnalogMultiReader.ReadSingleSample -function of the same ni-ai-task in my
applikation. in this situation i got problems with starting an ni-analog
output task, the command executed with a time delay of ca. 5-10sec.
But I've found a solution for the problem by using the WaitUntilDone(0)
method of the ai-task. so the cpu usage is cut to the half and the execution
of the ao-task is done immediately.
even so thanks for the answer!
f. walker

"bilalD" schrieb im Newsb
eitrag
news:50650000000500000091510100-1073519706000@exchange.ni.com...
> Hello
>
> This is not really a problem. Check out this
>
href="http://digital.ni.com/public.nsf/websearch/09D80223FA84113D86256D6A004
B97C3?OpenDocument">KB
.
> Basically, the CPU yeilds to any process that needs to use the CPU, so
> it should not affect the other processes.
>
> Bilal Durrani
> NI
0 Kudos
Message 3 of 3
(3,675 Views)