All Manuals > LispWorks IDE User Guide > 22 The Profiler


22.8 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)
   (make-instance 'capi:title-pane
                  :text "Title")))

This is a simple piece of code 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 LispWorks > 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.
  4. Figure 22.6 Profiler Preferences

  5. In the Profiler Preferences, replace the default package in the Package text box with CAPI and click .
  6. Click OK to dismiss the Preferences dialog and apply the change you have made.
  7. Click on Profile .
  8. 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.

  9. Click Packages .
  10. In the dialog, double-click on CAPI in the Unselected Packages list, and click on OK .
  11. Click on Profile to profile the code again.
  12. Notice that this time there are many more functions which appear in the profile results.

  13. Select a few of the functions listed at the top of the Results area, and look at their function descriptions.
  14. 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.

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

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

  17. Click OK when you have finished adding to this list.
  18. Now remove the unwanted packages from the list of packages to profile, as follows:

  19. Click Packages... .
  20. In the dialog click on None to remove all items in the Selected Packages list
  21. 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 (Macintosh version) - 25 Nov 2011