User Function Profiling

The procedure file in this project will be in the WaveMetrics Procedures folder in 6.23 and provides a means of finding the bottlenecks in your user Function code. Until 6.23 is released, if you currently have a version of 6.20, you can try it out by downloading the most recent build of Igor here:
http://www.wavemetrics.net/Downloads/latest/

For this beta5 release, the Igor from the above page needs to be from a build date of Tue, 13 Dec 2011 or later.

This release supports ThreadSafe Functions and Functions contained in independent modules (but all code must execute in the main thread.) In addition to calling your test code via RunFuncWithProfiling as described below, you can start profiling, then start your test however you want and finally stop profiling. See the comments at the top of the procedure (renamed to FunctionProfiling.ipf in the beta2 release.)

To use the procedure, create a simple test function that takes no parameters and exercises your code for a least one second. Then, after loading the procedure, execute
RunFuncWithProfiling(YourTest)


The result will be a notebook containing annotated versions of the functions in your code that took the most time (top 80%.) Here is a simple example. Given:
Function Test()
    Variable i,imax=1000000
    for(i=0;i<imax;i+=1)
        Variable v1= 1
        Variable v2= sin(v1)
        Variable b3= enoise(1)
    endfor
End


Running
RunFuncWithProfiling(Test)

resulted in:
Top function percentages:
Function Procedure#Test: 100

Top functions with line annotations:

*******************************************************************************************
Function: Procedure#Test; Percent total 100
*******************************************************************************************
[00]            |Function Test()
[00]            |   Variable i,imax=1000000
[10]*           |   for(i=0;i<imax;i+=1)
[11]*           |       Variable v1= 1
[21]**          |       Variable v2= sin(v1)
[49]*****       |       Variable b3= enoise(1)
[08]*           |   endfor
[00]            |End


The procedure file, FunctionProfiling.ipf, contains comments at the top that provide more information on its use.

Project Details

Current Project Release

User Function Profiling IGOR.6.20.x-1-beta5

Release File: FunctionProfiling.ipf_2.zip (5.45 KB)
Version: IGOR.6.20.x-1-beta5
Version Date:
Version Major: 1
Version Extra: beta5
OS Compatibility: Mac-Intel Windows
Release Notes: Added ability to change the top percentage to be printed out.
View All Releases

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More