ni.com is currently experiencing slowness/issues due to ongoing maintenance.

Support teams are actively working on the soonest resolution.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does stopping & disposing of task in TdmsContAcqVoltageSamples_IntClk_LogOnly example take so long (~500ms)?

Hello,

 

If I run the TdmsContAcqVoltageSamples_IntClk_LogOnly example under "National Instruments\NI-DAQ\Examples\DotNET4.5.1\Analog In\Measure Voltage" and I modify the stopButton_Click() function as follows and run the example:

            if(myTask != null)
            {
                var sw = new Stopwatch();
                sw.Start();

                // Dispose of the task
                myTask.Stop();
                myTask.Dispose();
                Debug.WriteLine("Stop & dispose time (ms): " + sw.ElapsedMilliseconds);
                myTask = null;
                stopButton.Enabled = false;
                startButton.Enabled = true;
            }

I am seeing the following print out:

Stop & dispose time (ms): 495

I am seeing similar (even higher) stop & dispose times in a custom application that uses a very similar analog input task. The lengthy time the stop and dispose operations take on an analog input task that is only logging is making it difficult for me to meet timing requirements in my application.

 

Why on earth does it take half a second to stop the analog input task and dispose of it? Is there any way I can improve the performance of these operations?

 

Thanks!

0 Kudos
Message 1 of 3
(2,166 Views)

It seems to me that it is the automatic logging that is making the stop & dispose so slow. When running the example, if I don't enter a TDMS file path, then stopping & disposing of the task takes ~50ms.

 

So, why does attaching a logger to an analog input task slow down it's stop & dispose so much? Are asynchronous writes being used under the hood when I call ConfigureLogging() on a task? Can I achieve better performance by doing the logging myself?

0 Kudos
Message 2 of 3
(2,154 Views)

Update: I am going to abandon built in task logging. Using explicit logging and continuous, asynchronous analog input reads I was able to eliminate the analog input task control bottleneck.

0 Kudos
Message 3 of 3
(2,147 Views)