Java Profiling with WSAD 5.0

After profiling your modified code, you can observe that the number of "Live Instances" of the DummyClass is 0 and the number of "Collected" instances equals to the number "Total" instances of the DummyClass. (See Figure 8.)

In this example, you have observed that the use of this profiling tool helps you identify and correct memory leaks.

Hands-on Example: Identifying Method Response Times

In the second example, you will identify method response times using the WSAD Profiling Tool. In the class below, you are calling a number of methods that each sleep for a predefined number of seconds. In this example, you will repeat Steps 1–7 from the previous section. (The link to the full source code of this class, ProfileTestTwo.java, is located in the zip file at the end of this article.)

This time, you are interested in a different Profiling Perspective to observe the results. After the profiling session finishes its execution, right-click on the default monitor --> Open With --> Method Statistics.

You can observe that the methodThree() method takes the longest cumulative time because it spends the longest amount of time in sleeping mode.

Conclusion

In this article, you have learned how to use the WSAD Profiling Tool to identify memory leaks and method invocation times. The tool benefits developers because it is a means to identify issues that are not evident on the surface.

Download the Code

About the Author

Aleksey Shevchenko has been working with object-oriented languages for over seven years. He has been implementing Enterprise IT solutions for Wall Street and the manufacturing and publishing industries.