Trivial profiling tool written for Common Lisp, particularly for the Lisp dialect used in CoCreate Modeling
Common Lisp
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a ridiculously trivial profiling tool written for Common Lisp, particularly for the Lisp dialect used in CoCreate Modeling (also known as SolidDesigner, or more recently PTC Creo Elements/Direct Modeling).


See Thanks a lot to AlexG for the original inspiration.


Consider this code experimental, in a state of flux, and probably buggy as hell. Contributions are of course welcome anyway :-)

So far, this code was tested in CoCreate Modeling only. It is likely, but not guaranteed to work in other Common Lisp implementations as well.


To load the profiler into CoCreate Modeling, load lisp-profiler.lsp via File/Load, or enter the following in the user input line:

(load "lisp-profiler")

To enable profiling for an individual function:

( 'my-function)

Now run your test (which, of course, at some point should call my-function), and then review the profiling results as follows:


Sample output:

Accumulated execution times:
0.0200290680  FORMAT
0.0200290680  TEST-FUNC

To stop profiling my-function:

( 'my-function)

The with-profiler macro conveniently wraps the above steps into a single call:

( ('my-function)

To profile the function under test as well as all externally visible functions in a package:

  ('my-function (find-package "FOO-PACKAGE"))


If you prefer a GUI, load a simple profiler dialog into CoCreate Modeling as follows:

(load "lisp-profiler-ui")

This adds a entry called "Profiler" to the Toolbox menu. Click this entry to open the dialog.

Enter the names of functions or packages into the "Pkg/function" field one by one. Then enter the name of your test function or an arbitrary Lisp form into the "Code to profile" field. When you press Enter, the test function/form will be executed automatically, and the profiling results will be display in CoCreate Modeling's "output box".



CoCreate Modeling implements a subset of CLtL1 only. For example, there is no support for conditions, and the CLOS implementation is just a draft. So we cannot always use existing Common Lisp libraries or tools. Providing profiling functionality for CoCreate Modeling was and is my top priority, even if this means that lisp-profiler may become incompatible with other Lisp implementations.

I will try to provide at least a minimum level of compatibility with other Lisp dialects, though. Every now and then, I may even verify that claim by running tests :-D