Turn on profiling for one function
NOTE: An alternative to this utility, which has significantly less
functionality but doesn't use hons-enabled features of ACL2, may be
found in community book books/misc/profiling.lisp. See hons-and-memoization for a general discussion of memoization, on which
this profile utility is built, and the related features of hash consing
and applicative hash tables.
Profile can be useful in Common Lisp debugging and performance
analysis, including examining the behavior of ACL2 functions.
(profile 'fn) ; keep count of the calls of fn
(profile 'fn ; as above, with some memoize options
(memsum) ; report statistics on calls of memoized functions (e.g., fn)
(clear-memoize-statistics) ; clear memoization (and profiling) statistics
Evaluation of (profile 'fn) redefines fn so that a count will be
kept of the calls of FN. The information recorded may be displayed, for
example, by invoking (memoize-summary) or (equivalently)
(memsum). If you wish to gather fresh statistics for the evaluation of a
top-level form, see clear-memoize-statistics.
Profile is just a macro that calls memoize to do its work.
Profile gives the two keyword parameters :condition and
:recursive of memoize the value nil. Other keyword
parameters for memoize, which must not include :condition,
:condition-fn, or :recursive, are passed through. To eliminate
profiling, use unmemoize; for example, to eliminate profiling for
function fn, evaluate (unmemoize 'fn).
Functions profile-all and profile-ACL2 are available for
profiling all functions or all ACL2 functions, respectively.
- profile essentially all functions
- profile essentially all ACL2 functions