vmlens provides shortcuts for junit tests and java applications. How to use those shortcuts is explained in section one. For all other jvm applications like scala or testng tests and applications outside of eclipse you need to add the jvm agent string to the jvm arguments as explained in section 2. And section 3 explains how to use vmlens for applications running on a different machine than your eclipse installation.
To use the vmlens shortcut click on a class with a main method or junit test and select Run As -> Java Application or Junit Test traced with vmlens. The example belows shows this for a junit test class.
Open the vmlens start view from Window -> Show View -> Other... -> vmlens -> Start vmlens.
Copy the vmlens agent string and add it the vm arguments of your application.
Save the agent files to a folder from the Start vmlens view in eclipse as shown below:
Copy this folder to your remote machine and configure your application with an agent string pointing to the agent.jar in this folder:
-javaagent:<Path of agent.jar>/agent.jar
When you start your application the vmlens agent creates a folder vmlens
in the working directory of your application. After you stopped your application the agent stops and writes a file called finished
in the vmlens
folder. After the agent has written the file finished
you can import the folder vmlens
in eclipse:
Import the vmlens folder in the Start vmlens view in eclipse as shown below:
Now vmlens will analyze the execution trace of your application and open the vmlens perspective in eclipse showing you the results.
Please set the java heap size for eclipse in the eclipse.ini to a high enough value, for example -Xmx5g
In the default configuration, the agent writes the execution trace in a folder called vmlens
in the working directory of your application. To change this path, change the property eventDir
in the file called run.properties
in the folder wich contains the agent.jar file. In the default configuration, this property is set to ./vmlens/
eventDir=./vmlens/