Exercise Four: Collecting Profile Data
This exercise shows you how to run the Blink project with the Java WorkShop profiler. The profiler helps you analyze the performance of your program to determine how much time is spent in each of the program's methods and how many times each of the methods are executed.
- Check the project manager for the name of the current project.
If the current project is not Blink, double-click on the Blink project name.
- Start profiling the Blink project by clicking the Profile
button on the Java WorkShop main toolbar.
The Applet Viewer window is displayed.
- Wait at least 45 seconds before going on to the next step.
This provides enough data to produce a useful profiling display.
- End the profiling session by choosing Applet -> Quit, in the applet viewer.
After profiling the program, the Profiler window displays the data written to the project source directory's Blink.prof file.
- In the Profiler window, choose Filter -> None to display the system class data.
- Choose View -> Sort by Name to display the method data in alphabetical order.
- Select the Blink.paint (Ljava/awt/Graphics;) method.
- Review the profile data, with results similar to the figure below:

The results indicate that:
- Java WorkShop spent 93 milliseconds calling the Blink.paint (Ljava/awt/Graphics;) method.
- Blink.paint (Ljava/awt/Graphics;) calls three methods: java.awt.Color. (III), java.awt.Component.size (), and java.awt.Font.getSize ().
- The two methods that call the Blink.paint (Ljava/awt/Graphics;) method are: java.awt.Component.dispatchEventImpl (Ljava/awt/AWTEvent;) and java.awt.Component.update (Ljava/awt/Graphics;).
Next lesson:
- You have completed the lessons in this tutorial. The next tutorial is Tutorial Two: Editing Project Attributes.