Explain how to obtain a performance profile of my Java Program.
To improve the performance of a program, performance analysis is used. The usual purpose of this analysis is to determine which sections of a program to optimize which means to increase its overall speed, decrease its memory requirement or sometimes both. This analysis is called Profiling.
The Java2 platform provides profiling capability using Heap Analysis Tool (HAT). The heap analysis tool analyzes profile reports of the heap. The heap is a block of memory the JVM uses when it is running. The heap analysis tool generates reports on objects that were used to run application. Not only we can get a listing of the most frequently called methods and the memory used in calling those methods, but we can also track down memory leaks. Memory leaks can have a significant impact on performance. To obtain performance profiles of My Java program run the application with –Xrunhprof.
For Example: java -Xrunhprof My Javaprogram
The IDE like eclipse has The Eclipse Test & Performance Tools Platform (TPTP) which provides profiling tool for identifying and isolating performance problems such as performance bottlenecks, object leaks and system resource limits. The tool targets applications of all levels of complexity, from simple standalone Java applications to Eclipse plug-ins or complex enterprise applications running on multiple machines and on different platforms.