From: bradb
Subject: Roll your own Lisp profiler?
Date: 
Message-ID: <1155566538.536072.322600@i3g2000cwc.googlegroups.com>
I am sure that I have read about how to create your own profiler with
Lisp's build in features.  I was sure OnLisp was where I read it, but I
can't find it.
I tried my own version, but I'm having problems replacing the function
FOO with a function that times how long FOO took to run.
I'm doing this with ECL, which says it has a profiler - but doesn't
look like works anymore.
Any tips on how to do this, or where I read about the roll your own
profiler?

Cheers
Brad

From: Thomas A. Russ
Subject: Re: Roll your own Lisp profiler?
Date: 
Message-ID: <ymi7j1bvujx.fsf@sevak.isi.edu>
You could also look at the generic common lisp metering code:

http://www-cgi.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/tools/metering/metering.cl 

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: bradb
Subject: Re: Roll your own Lisp profiler?
Date: 
Message-ID: <1155663118.899516.263950@75g2000cwc.googlegroups.com>
Thomas A. Russ wrote:
> You could also look at the generic common lisp metering code:
>
> http://www-cgi.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/tools/metering/metering.cl
>
> --
> Thomas A. Russ,  USC/Information Sciences Institute

Thanks for the link, I found that and cribbed some code to understand
the wrapping - the whole thing was a bit too much for what I wanted.

Cheers
Brad
From: Paolo Amoroso
Subject: Re: Roll your own Lisp profiler?
Date: 
Message-ID: <871wrjgxao.fsf@plato.moon.paoloamoroso.it>
"bradb" <··············@gmail.com> writes:

> I am sure that I have read about how to create your own profiler with
> Lisp's build in features.  I was sure OnLisp was where I read it, but I
> can't find it.

Norvig's book "Paradigms of AI Programming" briefly covers this.


Paolo
-- 
Why Lisp? http://wiki.alu.org/RtL%20Highlight%20Film
The Common Lisp Directory: http://www.cl-user.net
From: bradb
Subject: Re: Roll your own Lisp profiler?
Date: 
Message-ID: <1155569295.161977.46090@75g2000cwc.googlegroups.com>
Paolo Amoroso wrote:
> "bradb" <··············@gmail.com> writes:
>
> > I am sure that I have read about how to create your own profiler with
> > Lisp's build in features.  I was sure OnLisp was where I read it, but I
> > can't find it.
>
> Norvig's book "Paradigms of AI Programming" briefly covers this.
>
>
> Paolo
> --
> Why Lisp? http://wiki.alu.org/RtL%20Highlight%20Film
> The Common Lisp Directory: http://www.cl-user.net

Ah, I knew I read it somewhere.  I'll have to dig out my copy of PAIP.

Cheers
Brad
From: bradb
Subject: Re: Roll your own Lisp profiler?
Date: 
Message-ID: <1155575661.792141.28700@m79g2000cwm.googlegroups.com>
bradb wrote:
> Paolo Amoroso wrote:
> > "bradb" <··············@gmail.com> writes:
> >
> > > I am sure that I have read about how to create your own profiler with
> > > Lisp's build in features.  I was sure OnLisp was where I read it, but I
> > > can't find it.
> >
> > Norvig's book "Paradigms of AI Programming" briefly covers this.
> >
> >
> > Paolo
> > --
> > Why Lisp? http://wiki.alu.org/RtL%20Highlight%20Film
> > The Common Lisp Directory: http://www.cl-user.net
>
> Ah, I knew I read it somewhere.  I'll have to dig out my copy of PAIP.

For the sake of completeness, the big problem I was having was wrapping
the original function and renaming the original symbol.  The following
solution could be used:

(defun make-wrapper (fn)
  #'(lambda (&rest args)
      (format t "Wrapper is called~%")
      (apply fn args)))

(defun wrap-fun (fn-name)
  (setf (symbol-function fn-name) (make-wrapper (symbol-function
fn-name))))

Cheers
Brad