LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time spent in loop

Hi,
I wanted to know if there is a way to measure how much time (millisecond) is spent in a loop. I have a for loop with 200 iterations (attached as jpg) and would like to know how long the VI stays in the loop.

Thanks

0 Kudos
Message 1 of 11
(3,601 Views)

Here is a quick and crude way to do it

 

- there is always an easy way, but it is always the hardest to find
0 Kudos
Message 2 of 11
(3,582 Views)

Here is a method I use.  I use two tick count(ms) functions one and subtract the difference.

Brian

 

Brian
0 Kudos
Message 3 of 11
(3,568 Views)

You can place the elapsed time express vi in the loop, make sure to wire the Reset and Auto Resest Inputs to false.

 

Message Edited by AndrewAlford on 03-09-2007 01:51 PM

Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 4 of 11
(3,568 Views)
thanks for all the replies. I used the last method suggested as it was the easiest.

0 Kudos
Message 5 of 11
(3,545 Views)
I would not add anything into my loop that might add to the total process time.   The easiest method to implement might not be the best for performance.
 
Brian

Message Edited by brianlachlan on 03-11-2007 05:42 PM

Brian
Download All
0 Kudos
Message 6 of 11
(3,500 Views)
Brian,
 
For me it is still too expensive to take the tick count at every iteration, even though you only need the last value. If you take the second tick count only after the loop has finished, the VI shown is yet another 8x faster.
 
(Note that I cranked it up to 1000000 iterations).. Tick "inside": 64ms, as shown: 8ms. 🙂
 
Yes, sometimes a sequence structrure us useful! 😉
 
(I also wired the array across the sequence to make sure the indicator update happens after the second tick probe.)
 

Message Edited by altenbach on 03-11-2007 03:11 PM

Message 7 of 11
(3,484 Views)
Christian,
Thanks for the advice, would not have thought the tick count added so much. 
Brian
Brian
0 Kudos
Message 8 of 11
(3,468 Views)
Well, it's actually not adding not that much per iteration (56ms/1000000 iterations, or about 56ns). It will only make a real difference for very fast loops. 🙂
 
I agree that the express VI is a drag, though. 😮
0 Kudos
Message 9 of 11
(3,421 Views)
when i use the tickcount method it takes a longer time for my loop!?
When I used the time elapsed method 10 iterations took 0.25 sec but with the tickcount method I'm getting 1392ms.

0 Kudos
Message 10 of 11
(3,387 Views)