|Home||HProf Ant Task||DashProf Ant Task||Download|
hprofprofiler 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,
hprofis a more flexible and better option than
java -prof, however there are a few instances when it is still useful:
hprofthat prevents you from getting any useful profile data, you may be able to use
For more information on
java -prof, see the prophIt -prof page.
dashprof Ant task makes it easy to profile any Java program using the standard Ant
java -prof, the first thing you should do is define a
javaAnt task in your Ant build file. Next, define the
taskdefin your build file according to the following example:
<taskdef name="dashprof" classname="net.sf.antprof.DashProf" classpath="/path/to/antprof.jar" />Next, wrap a
dashproftask around the
<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.
|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
dashproftask always sets the
javatask attribute fork="yes", because the profiler library is only loaded by the JVM when a new JVM is started