Example Code

Measure Average Code Execution Time Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Description

Overview

If you are looking to benchmark your code, you can accomplish this by using a Flat Sequence Structure and the Tick Count (ms) timer. The 3-sequence Flat Sequence Structure allows you to take a time measurement before code is run, run code, and measure time after code is run. Comparing these two times helps you measure elapsed time, or the time it took for your code to run.



Description
This VI will allow you to benchmark your code.  Place the section of code you want to benchmark within the sequence structure and set the number of iterations, and the code will display the maximum, minimum, and average runtimes of your code.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Insert code into the structure as directed
  2. Specify the number of times to test
  3. Click 'Run'

 

Additional Information or References

VI Snippet

00.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.