Home | HProf Ant Task | DashProf Ant Task | Download |
-Xrunhprof
. By default, hprof dumps profile data to the file java.hprof.txt; this can be changed using the file
option.
For more information on hprof, see the prophIt hprof page.
The hprof
Ant task makes it easy to profile any Java program using the standard Ant java
task.
java
Ant task in your Ant build file. Next, define the hprof
taskdef
in your build file according to the following example:
<taskdef name="hprof" classname="net.sf.antprof.HProf" classpath="/path/to/antprof.jar" />
hprof
task around the java
task:
<target name="profile"> <hprof> <java classpathref="class.path" classname="your.Application" /> </hprof> </target>
ant.bat profileThis command gathers CPU profile information and dumps it to the file java.hprof.txt when the Java VM exits.
Attribute | Description | Default |
---|---|---|
destfile | Specify an alternate output file name, according to the following example:
<hprof destfile="app.hprof.txt"> <java classpathref="class.path" classname="your.Application" /> </hprof> | java.hprof.txt (java.hprof if binary="yes" ) |
Note : No task attributes are required.
Attribute | Description | Default |
---|---|---|
cpu | java -prof
See this paper on profiling methods for a discussion of samplinig and timing methods. |
samples |
stackDepth |
Increasing the stack depth can improve the resolution of the profile, at the expense of increasing the size of the data file.
Each time the hprof CPU profile is activated (either periodically in 'samples' mode, or for each function entry and exit in 'times' mode), hprof examines the call stack of each thread. A counter is maintained for each unique call stack. When the profile data is dumped to the data file or network connection, each call stack is written along with its counter. This option specifies the depth of each call stack. |
6 |
hotspot | If you are using the JDK 1.2, AntProf automatically turns off the HotSpot interpreter. If you are having trouble with hprof in a newer version of Java, you can manually specify hotspot="no" and AntProf will turn off HotSpot. |
Yes |
netAddress | Instructs hprof to send the profile data file out to a socket connection. Specified as <host>:<port>.
|
|
dumpThread | Include the thread ID in the stack traces. If this option is not enabled, all matching stack traces are grouped together regardless of which thread they come from. | No |
binary | Instruct hprof to use its binary format for the data file. This binary format is not documented so this option is not very useful. | No |
hprof
task always sets the java
task attribute fork="yes", because the hprof library is only loaded by the JVM when a new JVM is startedhprof
usage information by invoking:
java -Xrunhprof:help
-Xrun<name>
JVM option loads the library <name>.dll or <libname>.so and initializes it to use the JVMPI and JVMDI VM extension APIs. -Xrunhprof
uses this feature to load hprof.dll or libhprof.so.
Ironworks.cc |