From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing a FOR loop

Solved!
Go to solution

Hello,

 

What is the best way to time the period in which a FOR loop executes.

 

I have a piece of code in a FOR loop and it executes 500 times. Whats the best way to time the duraction of the execution?

 

Thanks,

 

Nevica

0 Kudos
Message 1 of 5
(2,328 Views)

Do you want to measure the time? If so, this is one of the few cases where a flat sequence is of use; Place a Time(ms) in the first frame, your loop in the second and a 2nd Time in the 3rd, calculate the difference.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 5
(2,326 Views)
Solution
Accepted by topic author nevica

Attached is a quick example as described.

 

Using timing probes help as well.  Generally you probe an error wire to start the timer, then probe another error wire and the probe calculates the time difference between them.

Message 3 of 5
(2,315 Views)

Many thanks.

 

I was unclear as to the best timing .vi to use. 

 

'High resolution relative seconds.vi' is a .vi you wrote? It is password protected! It is not available on the palate so you must have written it, or someone else.

 

Thanks,

 

Nevica 

0 Kudos
Message 4 of 5
(2,309 Views)

I only attached one VI and High resolution time was not one of them so I did not write it.  Looking at the help you can see the file on disk (or CTRL + I to open the documentation).

 

You'll see it is in the vi.lib installed with LabVIEW it just isn't on the palette.  It has been added to the hidden gems package.  I still don't know which timing tool to use or when.  Generally I just use the Tick Count which gives a resolution of ms.  In almost all situations this will be fine but there maybe cases where you want to see more digits of precision.  Still there is a limit at some point.  How many clock cycles does it take to read the time and return it?  Heisenberg comes into play at some point.

0 Kudos
Message 5 of 5
(2,294 Views)