LOP is a very simplistic profiler for Java that uses bytecode instrumentation via Javassist.
- Create a file
profiler.properties
in the root directory of your Java program. - In this file, add a set of lines following the scheme
<class-name>=<method-name-1>,<method-name-2>...
, for exampleorg.deidentifier.arx.example.Example=test1,test2
, telling LOP to profile the according methods of the given class. LOP will automatically handle aspects such as class hierarchies, method overloading etc for you. - Add the following parameter when launching the JVM:
-javaagent:lop-1.0.0.jar
. - For JDK 7 and newer, also add:
-XX:-UseSplitVerifier
.
This will result in output such as (see org.deidentifier.arx.example.Example
):
Total time [ms] | Invocation count | Method
----------------------------------------------------
0 | 0 | org.deidentifier.arx.example.Example.test1()
0 | 0 | org.deidentifier.arx.example.Example.test1(int)
0 | 0 | org.deidentifier.arx.example.Example.test1(int,String)
42 | 2000 | org.deidentifier.arx.example.Example.test2()
A binary version (JAR file) is available for download here.