What is profiling?
Profiling is the dynamic application analysis i.e. analysing the behaviour of the application during its execution.
Few of the important information that a profiler captures are:
- Monitor memory usage and leaks in any java applications
- Monitor method call duration
- Display info in graphs, reports, tree views, etc
In this blog I will discuss about Eclipse TPTP which is one of the very popular toll for Java profiling. The main objective of the blog is to show how configure eclipse TPTP in your local to do profiling during your development.
It is a preventive measure and ensure better performance of your code in production or live environment.
What is Eclipse TPTP?
The Eclipse Test and Performance Tools Platform (TPTP) is an open sourec platform and helps the developers in performance measurement of their developed code.
How to configure?
- Download the package from https://eclipse.org/tptp/home/downloadsThis package contains Eclipse along with its plug-ins and also the profiler. If you need only the profiler do the following.a.Unzip the package
b.Copy the features and plugins folder into a separate folder say agentController
- Configure Agent Controller
Go to Control Panel
Click on System and Security
Click on System
Click on Advanced System settings
Click on Environment Variable
From System variable select “Path” and then edit
Add jdk or jre bin path (example: C:\Program Files\IBM\SDP_RSA803\jdk\bin\)
Open a DOS command prompt window.
Navigate to the Agent Controller bin directory.
For example: If you have copied the agentController folder in C drive then
Enter SetConfig and press the Enter key
You will get message as shown below
Enter the path that you set in environment Variable
If you added path of environment variable as C:\ProgramFiles\IBM\SDP_RSA803\jdk\bin\
Then now enter C:\Program Files\IBM\SDP_RSA803\jdk\bin\javaw.exe and press Enter
You will get message as shown
You will get following message
3. Verify configuration
Type ACServer as shown and press Enter
Go to task manager and see ACServer is running
Run profiler on Websphere
Start your server in profile mode
In few seconds following window will appear
Click next and select the option you want to analyze
Once server is started , switch to Profiling perspective
Run your application and then go to RAD/Eclipse Profiling perspective , go to execution tab
Drill down to see statistics of each method
Double click the method to see detail. It will show the calling method for this method and also the methods this current method calls, time taken by this method for execution, number of times the method get called
If you are interested track only certain packages and methods do it by setting filter
Right click on server and select profile
Double click on Java Profiling- JRE 1.5 or newer
Create new filter by clicking Add at top section
Crate new exclusion rules in below part by clicking Add
- Average Base Time: This is the average time that a method took to complete. So, on average, this is how long a single invocation of that method took to finish (as noted above, this excludes the time taken by child methods called by this method or, more specifically, excluding the time of unfiltered child methods)
- Base Time: This is the total amount of time that a method took to complete. This is an amalgamation of all of the time that was spent in this method (excluding calls to other unfiltered methods.)
- Cumulative CPU Time: Cumulative CPU Time represents the amount of CPU time spent executing a specified method. However, the granularity of the data provided by the JVM in this regard is coarser then might be desirable. Consequently, CPU time maybe reported as zero if the time is less than a single platform-specific unit as reported by the JVM. Also, CPU time will not take into account other types of performance bottlenecks, such as those involving communication type and I/O accesstime. As a result, base time is often favored as a metric for performance bottleneck reduction.