Home | HProf Ant Task | DashProf Ant Task | Download |
hprof
profiler was first introduced in JDK 1.2 (Java2), and was rather unreliable until JDK 1.3. Older JDKs supported a different profiling option, invoked as java -prof
. The newer (JDK 1.2, 1.3, 1.4) still have backwards-compatible support for java -prof
. In general, hprof
is a more flexible and better option than java -prof
, however there are a few instances when it is still useful:
hprof
that prevents you from getting any useful profile data, you may be able to use java -prof
instead.
For more information on java -prof
, see the prophIt -prof page.
The dashprof
Ant task makes it easy to profile any Java program using the standard Ant java
task.
java -prof
, the first thing you should do is define a java
Ant task in your Ant build file. Next, define the dashprof
taskdef
in your build file according to the following example:
<taskdef name="dashprof" classname="net.sf.antprof.DashProf" classpath="/path/to/antprof.jar" />Next, wrap a
dashprof
task around the java
task:
<target name="profile"> <dashprof> <java classpathref="class.path" classname="your.Application" /> </dashprof> </target>Finally, generate the profile data file by running:
ant.bat profileThis command gathers CPU profile information and dumps it to the file java.prof when the Java VM exits. You can then load this profile into prophIt, or inspect it in a text editor.
Note : No task attributes are required.
Attribute | Description | Default |
---|---|---|
hotspot | If you are using the JDK 1.1 or JDK 1.2, AntProf automatically turns off the JIT compiler (including the HotSpot interpreter). If you are having trouble with dashprof in a newer version of Java, you can manually specify hotspot="no" and AntProf will turn off HotSpot. |
Yes |
dashprof
task always sets the java
task attribute fork="yes", because the profiler library is only loaded by the JVM when a new JVM is started
Ironworks.cc |