Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DaqSystem.Local.Devices takes >1 minute

I've been using DaqSystem.Local.Devices to get a list of analog input channels.  Recently, I noticed that it takes about 90 seconds for the first call, but very fast for subsequent calls.  I am using Visual Studio 2010, C# language, .NET Framework 4.0, Measurement Studio 2010 SP1, and NIDAQmx 940f1

 

Below are the code fragment and output.  It is slow whether or not I have hardware connected.

 

Any suggestions?

 

        private void Form1_Load(object sender, EventArgs e)
        {
            Console.WriteLine("Before: " + DateTime.Now.ToLongTimeString());
            Console.WriteLine(DaqSystem.Local.Devices.Length);
            Console.WriteLine("Middle: " + DateTime.Now.ToLongTimeString());
            Console.WriteLine(DaqSystem.Local.Devices.Length);
            Console.WriteLine("After: " + DateTime.Now.ToLongTimeString());
        }

 

Before: 2:09:54 PM
0
Middle: 2:11:24 PM
0
After: 2:11:24 PM

0 Kudos
Message 1 of 3
(5,491 Views)

Hi HLee

 

I think what is happening is that when the function is called originally it is the first time it is reserving the resource which is taking longer, Are you communicating with the device at any point previous to this in the code?

0 Kudos
Message 2 of 3
(5,464 Views)

I would hazard a guess that the complier is optimizing your code for you and only doing the call once.

0 Kudos
Message 3 of 3
(5,456 Views)