All Manuals > LispWorks IDE User Guide > 23 The Profiler

23.9 Some examples

The examples below demonstrate different ways in which the profiler can be configured and code profiled so as to produce different sets of results. In each example, the following piece of code is profiled:

(dotimes (x 1000)
  (capi:make-container
   (make-instance 'capi:title-pane
                  :text "Title")))

This is a simple form which makes some CAPI objects.

  1. Create a Profiler tool if you have not already done so.
  2. Copy the code above into the box in the Code to Profile panel.
  3. Choose Tools > Preferences... or click , select Profiler in the list on the left side of the dialog, and then select the General tab. Now you can change the package of the Profiler.

    Profiler Preferences

  4. In the Profiler Preferences, replace the default package in the Package text box with CAPI and click .
  5. Click OK to dismiss the Preferences dialog and apply the change you have made.
  6. Click on Profile.

    This profiles the functions in the COMMON-LISP, CL-USER and LISPWORKS packages.

    Next, add the CAPI package to the list of packages whose functions are profiled.

  7. Click Packages.
  8. In the dialog, double-click on CAPI in the Unselected Packages list, and click on OK.
  9. Click on Profile to profile the code again.

    Notice that this time there are many more functions which appear in the profile results.

  10. Select a few of the functions listed at the top of the Results area, and look at their function descriptions.

    Add the Description area by clicking the Description >> button if you have not already done so.

    Notice that most of the functions appearing on the stack are in the CAPI package. It is worth profiling a few functions explicitly, and removing unwanted packages from the list of packages to profile.

  11. Click Symbols..., and add the following four functions to the list in the dialog:
    merge find-class make-char functionp
    

    Type the name of each function and press Return or click to add it to the list.

  12. Click OK when you have finished adding to this list.

    Now remove the unwanted packages from the list of packages to profile, as follows:

  13. Click Packages....
  14. In the dialog click on None to remove all items in the Selected Packages list.
  15. Click on OK, and profile the code again by clicking on Profile.

    Notice that the four functions in the COMMON-LISP package are still being profiled, even though you are no longer profiling all functions from that package by default.


LispWorks IDE User Guide (Windows version) - 01 Dec 2021 19:38:07