comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Line Profiling in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Line Profiling in IDL [message #41760] Wed, 08 December 2004 08:29 Go to next message
Eric Tittley is currently offline  Eric Tittley
Messages: 3
Registered: December 2004
Junior Member
Hi,

Is there a tool or set of tools for line profiling of IDL code?

Line profiling reports the execution time spent on each line of source
code. IDL has a profiling tool, but it only resolves the time spend in
functions/procedures.

I had been unable to find anything online so wrote a script to perform
line profiling. I should have checked the newsgroup first, since I'm
undoubtedly re-inventing the wheel.

Cheers,
Eric

--
Eric Tittley www.hmet.net
Re: Line Profiling in IDL [message #41957 is a reply to message #41760] Fri, 10 December 2004 02:04 Go to previous messageGo to next message
Ben Panter is currently offline  Ben Panter
Messages: 102
Registered: July 2003
Senior Member
Hiya Eric,

> Is there a tool or set of tools for line profiling of IDL code?

Not that I know of. I usually just put systime(/seconds) around the line
I want to check and compare them, but it's certainly not ideal.

> I had been unable to find anything online so wrote a script to perform
> line profiling. I should have checked the newsgroup first, since I'm
> undoubtedly re-inventing the wheel.

If it's generic, fancy sharing?

I just moved from 150 point spectra to 1500 point spectra, and my
routines have gone from 2 minute wonderbeasts to 2 hour slugs...

:(

Ben

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Panter, Garching, Germany
email via www.benpanter.co.uk
Re: Line Profiling in IDL [message #42033 is a reply to message #41957] Mon, 13 December 2004 07:01 Go to previous message
Eric Tittley is currently offline  Eric Tittley
Messages: 3
Registered: December 2004
Junior Member
Hi Ben,

Since I have heard of no other option (I don't appear to be reinventing
fire), I will gladly make the code available. I'll set up something on
my web page and post the link on this newsgroup.

Otherwise, you can just grab the necessary files via your ROE account,
getting them from:
/home/ert/idl/lib/line_profile/

The script pretty much does automatically what you are doing manually.
For each line of a .pro file, it brackets the line with systime(1)
commands, adding some other code to store the timing data for the line
and to save the timing data. The 'profile' code is stored in another,
unique, file. Compile and run the 'profiled' code. This produces a
file containing the timing data. The timing data is then processed by
an IDL script which reports the lines from the source code that consume
the top %90 of the CPU time.

There are explicit instruction on use with the files.

It actually does work! systime() seems to have little overhead, so the
profiled code runs almost as fast as the original.

There are some caveats, since the code is very much in the alpha stage.
At the moment, it can only handle one function or procedure per file.
It looks for the words FUNCTION or PRO and starts there, ending at the
first END that starts at the first column (to avoid confusion with END's
in CASE or SWITCH statements). Fortunately, this meshes with my
programming style, which could very well be another caveat: the code
works for code that *I've* written, so it probably includes implicit
assumptions concerning what it expects. I'd be very interested to hear
how it works for other's code.

BTW, it does deal with continued ($) lines properly.

Cheers,
Eric

Ben Panter wrote:

> Hiya Eric,
>
>> Is there a tool or set of tools for line profiling of IDL code?
>
>
> Not that I know of. I usually just put systime(/seconds) around the
> line I want to check and compare them, but it's certainly not ideal.
>
>> I had been unable to find anything online so wrote a script to
>> perform line profiling. I should have checked the newsgroup first,
>> since I'm undoubtedly re-inventing the wheel.
>
>
> If it's generic, fancy sharing?
>
> I just moved from 150 point spectra to 1500 point spectra, and my
> routines have gone from 2 minute wonderbeasts to 2 hour slugs...
>
> :(
>
> Ben
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: iplot
Next Topic: Announce: IDL Line Profiling software

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:02:36 PDT 2025

Total time taken to generate the page: 0.04622 seconds