Package io.perfmark.traceviewer
Class TraceEventViewer
- java.lang.Object
-
- io.perfmark.traceviewer.TraceEventViewer
-
public final class TraceEventViewer extends java.lang.ObjectThis class converts from the Trace Event json data into a full HTML page. It includes the trace viewer from Catapult, the Chromium trace UI.This class is separate from
TraceEventWriter, because it includes a fairly large HTML chunk, and brings in a differently licenced piece of code.This code is NOT API stable, and may be removed in the future, or changed without notice.
- Since:
- 0.17.0
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringINLINE_TRACE_DATAprivate static java.util.logging.Loggerlogger
-
Constructor Summary
Constructors Modifier Constructor Description privateTraceEventViewer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringreadAll(java.io.InputStream stream)private static java.lang.StringreplaceIndexTraceData(java.lang.String index, java.lang.String replacement)private static java.lang.StringreplaceIndexTraceImport(java.lang.String index, java.lang.String replacement, java.lang.String inlineTraceData64)Replaces the normal<link>tag in index.html with a custom replacement, and optionally the inlined Trace data as a base64 script.private static java.lang.StringreplaceIndexWebComponents(java.lang.String index, java.lang.String replacement)private static java.lang.StringtrimTraceViewer(java.lang.String traceViewer)static java.nio.file.PathwriteTraceHtml()A convenience function aroundwriteTraceHtml(Writer).static voidwriteTraceHtml(java.io.Writer writer)Writes all available trace data as a single HTML file into the given writer.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
INLINE_TRACE_DATA
private static final java.lang.String INLINE_TRACE_DATA
- See Also:
- Constant Field Values
-
-
Method Detail
-
writeTraceHtml
public static java.nio.file.Path writeTraceHtml() throws java.io.IOExceptionA convenience function aroundwriteTraceHtml(Writer). This writes the trace data to a temporary file and logs the output location.- Returns:
- the Path of the written file.
- Throws:
java.io.IOException- if it can't write to the destination.
-
writeTraceHtml
public static void writeTraceHtml(java.io.Writer writer) throws java.io.IOExceptionWrites all available trace data as a single HTML file into the given writer.- Parameters:
writer- The destination to write all HTML to.- Throws:
java.io.IOException- if it can't write to the writer.
-
replaceIndexTraceImport
private static java.lang.String replaceIndexTraceImport(java.lang.String index, java.lang.String replacement, java.lang.String inlineTraceData64)Replaces the normal<link>tag in index.html with a custom replacement, and optionally the inlined Trace data as a base64 script. This is because the trace2html.html file imports the data as a top level text/plain script.
-
replaceIndexWebComponents
private static java.lang.String replaceIndexWebComponents(java.lang.String index, java.lang.String replacement)
-
replaceIndexTraceData
private static java.lang.String replaceIndexTraceData(java.lang.String index, java.lang.String replacement)
-
trimTraceViewer
private static java.lang.String trimTraceViewer(java.lang.String traceViewer)
-
readAll
private static java.lang.String readAll(java.io.InputStream stream) throws java.io.IOException- Throws:
java.io.IOException
-
-