JProfiler is a tool to profile your java application. Jprofiler provides ways to record data to optimize performance.

Jprofiler Agent# JProfiler uses class loading event, inserts its own bytecode to perform its measurements when the classes are loaded.

Jprofiler UI# Can be used to take snapshots of measurements. Jprofiler MBean can also be used to control the profiling agent.

Snaphots of recorded data can also be compared using JprofilerUI.

IDE integration# Also it can be easily integrated with eclipse IDE. Just provide path to your eclipse installation.

  1. Choose eclipse location on IDE integration wizard on JProfiler.
Fig 1. Integrating Jprofiler with eclipse
  • Select Profile from eclipse Windows-> Perspective -> Customize Perspective -> Action Set Availability.
  • Restart Eclipse which -clean command option.
  1. Download#
  1. Integration with eclipse IDE#

Profiling a Java application and identifying performance issue#

  1. Execute the below java program.

This program has three methodsfastMethod, slowMethod andveryVerySlowMethod(). The idea here is to identify which portion of the code is slow. byprofiling this application.

Java Code#

package com.mycode.profiler;

public class JavaProfiler {

	public static void main(String args[]) throws InterruptedException {
		while(true) {

	private static void veryVerySlowMethod() throws InterruptedException {
		for(int i=0 ; i < 30 ; i++) {


	public static void fastMethod() {
		for(int i=0 ; i < 100 ; i++) {

	public static void slowMethod() throws InterruptedException {
		for(int i=0 ; i < 30 ; i++) {

Attach application with Jprofiler#

Fig 2 Attaching JProfiler to Java application

Observer the Call Tree#

The Call tree points us to the performance problem in code.

Fig 3. Result of Profiling