Stackify is now BMC. Read theBlog

What is the best way to profile a Java application in eclipse

  |  May 1, 2023
What is the best way to profile a Java application in eclipse

Java profiling in Eclipse allows you to optimize your code, streamline your application, and better understand your program.  When profiling your application using a line-level analysis, you can reveal the slowest line within a sluggish piece of code, helping you efficiently troubleshoot problems.

There are a variety of platforms for profiling Java eclipse. Eclipse is a popular software and is especially valuable for beginners due to its clean interface and free and open-source background. As an integrated development environment, Eclipse is a great place to code and profile your application. 

How To Profile A Java Application In Eclipse

TPTP Profiling Tool


There are two ways to begin profiling your application. You can access the profiling functionality by navigating from the toolbar in Product Class – find Profile As > Java Application. Alternatively, you can use Java’s perspective toolbar using the Profile action. Open your application with the profiling wizard to begin.

Setting Your FIlters

With profiling, it is  vital you identify key parameters to analyze your code. You can create a purpose-built set of filters in Eclipse to suit your application. Access these settings under the Monitor tab within the wizard. You can apply these parameters to future profiles automatically, lettingyou to skip this step next time you profile.

You can set profiling execution options, such as  depth of boundary class. Selecting depth enables you to choose how many layers of methods to analyze within your program.  For example, you can choose a depth of three to prevent the profiler from including any invocations of methods below M3, sticking with M1>M2>M3.

Running The Application

You can run the application by hitting OK in the profiling Wizard. A prompt will appear, asking you to shift to the Profiling and Logging perspective.  Select“yes”forl the analysis of the profiling function. With the TPTP profiling tool, you can pause the profiling at any time, run a garbage collection on the profiled application and terminate the application.

Identifying Performance Issues

Once run the applications, execution statistics will identify performance hotspots within your application. Navigate from the Profiling Monitor through  Open with > Execution Statistics to find the pop-up tool. Scripts are listed by the running time as a percentage of the overall running time.  This depicts where your script is lagging. Identifying these time-consuming scripts let you analyze what should be running faster.

Performance Solutions

Profiling an application reveals the shortcomings in your script.  To make full use of this function, you need to discover the performance solutions to optimize your script. Unfortunately, Eclipse’s TPTP can only identify the problems.  Using Stackify’s code profiler, Prefix, can help -profile the performance of your application.  Prefix’s profiling and tracing help even the most experienced developers find slow SQL queries, hidden exceptions, and more. Prefix puts the power of APM in the hands of developers. By validating the performance of code as it is written, Prefix users push better code to testing, receive fewer support tickets from production, and have happier dev managers.

Improve Your Code with Retrace APM

Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.

Learn More

Want to contribute to the Stackify blog?

If you would like to be a guest contributor to the Stackify blog please reach out to