Measure Time Passed on a Running VI

Updated Jul 16, 2019

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Issue Details

What is the best way to measure how much time has passed on a VI that is running?
How long does it take my VI to run?
How can I benchmark my LabVIEW code?
 

Solution

To measure elapsed time in a VI that is running, the best way is to use the Tick Count (ms) block in conjunction with a Sequence Structure. This method is illustrated in the figure below to time length of the Wait (ms) function in the center. 




If you will be running your program for longer than 2 consecutive months, then Tick Count will roll over and is no longer an effective counting solution. Instead, use the Get Date/Time in Seconds function to time your program. This method is illustrated below in the figure. 

Additional Information

The Tick Count (ms) VI returns a 32-bit number (0 to 4 billion), which means, when using the above method to measure elapsed time, the Tick Count (ms) VI can run continuously for roughly 2 months before it rolls over. The tick count is reset back to zero when you restart your computer, so restarting the computer occasionally can prevent the Tick Count (ms) VI from rolling over.

The Get Date/Time In Seconds VI returns the number of seconds that have elapsed since 1904. This VI will not rollover until about 2050.

On Real-Time targets you can also use the Tick Count VI and configure it to show the elapsed time in ticks so you will have a more precise result.

WAS THIS ARTICLE HELPFUL?

Not Helpful