Profiling is an important aspect for programmers as this is the process where the programmer can find out high memory usage, high CPU usage, network contention issues etc.
There are various profilers available in the market and most of these are commercial versions.
Eclipse community has a project named Testing and Performance Tools Platform (TPTP) to address this. Here only the profiling aspect of TPTP is discussed, however the capability of TPTP is much more.
TPTP
This feature can be used to profile local Java applications or complex applications running on multiple hosts and different platforms.
This is integrated with Eclipse, allowing profiling of applications running from within Eclipse.
TPTP can be installed through Eclipse Provisioning Manager or manually download the required packages of TPTP and place it in the plugins directory.
Agent Controller - This process enables client applications to launch other applications locally or remotely and interact with agent processes to collect profiling data. If TPTP is to be used on java application locally then this standalone agent controller is not required as TPTP is bundled with Agent Controller.
The three profiling operation that are implemented.
CGProf: This profiling option is used for identifying performance bottlenecks, by breaking down execution time at the per-method level.
HeapProf: This option allows you to identify the contents of the heap by tracking object allocation and de-allocation throughout the lifetime of the program.
ThreadProf: This profiling option allows you to trace thread usage throughout the lifetime of the program.
TPTP woks in the Profiling and Logging Perspective of Eclipse.
Execution Time Analysis
This aspect of TPTP gives the execution time of packages, classes and methods for analysis
This is helpful in finding the points of execution consuming more time than expected which are potential performance bottlenecks.
Terminologies
Base Time: The time to execute the contents of the method itself, excluding calls to other methods. (In the chart, the Base Time field has summed together all calls of that method)
Average Base time: The average time a particular method took to complete, excluding the time of method calls to other methods. (In the chart, this is the base time divided by the number of Calls)
Cumulative Time: The time to execute the contents of the method itself, including calls to other methods.
Steps:
Choose the project and select the path mentioned above.
Select the profile configuration to be done – Junit, Applet, Application or Server Project.
Choose Monitor tab and select ‘Execution Time Analysis’.
Click on edit options and select ‘Collect method CPU time Information’.
Memory Analysis
This aspect of TPTP gives the memory usage of packages, classes and methods for analysis.
This is helpful in finding the points of execution consuming more memory than expected which are potential cases for memory leaks.
Terminologies
Live Instances: The number of instances of the particular class that are still live in memory (have not been garbage collected.)
Active Size: The total number of bytes in the heap that all live instances are presently consuming.
Total Instances: The total number of instances of this class that have been created during the JVM’s lifetime (including garbage collected objects).
Total Size: The total size of all instances of this class that have been created during the JVM’s lifetime (including garbage collected objects).
Average Age: Average age of an object before it is garbage collected.
Steps:
Choose the project and select the path mentioned above.
Select the profile configuration to be done – Junit, Applet, Application or Server Project.
Choose Monitor tab and select ‘Memory Analysis’.
Click on edit options and select ‘Track Object Allocation Sites’.
Thread Analysis
This aspect of TPTP gives the thread contention of packages, classes and methods for analysis.
This is helpful in finding the points of execution where thread is waiting for resources even after the completion of operation.
Steps:
Choose the project and select the path mentioned above.
Select the profile configuration to be done – Junit, Applet, Application or Server Project.
Choose Monitor tab and select ‘Thread Analysis’.
Click on edit options and select ‘Contention Analysis’.
Key points
Custom Probe kits can also be inserted to profile the application.
Memory analysis gives pointers to high unusual memory usage which could be possible candidates for memory leak.
High execution times of classes or methods are pointers to performance problems which can be fine tuned.