blob: 32b085eff18ef85b01975e30ced6086e7f3fc165 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (16) -->
<title>com.ibm.jvm.trace.format.api (OpenJ9 JDK 16)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: module: openj9.traceformat, package: com.ibm.jvm.trace.format.api">
<meta name="generator" content="javadoc/PackageWriterImpl">
<meta name="keywords" content="com.ibm.jvm.trace.format.api package">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="package-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar.top">
<div class="skip-nav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<div class="about-language"><div style="margin-top: 9px;"><strong>OpenJ9 JDK 16</strong></div></div>
<ul id="navbar.top.firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../../../index.html">Overview</a></li>
<li><a href="../../../../../../module-summary.html">Module</a></li>
<li class="nav-bar-cell1-rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div class="nav-list-search"><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip.navbar.top">
<!-- -->
</span></nav>
</header>
<div class="flex-content">
<main role="main">
<div class="header">
<div class="sub-title"><span class="module-label-in-package">Module</span>&nbsp;<a href="../../../../../../module-summary.html">openj9.traceformat</a></div>
<h1 title="Package" class="title">Package&nbsp;com.ibm.jvm.trace.format.api</h1>
</div>
<hr>
<div class="package-signature">package <span class="element-name">com.ibm.jvm.trace.format.api</span></div>
<section class="package-description" id="package.description">
<div class="block">This API is used to process trace buffers generated by OpenJ9. These buffers are analogous to the
UtTraceRecord's used in the native VM and are referred to as 'records' in the source to differentiate them from
the UtTraceBuffer native type which wrap the UtTraceRecord type. However, in messages from the API they are
called buffers to keep the naming consistent across the information output of the formatter and the -Xtrace
options.
A single buffer contains trace data for a single thread with one exception:
"0x0 Exception trace pseudo-thread"
This "thread" contains data from any threads that have written into the exception buffer interleaved in
chronological order. There is no mapping from a trace point to its source thread for trace points in the
exception buffer.
An instance of a JVM corresponds to an instance of a TraceContext object within the API. It is
possible to have multiple TraceContext instances, each the accessor for trace data from a single JVM.
The primary inputs for the API are metadata from a JVM and trace buffers.
A TraceContext is constructed using metadata from the JVM that's generating the trace records needing
formatting. This metadata is either present as a file header at the start of a trace file or can
be acquired via a call to the JVMTI extension com.ibm.GetTraceMetadata.
Also required is a data file describing the format of trace points for that level of the JVM. At
least one data file is required to construct a trace context but additional files can be added later
and they will be searched for a trace point specification in the order they are added.
Trace buffers must be passed to the context corresponding to the JVM that produced them; they are not
valid in another context and must be added in-order within a single thread. Detecting that a buffer
has been added to the wrong context is not always possible so don't depend on an error being produced
to deduce the correct context. Trace buffers from the same thread must be added in chronological order.
Trace points are organised by thread, and iterators are provided that allow access:
a. chronologically across all threads (global)
b. chronologically within a single thread (thread)
The global iterator uses the thread iterators meaning that once a trace point has
been returned via either type of iterator it will not be returned again via the other type.
The iterators may return null (without becoming invalid) when there are no more trace points available
but return data after a new trace buffer has been added. iterator.hasNext() indicates whether a call to
iterator.next() will return null and says nothing about whether more trace points can be expected for a given
context or thread.
Trace points are kept sorted across threads when using the global iterator, however this optimisation invariant
is broken by use of a thread iterator. Consequently there is a performance hit when the global iterator is
next used, as the threads must be resorted. This can be significant with large numbers of threads.
Example fragment parsing a single buffer via the API:
// metadata - byte[] either from the header in a trace file or via jvmti
// formatData - File containing the trace point specifications
TraceContext context = TraceContext.getContext(metadata, formatData, System.out, System.err, System.err, null);
TraceThread thread = context.addData(buffer);
Iterator global = context.getTracepoints();
while (global.hasNext()) {
try {
TracePoint tracepoint = global.next();
} catch (MissingDataException e) {
System.out.println("Discarded "+(e.getMissingBytes() / context.getRecordSize())+"bytes of trace data for thread "+thread.toString());
continue;
}
System.out.println(tracepoint.toString());
}</div>
</section>
<section class="summary">
<ul class="summary-list">
<li>
<div class="caption"><span>Interface Summary</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Interface</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><a href="TracePoint.html" title="interface in com.ibm.jvm.trace.format.api">TracePoint</a></div>
<div class="col-last even-row-color">
<div class="block">Class to represent a tracepoint produced by IBM JVM's trace engine.</div>
</div>
</div>
</li>
<li>
<div class="caption"><span>Class Summary</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><a href="ActiveSection.html" title="class in com.ibm.jvm.trace.format.api">ActiveSection</a></div>
<div class="col-last even-row-color">
<div class="block">Active section of a file header.</div>
</div>
<div class="col-first odd-row-color"><a href="ByteStream.html" title="class in com.ibm.jvm.trace.format.api">ByteStream</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><a href="Component.html" title="class in com.ibm.jvm.trace.format.api">Component</a></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><a href="DataHeader.html" title="class in com.ibm.jvm.trace.format.api">DataHeader</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><a href="Message.html" title="class in com.ibm.jvm.trace.format.api">Message</a></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><a href="MessageFile.html" title="class in com.ibm.jvm.trace.format.api">MessageFile</a></div>
<div class="col-last odd-row-color">
<div class="block">Acts as a template for mapping trace ids to messages.</div>
</div>
<div class="col-first even-row-color"><a href="ProcessorSection.html" title="class in com.ibm.jvm.trace.format.api">ProcessorSection</a></div>
<div class="col-last even-row-color">
<div class="block">Processor section of a file header</div>
</div>
<div class="col-first odd-row-color"><a href="ServiceSection.html" title="class in com.ibm.jvm.trace.format.api">ServiceSection</a></div>
<div class="col-last odd-row-color">
<div class="block">Service section of a file header.</div>
</div>
<div class="col-first even-row-color"><a href="StartupSection.html" title="class in com.ibm.jvm.trace.format.api">StartupSection</a></div>
<div class="col-last even-row-color">
<div class="block">Startup section of a file header.</div>
</div>
<div class="col-first odd-row-color"><a href="TraceContext.html" title="class in com.ibm.jvm.trace.format.api">TraceContext</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><a href="TraceFileHeader.html" title="class in com.ibm.jvm.trace.format.api">TraceFileHeader</a></div>
<div class="col-last even-row-color">
<div class="block">Encapsulates the header for a trace file.</div>
</div>
<div class="col-first odd-row-color"><a href="TracePointDebugInfo.html" title="class in com.ibm.jvm.trace.format.api">TracePointDebugInfo</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><a href="TracePointImpl.html" title="class in com.ibm.jvm.trace.format.api">TracePointImpl</a></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><a href="TraceRecord.html" title="class in com.ibm.jvm.trace.format.api">TraceRecord</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><a href="TraceSection.html" title="class in com.ibm.jvm.trace.format.api">TraceSection</a></div>
<div class="col-last even-row-color">
<div class="block">Trace section of a file header.</div>
</div>
<div class="col-first odd-row-color"><a href="TraceThread.html" title="class in com.ibm.jvm.trace.format.api">TraceThread</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
</div>
</li>
<li>
<div class="caption"><span>Exception Summary</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Exception</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><a href="MissingDataException.html" title="class in com.ibm.jvm.trace.format.api">MissingDataException</a></div>
<div class="col-last even-row-color">&nbsp;</div>
</div>
</li>
</ul>
</section>
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small><a href="https://www.eclipse.org/openj9/" target="_blank">Eclipse OpenJ9 website.</a><br> To raise a bug report or suggest an improvement create an <a href="https://github.com/eclipse-openj9/openj9/issues" target="_blank">Eclipse Openj9 issue.</a><br> Copyright &copy; 1998, 2021, IBM Corp. and others.</small></p>
</footer>
</div>
</div>
</body>
</html>