All Manuals > LispWorks IDE User Guide > 25 The Profiler

NextPrevUpTopContentsIndex

25.4 Steps involved in profiling code

Each time you profile code, you first need to set up the profiler to ensure that you find out the sort of information you are interested in. This section gives you details about how to go about this.

The steps that you need to take when profiling code are as follows:

  1. Choose which functions you want to profile.
  2. Specify the code that you want to run while profiling.
  3. Perform the profile.

Note: You do not have to adhere strictly to the sequence shown above, but this is the order that you should usually follow.

See the chapter on the Profiler in the LispWorks User Guide and Reference Manual for information on advanced configuration of the profiler.

25.4.1 Choosing the functions to profile

It is possible to keep track of every function called when running code, but this involves significant effort in determining which functions are suitable for profiling and in keeping track of the results. To minimize this effort you should specify which functions you want to profile. The profiler checks that these functions have indeed got function definitions and are therefore suitable for profiling. For more information on the types of function that can be profiled, see Profiling pitfalls.

There are two ways of specifying functions that you want to profile:

25.4.1.1 Choosing individual functions

Click Symbols... to specify a list of Lisp functions that you want to profile. The dialog shown in Select Symbols to Profile dialog appears.

Figure 25.4 Select Symbols to Profile dialog

This dialog displays the list of functions to be profiled.

Click OK when you have finished choosing symbols.

Note: while entering the function name in the New Symbol text box you can click click to use completion. This allows you to select from a list of all symbol names which begin with the partial input you have entered. See Completion for detailed instructions.

25.4.1.2 Choosing packages

You may often want to profile every function in a package. Click Packages... to specify a list of packages whose functions you want to profile. The dialog shown in Select Packages to Profile dialog appears.

Figure 25.5 Select Packages to Profile dialog

The main part of this dialog consists of two lists:

A global function will be profiled if its symbol is visible in one of the selected packages.

To modify the Selected Packages list:

  1. Consider whether one of these buttons offers what you need, or close to it:
  2. All

    Selects all packages.

    Note: There are significant processing overheads when profiling all functions in all packages, and the results you get may include much unwanted information.

    User Only

    Adds the "user" packages, which means packages that are not part of the LispWorks implementation, or packages that are part of the implementation but you are allowed to add definitions to them. Includes the CL-USER package.

    User and CL

    Adds the "user" and CL packages.

    User and Standard

    Adds the "user" packages along with those packages that are used by default (from the value of hcl:*default-package-use-list*, which initially includes CL, HCL and LW).

    Note: The Profiler tool assumes that packages not named in the value of *packages-for-warn-on-redefinition* are user-defined.

  3. Add to your Selected Packages list if necessary. You can add a single package in one of three ways:
  4. Type the package name in the Select Package box and press Return or click , or

25.4.2 Choosing the time interval

See the chapter on the profiler in the LispWorks User Guide and Reference Manual for information on how to set the time interval at which you want the Lisp process to be interrupted.

25.4.3 Specifying the code to run while profiling

Code which is to be executed during profiling should be entered in the Code to Profile area. This is actually an editor window, and so you can use all the keyboard commands which can be used in the editor.

Code may be placed in this window in three ways:

Specify the package in which you want to run the code to be profiled using the Package box in the General tab of the Profiler Preferences. To see this, choose Works > Tools > Preferences... or click , and select Profiler in the list on the left side of the dialog. If you are unsure, full details on how to do this can be found in Specifying a package. Like all other tools in the LispWorks IDE, the Profiler can have a particular package associated with it; the default package is CL-USER.

25.4.4 Performing the profile

Once you have set up the profile as described above, perform the profile itself by clicking on the Profile button in the Profiler.


LispWorks IDE User Guide (Unix version) - 12 Feb 2015

NextPrevUpTopContentsIndex