http://static.artfulcode.net/newlisp/profiler.lsp.html
The overhead is pretty low - a call to time and two calls to inc per profiled function call. Even with the overhead, though, the relative stats are useful, and the larger the function, the less relative the overhead per call is. In that way, it is somewhat skewed on small function calls, but only by ~5 ms for each 10,000 calls:
Code: Select all
> (setq x 0 y 0)
0
> (time (begin (inc 'x) (inc 'y (time '()))))
0
> (time (begin (inc 'x) (inc 'y (time '()))) 10)
0
> (time (begin (inc 'x) (inc 'y (time '()))) 100)
0
> (time (begin (inc 'x) (inc 'y (time '()))) 1000)
0
> (time (begin (inc 'x) (inc 'y (time '()))) 10000)
5