Child pages
  • Tutorial

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

In this tutorial we will demonstrate how to use Aprof. Note, that this guide is actual for version 19.

Getting Started

First of all, extract aprof.jar from downloaded zip file with AProf binaries. This JAR is the file you will be using.

Note, that you should not rename the aprof.jar file, otherwise it will not work.

Running Aprof

Aprof comes with integrated help explaining all supported options and their default values. Execute the following line from the console to read it:

java -jar aprof.jar

You will see that in order to profile your Java application with Aprof you should start JVM with -javaagent:aprof.jar option. For example, to profile well-known SwingSet2 demo you need to start it this way:

java -javaagent:aprof.jar -jar SwingSet2.jar

That's it! While you are using the demo, Aprof collects its memory allocation statistics and flushes it to aprof.txt file every minute.

Examples

Aforementioned SwingSet2 demo is a complex application, hence its profiling results are not suitable for this tutorial. We will be using a series of specifically designed samples. Some of them make no sense, some are written in non-optimal way, some might even contain bugs. Most likely you will never see them in real applications. However, they help us demonstrate key features of Aprof.

Example 1

123
  • No labels