octave-maintainers
[Top][All Lists]
Advanced

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

Octave profiler,


From: Muthiah Annamalai
Subject: Octave profiler,
Date: Thu, 25 Jan 2007 20:28:26 -0600

Hello there,

I was wondering if we could write a simple Octave profiler,
modeled on Python interpreter & profiler setup.


[Python Model]
--------------
Python allows user to set the profiling function, and this
handle/function-ptr gets called for *every* C/Python function
invocation, and return points. Python supplies the 'stack-frame', event
type and additional arguments if any. 

Now event type can be any of 
{c-call,c-return, c-exception, 
 py-call,py-return, py-exception}.

One can set the handler using sys.setprofile(profile_fcn); where
profile_fcn is defined as 

def profile_fcn(frame,event,arg):
    # do something

In typical implementations,this function delegates events to particular
handlers.

Essentially, we need to be able to provide a hookup like
'sys.setprofile' in Octave core, we may be able to profile calls to
C/C++ , Fortran and Octave routines

One fairly small & complete profiler will be from the Python's 
python-svn/Lib/profile.py
( http://svn.python.org/view/python/trunk/Lib/profile.py?view=markup)

Documents for Python function sys.setprofile() and profile module,
can be got at 
http://docs.python.org/lib/module-sys.html and
http://docs.python.org/lib/module-profile.html  respectively.

I wonder if someone more experienced than me, in Octave core,
can comment, about where the handles will go, and what needs to be done.

-Muthu




reply via email to

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