LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI XML Functions Execution Times Increase When Looped

Solved!
Go to solution

I have written multiple functions using CVI that read XML files. I have confirmed in the Resource Tracking utility that i have cleaned up all of my lists, elements, documents, etc. I have found that when I loop any of the functions I have created, the execution times increase. The increase is small but it is noticable and does effect my execution.

 

Are there any other sources of memory that I need to deallocate? It seems that there is a memory leak somewhere but I am unable to see where this increase is located.

 

I am currently running LabWIndows/CVI 2009 on Windows 2008 Server. I have looped my functions using TestStand 4.2.1. Any help would be appreciated!

 

Thanks in advance,

Kyle

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

Hey Kyle,

 

It's possible that you could see a small increase in execution speed due to overhead from the loop, but if execution time grows longer and longer, that could certainly indicate a problem. Is that the behavior you're seeing?

 

Also, is it possible that you're doing more in each loop as the sizes of your file or data structures grow? I'm not sure how the code is set up, but for example if you're inserting into an array, that operation could take longer as the array grows larger.

 

Finally, how are you timing the execution? If you're doing it in TestStand, it's possible that the loop takes longer each time due to the growing size of the results container. You could turn on On-The-Fly reporting to alleviate that issue.

 

If you can answer those questions it should help shed some light on the situation, and hopefully at that point we'll be able to help more!

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

HI Daniel,

 

Thanks for the quick response.

 

It is indeed slow down in execution speed when we loop. When looped, the XML reader is overwriting variables, not adding to an array. Our application is structured differently than my test case. We run a CVI function from TestStand that contains a series of commands, which contains the XML reading. The XML looping is really done in CVI. I used TestStand in my test case just to get execution times. Our psuedocode for the CVI function is as followed:

 

For loop (looping over values, like amplitude or frequency)

Reading the XML

Applying the data from the XML to set up some instrument(s)

Do something...

End loop

 

I can confirm that the instrument set up is not the cause of the slow down. We have written the same XML reading in C# and applied the values to the instrument setup and do not experience the slow down.

 

I tested with On-The-Fly Reporting enabled and the execution time continued to slow down.

 

I hope that answers all of your questions!

 

Thanks,

Kyle

 

 

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

Kyle,

 

Thanks for the information. I'm not sure what it could be, but since the same code is working in other landguages, it seems that it has to be a reference being left open somewhere.

 

One way we could try and confirm this would be to use PerfMon to track memory usage over time--since the execution is slowing down, I would expect to see memory usage increase over time. Here's a KnowledgeBase article about PerfMon, it mentions LabVIEW but should also apply to CVI: http://digital.ni.com/public.nsf/allkb/BF3082871516A32D86256F2B00447A2E?OpenDocument

 

If you could give that a try and let us know the results, it would be helpful. Also, would it be possible to see the actual code that's causing the problem? That might help as well.

0 Kudos
Message 4 of 5
(3,434 Views)
Solution
Accepted by topic author sadlikkj

Hi Daniel,

 

After some playing around, it turns out the source of my problem was due to running my program as a Debug build rather than a Release build. As soon as I build in a Released configuration, looping the function stays at a consistant and quick time.

 

Thank you for looking into this problem for me.

 

Kyle

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