octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: profiling (was: Re: Octave Compiler)


From: John W. Eaton
Subject: Re: profiling (was: Re: Octave Compiler)
Date: Wed, 18 Feb 2004 16:45:50 -0600

On 18-Feb-2004, Przemek Klosowski <address@hidden> wrote:

| I would imagine that finer would be better---per-statement for .m
| files and per-function for .oct files. What would be a nice
| interface to it? perhaps a structure, where field names identify
| functions, and the value is a 2D array whose i-th elements are the
| count and cumulative time in the i-th line
| 
|       profile.sum(1,1)=1      first line of function 'sum' executed once
|       profile.sum(1,2)=.05    .05 seconds spent in first line of function 
'sum' 
| 
| How does that look?

There are already profiling commands in Matlab, so it would probably
be good to be compatible unless we can come up with something that is
much better (and even then, we should not make it impossible for
someone to write a compatibible interface).

| I have no idea how expensive would that be
| (e.g., would profiling itself change the timing?);

I think the data should be stored internally in a special purpose data
structure, so that it can be relatively efficient.  Getting the
timestamps should not be too expensive, though I have not tried to
time calls to getrusage.  The time spent converting the internal
representation to an Octave structure array should not matter too
much, as normally one would stop profiling before examining the
results of a run.

| Should profiling be a command-line option, or should it be a runtime
| on-off option, like tic and toc?

The Matlab interface provides

  profile on
  profile off

etc.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]