0N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
0N/A <
meta content="deepa viswanathan" name="Author">
0N/A <
title>HPROF Agent</
title>
0N/A <
meta name="author" content="Kelly O'Hair">
0N/A<
body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" 0N/A<
h1 style="text-align: center;"><
a name="mozTocId137594" 0N/A class="mozTocH1"></
a><
span style="font-weight: bold;"></
span>HPROF
0N/A<
h2><
a name="mozTocId558923" class="mozTocH2"></
a>Contents</
h2>
0N/A<
span style="text-decoration: underline;"></
span>
0N/A<!--mozToc h1 1 h2 2 h3 3 h4 4 h5 5 h6 6--><
li><
a href="#mozTocId137594">HPROF
0N/A <
li><
a href="#mozTocId558923">Contents</
a></
li>
0N/A <
li><
a href="#mozTocId550204">Overview</
a></
li>
0N/A <
li><
a href="#mozTocId634758">Start-up</
a></
li>
0N/A <
li><
a href="#mozTocId708821">Heap Allocation
0N/AProfiles (heap=sites) </
a></
li>
0N/A <
li><
a href="#mozTocId634725">Heap Dump (heap=dump)</
a></
li>
0N/A <
li><
a href="#mozTocId546448">CPU Usage Sampling
0N/AProfiles (cpu=samples) </
a></
li>
0N/A <
li><
a href="#mozTocId116568">CPU Usage Times Profile (cpu=times)
0N/A <
li><
a href="#mozTocId848088">Binary Dump Format
0N/A <
li><
a href="#mozTocId348369">Socket Connection and
0N/ACommunication</
a></
li>
0N/A <
li><
a href="#mozTocId348360">Handling of Arrays</
a></
li>
0N/A <
li><
a href="#mozTocId589424">Source Code </
a></
li>
0N/A<
span style="text-decoration: underline;"></
span>
0N/A<
h2><
a name="mozTocId550204" class="mozTocH2"></
a>Overview</
h2>
0N/A<
p>This document describes the JVM TI Agent HPROF delivered in
0N/Athe Java Development Kit (JDK). It is intended as demonstration code
0N/Afor JVM TI, and as a functional
0N/Areplacement for the older HPROF JVMPI Agent delivered in past releases.<
br>
0N/APrevious 1.4 and earlier releases of the JDK contained an HPROF
0N/Aagent built on the experimental JVMPI.
0N/AThe newer JVM TI replaces both JVMDI and JVMPI.
0N/A<
p><
span style="font-weight: bold;">Note</
span>: Differences between
0N/Athis HPROF implementation and the older JVMPI based HPROF are marked in
0N/A<
span style="font-style: italic; color: rgb(255, 0, 0);">RED ITALICS</
span>
0N/Athroughout this document.<
br>
0N/A<
h2><
a name="mozTocId634758" class="mozTocH3"></
a>Start-up</
h2>
0N/A<
p>HPROF is a simple profiler agent shipped with the JDK. It is
0N/Alibrary that interacts with the JVM TI and
0N/Ainformation either to a file or to a socket in ascii or binary format.
0N/Abe further processed by a profiler front-end tool.</
p>
0N/A<
p>It is capable of presenting CPU usage, heap allocation statistics
0N/Aand monitor contention
0N/Aprofiles. In addition it can also report complete heap dumps and states
0N/Aof all the monitors and threads in the Java virtual machine.
0N/A<
p>HPROF can be invoked by:
0N/A<
pre>java -<
span style="font-weight: bold;">agentlib:</
span><
b>hprof</
b> ToBeProfiledClass</
pre>
0N/ADepending on the type of profiling requested, HPROF instructs the
0N/Avirtual machine to send it the relevant JVM TI events and processes
0N/Athe event data into profiling information. For example, the following
0N/Acommand obtains the heap allocation profile:
0N/A<
pre>java -agentlib:hprof=heap=sites ToBeProfiledClass</
pre>
0N/AFollowing is the complete list of options that can passed to hprof :
0N/A <
pre>java -agentlib:hprof=help<
br><
br> HPROF: Heap and CPU Profiling Agent (JVMTI Demonstration Code)<
br><
br>hprof usage: java -agentlib:hprof=[help]|[<option>=<value>, ...]<
br><
br>Option Name and Value Description Default<
br>--------------------- ----------- -------<
br>heap=dump|sites|all heap profiling all<
br>cpu=samples|times|old CPU usage off<
br>monitor=y|n monitor contention n<
br>format=a|b text(txt) or binary output a<
br>file=<file> write data to file
java.hprof[{.txt}]<
br>net=<host>:<port> send data over a socket off<
br>depth=<size> stack trace depth 4<
br>interval=<ms> sample interval in ms 10<
br>cutoff=<value> output cutoff point 0.0001<
br>lineno=y|n line number in traces? y<
br>thread=y|n thread in traces? n<
br>doe=y|n dump on exit? y<
br>msa=y|n Solaris micro state accounting n<
br>force=y|n force output to <file> y<
br>verbose=y|n print messages about dumps y<
br><
br>Obsolete Options<
br>----------------<
br>gc_okay=y|n<
br><
br>Examples<
br>--------<
br> - Get sample cpu information every 20 millisec, with a stack depth of 3:<
br> java -agentlib:hprof=cpu=samples,interval=20,depth=3 classname<
br> - Get heap usage information based on the allocation sites:<
br> java -agentlib:hprof=heap=sites classname<
br><
br>Notes<
br>-----<
br> - The option format=b cannot be used with monitor=y.<
br> - The option format=b cannot be used with cpu=old|times.<
br> - Use of the -Xrunhprof interface can still be used,
e.g.<
br> java -Xrunhprof:[help]|[<option>=<value>, ...]<
br> will behave exactly the same as:<
br> java -agentlib:hprof=[help]|[<option>=<value>, ...]<
br><
br>Warnings<
br>--------<
br> - This is demonstration code for the JVMTI interface and use of BCI,<
br> it is not an official product or formal part of the JDK.<
br> - The -Xrunhprof interface will be removed in a future release.<
br> - The option format=b is considered experimental, this format may change<
br> in a future release.<
br></
pre>
0N/A<
p>By default, heap profiling information (sites and dump) is written
0N/AThe monitor=y|n option has proven to be problematic and may be replaced
0N/Awith something more useful.<
br>
0N/A<
p>The output in most cases will contain ID's for traces, threads,
0N/Aobjects, etc. Each type of ID will typically start with a
0N/Adifferent number than the other ID's,
e.g. traces might start with
0N/A<
p><
span style="font-weight: bold;">Note</
span>: <
span 0N/A style="font-style: italic; color: rgb(255, 0, 0);">The gc_okay option
0N/Ais no longer supported.</
span><
br>
0N/A<
h2><
a name="mozTocId708821" class="mozTocH4"></
a>Heap Allocation
0N/AProfiles (heap=sites)<
br>
0N/AFollowing is the heap allocation profile generated by running the Java
0N/A(<
code>javac</
code>) on a set of input files. Only parts of the
0N/Aprofiler output are shown here.
0N/A<
pre>Command used: javac -J-agentlib:hprof=heap=sites
Hello.java<
br><
br>SITES BEGIN (ordered by live bytes) Fri Feb 6 13:13:42 2004<
br> percent live alloc'ed stack class<
br> rank self accum bytes objs bytes objs trace name<
br> 1 44.13% 44.13% 1117360 13967 1117360 13967 301926
java.
util.
zip.
ZipEntry<
br> 2 8.83% 52.95% 223472 13967 223472 13967 301927
com.
sun.
tools.
javac.
util.
List<
br> 3 5.18% 58.13% 131088 1 131088 1 300996 byte[]<
br> 4 5.18% 63.31% 131088 1 131088 1 300995
com.
sun.
tools.
javac.
util.
Name[]<
br> <
br></
pre>
0N/AA crucial piece of information in heap profile is the amount of
0N/Aallocation that occurs
0N/Ain various parts of the program. The <
code>SITES</
code> record above
0N/Atells us that 44.13% of the total space was allocated for
0N/Aof the total allocation that has occurred at a given site; the rest has
0N/Abeen garbage collected.
0N/A<
p>A good way to relate allocation sites to the source code is to
0N/Athe dynamic stack traces that led to the heap allocation. Following is
0N/Aanother part of the profiler output that illustrates the stack traces
0N/Areferred to by the four allocation sites in output shown above.
0N/A<
span style="font-family: monospace;"><
br>
0N/A<
blockquote></
blockquote>
0N/AEach frame in the stack trace contains class name, method name, source
0N/Afile name, and the line number. The user can set the maximum number
0N/Aof frames collected by the HPROF agent. The default limit is 4. Stack
0N/Atraces reveal not only which methods performed heap allocation, but
0N/Aalso which methods were ultimately responsible for making calls that
0N/Aresulted in memory allocation. <
br>
0N/A<
h2><
a name="mozTocId634725" class="mozTocH2"></
a>Heap Dump (heap=dump)</
h2>
0N/AA complete dump of the current live objects in the heap can be obtained
0N/A<
pre>Command used: javac -J-agentlib:hprof=heap=dump
Hello.java<
br></
pre>
0N/AThis is a very large output file, but can be viewed and searched in any
0N/A<
h2><
a name="mozTocId546448" class="mozTocH4"></
a>CPU Usage Sampling
0N/AProfiles (cpu=samples)<
br>
0N/AHPROF can collect CPU usage information by sampling threads. Following
0N/Ais part of the output collected from a run
0N/Aof the <
code>javac</
code> compiler.
0N/AThe HPROF agent periodically samples the stack of all running threads
0N/Ato record the most frequently active stack traces. The <
code>count</
code>
0N/Afield above indicates how many times a particular stack trace was found
0N/Ato be active. These stack traces correspond to the CPU usage hot spots
0N/Ain the application.<
br>
0N/A<
h2><
a name="mozTocId116568" class="mozTocH2"></
a>CPU Usage Times
0N/AProfile (cpu=times)<
br>
0N/AHPROF can collect CPU usage information by injecting code into every
0N/Amethod entry and exit, keeping track of exact method call counts and
0N/Athe time spent in each method. This uses Byte Code Injection (BCI) and
0N/Aruns considerably slower than cpu=samples. Following is part of the
0N/Aoutput collected from a run
0N/Aof the <
code>javac</
code> compiler.
0N/AHere the count represents the true count of the times this method was
0N/Aentered, and the percentages represent a measure of thread CPU time
0N/Aspent in those methods.<
br>
0N/A<
h2><
a class="mozTocH3" name="mozTocId848088"></
a>Binary Dump Format
0N/AThe basic fields in the binary output are u1 (1 byte), u2 (2 byte), u4
0N/A(4 byte), and u8 (8 byte). An ID in this implementation is a u4,
0N/Ahowever the size of an ID is really determined by the "size of
0N/Aidentifiers" field in the header.<
br>
0N/A<
span style="font-weight: bold;">WARNING</
span>: This format is still
0N/Aconsidered highly experimental, however, all attempts were made to
0N/Amatch the format of past HPROF implementations.<
br>
0N/AThe binary output begins with the information:<
br>
0N/A<
table style="text-align: left; width: 100%; height: 124px;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">[u1]*<
br>
0N/A <
td style="vertical-align: top;">An initial NULL terminated
0N/Aseries of bytes representing the format name and version, in this
0N/Aimplementation and historically, the string "JAVA PROFILE 1.0.1" (18
0N/Au1 bytes) followed by a NULL byte. If the TAG "HEAP DUMP SEGMENT" is
0N/Aused this string will be "JAVA PROFILE 1.0.2". </
td>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">size of identifiers. Identifiers
0N/Aare used to represent UTF8 strings, objects, stack traces, etc. They
0N/Acan have the same size as host pointers or sizeof(void*), but are not
0N/Arequired to be.<
span style="color: rgb(0, 0, 0);"></
span></
td>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">high word of number of
0N/Amilliseconds since 0:00 GMT,
1/
1/
70</
td>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">low word of number of
0N/Amilliseconds since 0:00 GMT,
1/
1/
70</
td>
0N/AFollowed by a se<
span style="font-family: monospace;"></
span>quence of
0N/Arecords that look like:<
br>
0N/A<
table style="text-align: left; width: 100%;" border="1" cellpadding="2" 0N/A <
td style="vertical-align: top;">u1<
br>
0N/A <
td style="vertical-align: top;">TAG: denoting the type of the
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">TIME: number of microseconds
0N/Atime stamp in the header<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">LENGTH: number of bytes that
0N/Au4 field and belong to this record<
br>
0N/A <
td style="vertical-align: top;">[u1]*<
br>
0N/A <
td style="vertical-align: top;">BODY: as many bytes as specified
0N/Athe above u4 field<
br>
0N/AThe following TAGs are supported:<
br>
0N/A<
table style="text-align: left; width: 100%;" border="1" cellpadding="2" 0N/A <
td style="vertical-align: top;">STRING IN UTF8<
br>
0N/A <
td style="vertical-align: top;">0x01<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">ID for this string<
br>
0N/A <
td style="vertical-align: top;">[u1]*<
br>
0N/A <
td style="vertical-align: top;">UTF8 characters for string
0N/A(NOT NULL terminated)<
br>
0N/A <
td style="vertical-align: top;">LOAD CLASS<
br>
0N/A <
td style="vertical-align: top;">0x02<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">class serial number
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">class object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial number<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">class name string ID<
br>
0N/A <
td style="vertical-align: top;">UNLOAD CLASS<
br>
0N/A <
td style="vertical-align: top;">0x03<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">class serial number<
br>
0N/A <
td style="vertical-align: top;">STACK FRAME<
br>
0N/A <
td style="vertical-align: top;">0x04<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">stack frame ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">method name string ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">method signature string ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">source file name string ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">class serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">> 0<
br>
0N/A <
td style="vertical-align: top;">line number<
br>
0N/A <
td style="vertical-align: top;">0<
br>
0N/A <
td style="vertical-align: top;">no line information
0N/A <
td style="vertical-align: top;">-1<
br>
0N/A <
td style="vertical-align: top;">unknown location<
br>
0N/A <
td style="vertical-align: top;">-2<
br>
0N/A <
td style="vertical-align: top;">compiled method (<
span 0N/A style="font-style: italic; color: rgb(255, 0, 0);">Not implemented</
span>)<
br>
0N/A <
td style="vertical-align: top;">-3<
br>
0N/A <
td style="vertical-align: top;">native method (<
span 0N/A style="color: rgb(255, 0, 0); font-style: italic;">Not implemented</
span>)<
br>
0N/A <
td style="vertical-align: top;">STACK TRACE<
br>
0N/A <
td style="vertical-align: top;">0x05<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of frames<
br>
0N/A <
td style="vertical-align: top;">[ID]*<
br>
0N/A <
td style="vertical-align: top;">series of stack frame ID's<
br>
0N/A <
td style="vertical-align: top;">ALLOC SITES<
br>
0N/A <
td style="vertical-align: top;">0x06<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">Bit mask flags:<
br>
0N/A <
table style="text-align: left; width: 441px; height: 74px;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">0x1<
br>
0N/A <
td style="vertical-align: top;">incremental vs.
0N/A <
td style="vertical-align: top;">0x2<
br>
0N/A <
td style="vertical-align: top; text-align: left;">sorted
0N/Aby allocation vs. line<
br>
0N/A <
td style="vertical-align: top;">0x4<
br>
0N/A <
td style="vertical-align: top;">whether to force GC
0N/A(<
span style="font-style: italic; color: rgb(255, 0, 0);">Not
0N/AImplemented</
span>)<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">cutoff ratio (floating
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">total live bytes<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">total live instances<
br>
0N/A <
td style="vertical-align: top;">u8<
br>
0N/A <
td style="vertical-align: top;">total bytes allocated<
br>
0N/A <
td style="vertical-align: top;">u8<
br>
0N/A <
td style="vertical-align: top;">total instances allocated<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of sites that
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u1<
br>
0N/A <
td style="vertical-align: top;">array indicator: 0
0N/Ameans not an array, non-zero means an array of this type (See <
a 0N/A href="#Basic_Type">Basic Type</
a>)<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">class serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of live bytes<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of live
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of bytes
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of instances
0N/A <
td style="vertical-align: top;">HEAP SUMMARY<
br>
0N/A <
td style="vertical-align: top;">0x07<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">total live bytes<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">total live instances<
br>
0N/A <
td style="vertical-align: top;">u8<
br>
0N/A <
td style="vertical-align: top;">total bytes allocated<
br>
0N/A <
td style="vertical-align: top;">u8<
br>
0N/A <
td style="vertical-align: top;">total instances allocated<
br>
0N/A <
td style="vertical-align: top;">START THREAD<
br>
0N/A <
td style="vertical-align: top;">0x0A<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">thread object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial number<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">thread name string ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">thread group name ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">thread parent group name ID<
br>
0N/A <
td style="vertical-align: top;">END THREAD<
br>
0N/A <
td style="vertical-align: top;">0x0B<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">HEAP DUMP<
br>
0N/A <
span style="font-style: italic;">or</
span><
br>
0N/AHEAP DUMP SEGMENT<
br>
0N/A <
td style="vertical-align: top;">0x0C<
br>
0N/A <
span style="font-style: italic;">or</
span><
br>
0N/A <
td style="vertical-align: top;">Contains any number of sub-tags,
0N/Aeach begins a u1 field (no order implied here):<
br>
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ROOT UNKNOWN<
br>
0N/A <
td style="vertical-align: top;">0xFF<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">ROOT JNI GLOBAL<
br>
0N/A <
td style="vertical-align: top;">0x01<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">JNI global ref ID<
br>
0N/A <
td style="vertical-align: top;">ROOT JNI LOCAL<
br>
0N/A <
td style="vertical-align: top;">0x02<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">frame number in
0N/Astack trace (-1 for empty)<
br>
0N/A <
td style="vertical-align: top;">ROOT JAVA FRAME<
br>
0N/A <
td style="vertical-align: top;">0x03<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">frame number in
0N/Astack trace (-1 for empty)</
td>
0N/A <
td style="vertical-align: top;">ROOT NATIVE STACK<
br>
0N/A <
td style="vertical-align: top;">0x04<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">ROOT STICKY CLASS<
br>
0N/A <
td style="vertical-align: top;">0x05<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">ROOT THREAD BLOCK<
br>
0N/A <
td style="vertical-align: top;">0x06<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">ROOT MONITOR USED<
br>
0N/A <
td style="vertical-align: top;">0x07<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">ROOT THREAD OBJECT<
br>
0N/A <
td style="vertical-align: top;">0x08<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">thread object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">thread serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial
0N/A <
td style="vertical-align: top;">CLASS DUMP<
br>
0N/A <
td style="vertical-align: top;">0x20<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">class object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">super class object ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">class loader object
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">signers object ID<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">protection domain
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">reserved<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">reserved<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">instance size (in
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">size of constant
0N/Apool and number of records that follow:<
br>
0N/A <
table style="text-align: left; width: 100%;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">constant pool
0N/A <
td style="vertical-align: top;">u1<
br>
0N/A <
td style="vertical-align: top;">type of entry:
0N/A(See <
a href="#Basic_Type">Basic Type</
a>)<
br>
0N/A <
td style="vertical-align: top;">value<
br>
0N/A <
td style="vertical-align: top;">value of entry
0N/A(u1, u2, u4, or u8 based on type of entry)<
span 0N/A style="font-style: italic; color: rgb(255, 0, 0);"></
span><
br>
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">Number of static
0N/A <
table style="text-align: left; width: 100%;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">static field
0N/A <
td style="vertical-align: top;">u1<
br>
0N/A <
td style="vertical-align: top;">type of field:
0N/A(See <
a href="#Basic_Type">Basic Type</
a>)<
br>
0N/A <
td style="vertical-align: top;">value<
br>
0N/A <
td style="vertical-align: top;">value of entry
0N/A(u1, u2, u4, or u8 based on type of field) <
span 0N/A style="font-style: italic; color: rgb(255, 0, 0);"></
span><
br>
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">Number of instance
0N/Afields (not including super class's)<
br>
0N/A <
table style="text-align: left; width: 100%;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">field name
0N/A <
td style="vertical-align: top;">u1<
br>
0N/A <
td style="vertical-align: top;">type of field:
0N/A(See <
a href="#Basic_Type">Basic Type</
a>)<
br>
0N/A <
td style="vertical-align: top;">INSTANCE DUMP<
br>
0N/A <
td style="vertical-align: top;">0x21<
br>
0N/A <
td style="vertical-align: top;"><
br>
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">class object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of bytes that
0N/A <
td style="vertical-align: top;">[value]*<
br>
0N/A <
td style="vertical-align: top;">instance field
0N/Avalues (this class, followed by super class, etc)<
span 0N/A style="font-style: italic; color: rgb(255, 0, 0);"></
span><
br>
0N/A <
td style="vertical-align: top;">OBJECT ARRAY DUMP<
br>
0N/A <
td style="vertical-align: top;">0x22<
br>
0N/A <
td style="vertical-align: top;"><
br>
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">array object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of elements<
br>
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">array class object
0N/A <
td style="vertical-align: top;">[ID]*<
br>
0N/A <
td style="vertical-align: top;">elements<
br>
0N/A <
td style="vertical-align: top;">PRIMITIVE ARRAY DUMP<
br>
0N/A <
td style="vertical-align: top;">0x23<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">array object ID<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of elements<
br>
0N/A <
td style="vertical-align: top;">u1<
br>
0N/A <
td style="vertical-align: top;">element type (See <
a 0N/A href="#Basic_Type">Basic Type</
a>)<
br>
0N/A <
td style="vertical-align: top;">[u1]*<
br>
0N/A <
td style="vertical-align: top;">elements (packed
0N/A <
td style="vertical-align: top;">HEAP DUMP END<
br>
0N/A <
td style="vertical-align: top;">0x2C<
br>
0N/A <
td style="vertical-align: top;">Terminates a series of HEAP DUMP
0N/ASEGMENTS. Concatenation of HEAP DUMP SEGMENTS equals a HEAP DUMP.<
br>
0N/A <
td style="vertical-align: top;">CPU SAMPLES<
br>
0N/A <
td style="vertical-align: top;">0x0D<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">total number of samples<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of traces that
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of samples<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">stack trace serial
0N/A <
td style="vertical-align: top;">CONTROL SETTINGS<
br>
0N/A <
td style="vertical-align: top;">0x0E<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">Bit mask flags:<
br>
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">0x1<
br>
0N/A <
td style="vertical-align: top;">alloc traces
on/
off<
br>
0N/A <
td style="vertical-align: top;">0x2<
br>
0N/A <
td style="vertical-align: top;">cpu sampling
on/
off<
br>
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">stack trace depth<
br>
0N/A<
span style="font-weight: bold;"><
br>
0N/A</
span><
a name="Basic_Type"></
a>Basic Type
0N/A<
table style="text-align: left; width: 296px; height: 221px;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">2<
br>
0N/A <
td style="vertical-align: top;">object<
br>
0N/A <
td style="vertical-align: top;">4<
br>
0N/A <
td style="vertical-align: top;">boolean<
br>
0N/A <
td style="vertical-align: top;">5<
br>
0N/A <
td style="vertical-align: top;">char<
br>
0N/A <
td style="vertical-align: top;">6<
br>
0N/A <
td style="vertical-align: top;">float<
br>
0N/A <
td style="vertical-align: top;">7<
br>
0N/A <
td style="vertical-align: top;">double<
br>
0N/A <
td style="vertical-align: top;">8<
br>
0N/A <
td style="vertical-align: top;">byte<
br>
0N/A <
td style="vertical-align: top;">9<
br>
0N/A <
td style="vertical-align: top;">short<
br>
0N/A <
td style="vertical-align: top;">10<
br>
0N/A <
td style="vertical-align: top;">int<
br>
0N/A <
td style="vertical-align: top;">11<
br>
0N/A <
td style="vertical-align: top;">long<
br>
0N/A<
h3><
a name="mozTocId348360" class="mozTocH3"></
a>Handling of Arrays</
h3>
0N/AThere will be a "LOAD CLASS" tag for type type of each array
0N/Ain the dump. In the LOAD CLASS record, the class name string ID
0N/Awill refer to a string with a human-readable name of the array
0N/Atype that is formatted as the type name would be in Java source
0N/Acode. Thus, the LOAD CLASS record for the type char[] will
0N/Abe "char[]", for short[][][] will be "short[][][]" and for
0N/AMyType[] will be "MyType[]".
0N/A<
h3><
a name="mozTocId348369" class="mozTocH3"></
a>Socket Connection and
0N/A<
span style="font-weight: bold;">WARNING</
span>: This command format is
0N/Aconsidered highly experimental, however, all attempts were made to
0N/Amatch the format of past HPROF implementations.<
br>
0N/ACommands can be sent to HPROF via the socket connection, the accepted
0N/ACOMMAND TAGS are:<
br>
0N/A<
table style="text-align: left; width: 100%;" border="1" cellpadding="2" 0N/A <
td style="vertical-align: top;">FORCE GC (<
span 0N/A style="font-style: italic; color: rgb(255, 0, 0);">Not implemented</
span>)<
br>
0N/A <
td style="vertical-align: top;">0x01<
br>
0N/A <
td style="vertical-align: top;">DUMP HEAP<
br>
0N/A <
td style="vertical-align: top;">0x02<
br>
0N/A <
td style="vertical-align: top;">ALLOC SITES<
br>
0N/A <
td style="vertical-align: top;">0x03<
br>
0N/A <
td style="vertical-align: top;">HEAP SUMMARY<
br>
0N/A <
td style="vertical-align: top;">0x04<
br>
0N/A <
td style="vertical-align: top;">EXIT THE VM<
br>
0N/A <
td style="vertical-align: top;">0x05<
br>
0N/A <
td style="vertical-align: top;">DUMP TRACES<
br>
0N/A <
td style="vertical-align: top;">0x06<
br>
0N/A <
td style="vertical-align: top;">CPU SAMPLES<
br>
0N/A <
td style="vertical-align: top;">0x07<
br>
0N/A <
td style="vertical-align: top;">CONTROL<
br>
0N/A <
td style="vertical-align: top;">0x08<
br>
0N/A <
td style="vertical-align: top;">EOF (used to terminate socket
0N/A <
td style="vertical-align: top;">0xFF<
br>
0N/AThe commands take the form:<
br>
0N/A<
table style="text-align: left; width: 100%;" border="1" cellpadding="2" 0N/A <
td style="vertical-align: top;">u1<
br>
0N/A <
td style="vertical-align: top;">COMMAND TAG<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">serial number<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">number of bytes that follow<
br>
0N/A <
td style="vertical-align: top;">[u1]*<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ALLOC SITES<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">Flags:<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">cutoff ratio
0N/A(floating point between 0.0 and 1.0)<
br>
0N/A <
td style="vertical-align: top;">CPU SAMPLES<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">ignored<
br>
0N/A <
td style="vertical-align: top;">u4<
br>
0N/A <
td style="vertical-align: top;">cutoff ratio
0N/A(floating point between 0.0 and 1.0)<
br>
0N/A <
td style="vertical-align: top;">CONTROL<
br>
0N/A <
td style="vertical-align: top;">
0N/A <
table style="text-align: left; width: 100%;" border="1" 0N/A cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">Sub option:<
br>
0N/A <
table style="text-align: left; width: 100%;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">0x1<
br>
0N/A <
td style="vertical-align: top;">Turn alloc
0N/A <
td style="vertical-align: top;">0x2<
br>
0N/A <
td style="vertical-align: top;">Turn alloc
0N/A <
td style="vertical-align: top;">0x3<
br>
0N/A <
td style="vertical-align: top;">Turn CPU
0N/A <
table style="text-align: left; width: 100%;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">thread
0N/Aobject ID (0 for all threads)<
br>
0N/A <
td style="vertical-align: top;">0x4<
br>
0N/A <
td style="vertical-align: top;">Turn CPU
0N/A <
table style="text-align: left; width: 100%;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">ID<
br>
0N/A <
td style="vertical-align: top;">thread
0N/Aobject ID (0 for all threads)</
td>
0N/A <
td style="vertical-align: top;">0x5<
br>
0N/A <
td style="vertical-align: top;">Clear CPU
0N/A <
td style="vertical-align: top;">0x6<
br>
0N/A <
td style="vertical-align: top;">Set max stack
0N/A <
table style="text-align: left; width: 100%;" 0N/A border="1" cellpadding="2" cellspacing="2">
0N/A <
td style="vertical-align: top;">u2<
br>
0N/A <
td style="vertical-align: top;">New max
0N/A<
h2><
a name="mozTocId589424" class="mozTocH4"></
a>Source Code<
br>
0N/AThe source to HPROF is available in the JDK download in the
0N/A<
p><
font size="-1"><
b>*As used on this web site, the terms "Java
0N/AVirtual Machine" or "JVM" mean a virtual machine for the Java platform.</
b></
font>
0N/A<
hr>
<!-- hhmts start --> 0N/ALast modified: 2005
<!-- hhmts end -->