Package io.perfmark.tracewriter
Class TraceEventWriter
java.lang.Object
io.perfmark.tracewriter.TraceEventWriter
Writes the PerfMark results to a "Trace Event" JSON file usable by the Chromium Profiler
"Catapult". The format is defined at ...
This code is NOT API stable, and may be removed in the future, or changed without notice.
- Since:
- 0.16.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classprivate static final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static longgetPid()private static Pathprivate static booleanmaybeAddComment(Writer writer, boolean firstOf) private static PathpickNextDest(Path dir) private static Stringprivate static voidwriteString(Writer writer, String s) private static voidwriteTraceEventObject(Writer dest, List<TraceEvent> events) static PathWrites trace events the home directory.static voidwriteTraceEvents(Writer destination) Writes all trace events in JSON format to the given destination.static voidwriteTraceEvents(Writer destination, List<? extends MarkList> markLists, long initNanoTime, long nowNanoTime, long pid) Writes the trace events gathered fromStorage.read().
-
Field Details
-
logger
-
HEX_TABLE
- See Also:
-
-
Constructor Details
-
TraceEventWriter
public TraceEventWriter()
-
-
Method Details
-
writeTraceEvents
Writes trace events the home directory. By default, it prefers the location in$XDG_DATA_HOME/perfmarkenvironment variable. If unset, it attempts to use$HOME/.local/share/perfmark.Authors note: if you are on Windows, or the above defaults aren't right, I'm not really sure where else is a good place to put this data. Please file an issue at https://www.perfmark.io/ if you have a preference.
Updated in 0.17.0 to return the created path.
- Returns:
- the path used to create the trace file.
- Throws:
IOException- if there is an error writing to the file.
-
writeTraceEvents
Writes all trace events in JSON format to the given destination.- Parameters:
destination- the destination for the JSON data.- Throws:
IOException- if there are errors build the JSON, or can't write to the destination.
-
writeTraceEvents
public static void writeTraceEvents(Writer destination, List<? extends MarkList> markLists, long initNanoTime, long nowNanoTime, long pid) throws IOException Writes the trace events gathered fromStorage.read(). This method is not API stable. It will be eventually.- Parameters:
destination- the destination for the JSON data.markLists- the data to use to build the trace event JSONinitNanoTime- the time PerfMark classes were first loaded as specified bySystem.nanoTime()nowNanoTime- the current time as specified bySystem.nanoTime().pid- the PID of the current process.- Throws:
IOException- if there are errors build the JSON, or can't write to the destination.
-
writeTraceEventObject
- Throws:
IOException
-
maybeAddComment
- Throws:
IOException
-
pickNextDest
- Throws:
IOException
-
guessDirectory
- Throws:
IOException
-
getPid
private static long getPid() -
taskName
-
writeString
- Throws:
IOException
-