-agent:/home/myself/ppProf/prof.jar
to your
java command line, as in
java -javaagent:/home/user/ppProf/prof.jar -classpath cp org.junit.textui.TestRunner my.test.Class
ppp_Result.txt
in the working directory. It
contains the number of calls and time spent in each method, in
milliseconds. In addition, ppp_Result_summary.txt
lists the packages containing the most frequently called methods and most time-consuming methods.nano
option to the agent parameter, as in
-javaagent:/home/user/ppProf/prof.jar
=nano. ppProf will then use System.nanoTime()
instead of System.currentTimeMillis()
to measure time. gettimeofday (2)
is called in both cases. gettimeofday
from C is about 16 x slower
with an SMP kernel, on my test hardware. I'm not kidding. This is
really really really expensive, esp. if compared e.g. to a simple
getter method. It makes profiling really really really slow./home/user/ppProf
as welllinuxSMPhack
option to ppProf, as in -javaagent:/home./user/ppProf/prof.jar
=linuxSMPhack-Djava.library.path=/home/user/ppProf
option.count
option to ppProf. In that case, only the calls per method are counted.
The overhead for this is usually minimal, and 70% in my worst-case example. You can
determine the most frequently called methods this way, exclude their
packages or classes from profiling, and turn timing on again.
foo()
, and it calls StringTokenizer.hasMoreElements()
. Since StringTokenizer
is from java.util
, the time spent in hasMoreElements()
will be attributed to foo()
. scope=-java-sun-org/apache/xerces-org/jdom
as an option to ppProf, as in -javaagent:/home./user/ppProf/prof.jar
=scope=-java-sun-org/apache/xerces-org/jdom. scope=-java
.scope=+org/apache/xerces
.scope=+org/x-org/x/y
.ClassLoader.getSystemClassLoader()
.
single
option to ppProf, you can avoid that overhead. If you use it for multi-threaded code, the results may be strange.multi
option, although it is still experimental.OutOfMemory
errors sooner or later.