Profiling

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# profile

Type: | - | function (subr)
Source: | - | xlsys.c, xleval.c

## Syntax

(profile flag) - turn profiling on or off
  flag - NIL turns profiling off, otherwise on
  returns - the previous state of profiling

## Description

The Xlisp 2.0 release has been extended with a profiling facility, which counts how many times and where eval is executed. A separate count is maintained for each named function, closure, or macro, and a count indicates an eval in the immediately [lexically] enclosing named function, closure, or macro. Thus, the count gives an indication of the amount of time spent in a function, not counting nested function calls.

The list of all functions executed is maintained on the global *profile* variable. These functions in turn have *profile* properties, which maintain the counts. The profile system merely increments counters and puts symbols on the *profile* list. It is up to the user to initialize data and gather results. Profiling is turned on or off with the 'profile' function.

Unfortunately, methods cannot be profiled with this facility.

## Examples

Back to top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference