IDL Line Profiling

Introduction
News
Download
Installation
Usage
Expected Format of the IDL Code

Introduction

Line profiling determines the amount of time spent executing each line of code.

IDL has a PROFILE tool, but it only determines the amount of time spent in each function or procedure. It doesn't resolve the time spent on each line.

Included here are the necessary scripts and procedures to perform line profiling on IDL code.

NOTE: This is a very young version. It makes assumptions about the source code file that may not always be true (see below) but it should be easy to alter the source code to conform to the expectations. As the code matures, it will become more robust. Hopefully the script will become more versatile as I develop it. I invite users to contact me with comments.

News

2007-02-13: Version 1.1 released.

Download

The current version is IDL_line_profile-1.1.tgz.

Installation

Extract the files from the .tgz archive (see Download).

In your regular path (~/bin/ for example), install the file:
IDL_line_profile

In your IDL path (or add a path in your startup.pro file), install:
process_line_profile.pro
profile_save.pro

Usage

If my_program.pro is the script/procedure you wish to line profile, then

  1. Process the procedure source with the C-shell script: IDL_line_profile
    At the *shell* prompt:
    > IDL_line_profile my_program.pro
    This will produce a file: my_program_XXXXXX.pro where XXXXXX is randomly selected to not overwrite any existing file.
  2. Compile the code in IDL. Don't rely on auto-compilation as that will compile the original, unprepared code.
    At the IDL prompt:
    IDL> .compile my_program_XXXXXX.pro
  3. Run the procedure as you normally would.
    IDL> my_program, argument1, argument2
    This will produce a file: my_program_XXXXXX.sav containing the line-profile information.
  4. Process the line-profile information into something useable.
    IDL> process_line_profile, 'my_program_XXXXXX.sav'

Expected Format of the IDL Code

At the moment, the source file can have only one procedure. Simply put, the script processes all the lines of code between the first PRO and the first END statements.

So these are good:


PRO my_program
 code line 1
 code line 2
 ...
END

; Comment
; Comment
PRO my_program
 code line 1
 code line 2
 ...
END

This is bad:


FUNCTION my_function, arg1
 function line 1
END

PRO my_program
 code line 1
 code line 2
 ...
END

Last modified: 2007-02-13 (Eric Tittley)

HMET

HMET Webmail
Photo Gallery
Wiki
WhIsKI

About Eric
Research
Teaching
HOWTOs
Software
Play

Contact Info


Links:
Astronomy
Weather
Surfer's Paradise

Software
IDL Line Profiling
Matlab/Octave Astronomy Library