LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

execution time optimizing labview code

Highlighted
Hi,

I would like to optimize my labview program. Is there a way I can plot the execution time of my program as a function of some parameter I am changing in my program. I was thinking of placing the entire program in a while loop and then changing the parameter during each loop iteration and then outputting the time that the program takes to execute as a function of the parameter. The problem is how would I obtain the execution time.

Thank you,

-Tim
0 Kudos
Message 1 of 5
(1,046 Views)

Tim,

Look at Tools -> Profile.  This should give you all the information you are looking for about your VIs.  It maybe only available in Professional Editions.

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
Message 2 of 5
(1,040 Views)

You can always use the "Tick Count (ms)" VI to get a ms value.  So before a section of code runs get the tick count and than after it runs get the tick count.  You can then subtract the 2 and there you have the time needed to run that section. 

You will most likely need a sequence structure to ensure they are timed correctly.  This is one of the few times I use a sequence structure.  Of coarse you could also make a SubVI that returns the Tick Count, but also has error in and error out.

Message 3 of 5
(1,039 Views)
Here a re a few more tips:
 
Running on a typical multipurpose OS will will make things a bit unpredictable because you never know what else is running so you should always repeat each run many times (then take the fastest, not the average, of all corresponding times).
 
Make sure that each run takes a few hundred milliseconds to get accurate values.
 
For timing purposes, it might be worth to temporarily raise the execution priority. The results will be much more reproducible (at the expense of useablility).

LabVIEW Champion Do more with less code and in less time
Message 4 of 5
(1,035 Views)
Hi,

I used the tick count method to obtain times for the execution of the program but the times reported here are greater than those found by the using the profile vi feature in labview. I have attached my vi here as well. Could someone suggest why there may be a discrepency between the two values.

Thank you,

-Tim
0 Kudos
Message 5 of 5
(986 Views)