NextPrevUpTopContentsIndex

21.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:

(contain (setq title (make-instance 'title-pane
                                    :text "Title")))

This is a simple piece of code which creates and displays a CAPI title pane; each time you run the code a small window is created on-screen, which you can ignore or remove as soon as it is created.

  1. Create a Profiler tool if you have not already done so.
  2. Type the code above into the box in the Code to Profile panel.
  3. Choose Window > Window Preferences... or click
  4. in the Profiler, and select the General tab, to change the package of the Profiler.

    Figure 21.6 Profiler Preferences dialog

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

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

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

  16. Click Symbols... , and add the following four functions to the list in the dialog:
  17. funcall unwind-protect make-instance eval

    Type the name of each function and press Return or click

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

  20. Click Packages... .
  21. In the dialog click on None to remove all items in the Selected Packages list
  22. 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.

 


Common LispWorks User Guide (Macintosh version) - 5 Jul 2006

NextPrevUpTopContentsIndex