APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.jfr.internal.tool

public final Class PrettyWriter

extends EventPrintWriter
Class Inheritance
Imports
java.io.IOException, .PrintWriter, java.lang.reflect.Array, java.nio.file.Path, java.time.Duration, .Instant, .OffsetDateTime, java.time.format.DateTimeFormatter, java.time.temporal.ChronoUnit, java.util.ArrayList, .HashMap, .LinkedHashSet, .List, .Map, .PriorityQueue, .SequencedSet, .StringJoiner, jdk.jfr.Contextual, .DataAmount, .EventType, .Frequency, .MemoryAddress, .Percentage, .ValueDescriptor, jdk.jfr.consumer.RecordedClass, .RecordedClassLoader, .RecordedEvent, .RecordedFrame, .RecordedMethod, .RecordedObject, .RecordedStackTrace, .RecordedThread, .RecordingFile, jdk.jfr.internal.util.ValueFormatter

Print events in a human-readable format. This class is also used by RecordedObject#toString()

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
private static record

Field Summary

Modifier and TypeField and Description
private Map<Long, SequencedSet<RecordedEvent>>
private RecordedEvent
private static final SequencedSet<RecordedEvent>
private static final int
private final boolean
private static final DateTimeFormatter
private static final DateTimeFormatter
private PriorityQueue<PrettyWriter.Timestamp>
private static final String
private Map<Long, PrettyWriter.TypeInformation>
private static final Long
Inherited from jdk.jfr.internal.tool.EventPrintWriter:
EVENT_THREAD_FIELDSTACK_TRACE_FIELD

Constructor Summary

AccessConstructor and Description
public
PrettyWriter(PrintWriter destination, boolean showExact)

public

Method Summary

Modifier and TypeMethod and Description
private PrettyWriter.TypeInformation
private String
private boolean
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
printMemory(long value, boolean bytesUnit, boolean frequency)

private void
pack-priv void
printObject(RecordedObject object, long arraySize)

private void
private void
private void
private void
private void
private void
private void
printValue(Object value, ValueDescriptor field, String postFix)

public void
private PrettyWriter.TypeInformation
Inherited from jdk.jfr.internal.tool.EventPrintWriter:
acceptEventgetStackDepthgetValueisLateFieldprintBeginprintEndsetEventFiltersetStackDepth

Field Detail

contextsback to summary
private Map<Long, SequencedSet<RecordedEvent>> contexts
currentEventback to summary
private RecordedEvent currentEvent
EMPTY_SETback to summary
private static final SequencedSet<RecordedEvent> EMPTY_SET
EVENT_WINDOW_SIZEback to summary
private static final int EVENT_WINDOW_SIZE
showExactback to summary
private final boolean showExact
TIME_FORMATback to summary
private static final DateTimeFormatter TIME_FORMAT
TIME_FORMAT_EXACTback to summary
private static final DateTimeFormatter TIME_FORMAT_EXACT
timelineback to summary
private PriorityQueue<PrettyWriter.Timestamp> timeline
TYPE_OLD_OBJECTback to summary
private static final String TYPE_OLD_OBJECT
typeInformationback to summary
private Map<Long, PrettyWriter.TypeInformation> typeInformation
ZEROback to summary
private static final Long ZERO

Constructor Detail

PrettyWriterback to summary
public PrettyWriter(PrintWriter destination, boolean showExact)
PrettyWriterback to summary
public PrettyWriter(PrintWriter destination)

Method Detail

createTypeInformationback to summary
private PrettyWriter.TypeInformation createTypeInformation(EventType eventType)
formatMethodback to summary
private String formatMethod(RecordedMethod m)
isZeroDurationback to summary
private boolean isZeroDuration(RecordedEvent event, String name)
printArrayback to summary
private void printArray(Object[] array, ValueDescriptor field)
printClassback to summary
private void printClass(RecordedClass clazz, String postFix)
printClassLoaderback to summary
private void printClassLoader(RecordedClassLoader cl, String postFix)
printContextFieldsback to summary
private void printContextFields(RecordedEvent contextEvent)
printContextsback to summary
private void printContexts(SequencedSet<RecordedEvent> contextEvents)
printDurationback to summary
private void printDuration(Duration duration)
printFieldValueback to summary
private void printFieldValue(RecordedObject struct, ValueDescriptor v)
printFormattedback to summary
private void printFormatted(ValueDescriptor field, Number number)
printJavaFrameback to summary
private void printJavaFrame(RecordedFrame f, String postFix)
printMemoryback to summary
private void printMemory(long value, boolean bytesUnit, boolean frequency)
printNumberback to summary
private void printNumber(Number number, ValueDescriptor field)
printObjectback to summary
pack-priv void printObject(RecordedObject object, long arraySize)
printOffsetDateTimeback to summary
private void printOffsetDateTime(OffsetDateTime dateTime)
printOldObjectback to summary
private void printOldObject(RecordedObject object)
printRecordedObjectback to summary
private void printRecordedObject(RecordedObject struct, ValueDescriptor field, String postFix)
printReferenceChainback to summary
private void printReferenceChain(RecordedObject object)
printStackTraceback to summary
private void printStackTrace(RecordedStackTrace stackTrace)
printThreadback to summary
private void printThread(RecordedThread thread, String postFix)
printValueback to summary
private void printValue(Object value, ValueDescriptor field, String postFix)
processThreadedTimestampback to summary
public void processThreadedTimestamp(RecordedThread thread, PrettyWriter.Timestamp t)
typeInformationback to summary
private PrettyWriter.TypeInformation typeInformation(RecordedEvent event)
jdk.jfr.internal.tool back to summary

private final Record PrettyWriter.Timestamp

extends Record
implements Comparable<PrettyWriter.Timestamp>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Record Components
event:RecordedEvent 
seconds:long 
nanosCompare:int 
contextual:boolean 

Field Summary

Modifier and TypeField and Description
private final boolean
contextual

Record Component accessed by contextual().

private final RecordedEvent
event

Record Component accessed by event().

private final int
nanosCompare

Record Component accessed by nanosCompare().

private final long
seconds

Record Component accessed by seconds().

Constructor Summary

AccessConstructor and Description
private
Timestamp(RecordedEvent event, long seconds, int nanosCompare, boolean contextual)

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(PrettyWriter.Timestamp that)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public boolean
contextual()

Record Component getter of contextual.

public static PrettyWriter.Timestamp
createEnd(RecordedEvent event, boolean contextual)

public static PrettyWriter.Timestamp
createStart(RecordedEvent event, boolean contextual)

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public RecordedEvent
event()

Record Component getter of event.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public int
nanosCompare()

Record Component getter of nanosCompare.

public long
seconds()

Record Component getter of seconds.

public boolean
public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

contextualback to summary
private final boolean contextual

Record Component accessed by contextual().

eventback to summary
private final RecordedEvent event

Record Component accessed by event().

nanosCompareback to summary
private final int nanosCompare

Record Component accessed by nanosCompare().

secondsback to summary
private final long seconds

Record Component accessed by seconds().

Constructor Detail

Timestampback to summary
private Timestamp(RecordedEvent event, long seconds, int nanosCompare, boolean contextual)

Method Detail

compareToback to summary
public int compareTo(PrettyWriter.Timestamp that)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Annotations
@Override
contextualback to summary
public boolean contextual()

Record Component getter of contextual.

createEndback to summary
public static PrettyWriter.Timestamp createEnd(RecordedEvent event, boolean contextual)
createStartback to summary
public static PrettyWriter.Timestamp createStart(RecordedEvent event, boolean contextual)
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
eventback to summary
public RecordedEvent event()

Record Component getter of event.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

nanosCompareback to summary
public int nanosCompare()

Record Component getter of nanosCompare.

secondsback to summary
public long seconds()

Record Component getter of seconds.

startback to summary
public boolean start()
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

jdk.jfr.internal.tool back to summary

private final Record PrettyWriter.TypeInformation

extends Record
Class Inheritance
Record Components
id:Long 
contextualFields:List<ValueDescriptor> 
contextual:boolean 
simpleName:String 

Field Summary

Modifier and TypeField and Description
private final boolean
contextual

Record Component accessed by contextual().

private final List<ValueDescriptor>
contextualFields

Record Component accessed by contextualFields().

private final Long
id

Record Component accessed by id().

private final String
simpleName

Record Component accessed by simpleName().

Constructor Summary

AccessConstructor and Description
private
TypeInformation(Long id, List<ValueDescriptor> contextualFields, boolean contextual, String simpleName)

Method Summary

Modifier and TypeMethod and Description
public boolean
contextual()

Record Component getter of contextual.

public List<ValueDescriptor>
contextualFields()

Record Component getter of contextualFields.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public Long
id()

Record Component getter of id.

public String
simpleName()

Record Component getter of simpleName.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

contextualback to summary
private final boolean contextual

Record Component accessed by contextual().

contextualFieldsback to summary
private final List<ValueDescriptor> contextualFields

Record Component accessed by contextualFields().

idback to summary
private final Long id

Record Component accessed by id().

simpleNameback to summary
private final String simpleName

Record Component accessed by simpleName().

Constructor Detail

TypeInformationback to summary
private TypeInformation(Long id, List<ValueDescriptor> contextualFields, boolean contextual, String simpleName)

Method Detail

contextualback to summary
public boolean contextual()

Record Component getter of contextual.

contextualFieldsback to summary
public List<ValueDescriptor> contextualFields()

Record Component getter of contextualFields.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

idback to summary
public Long id()

Record Component getter of id.

simpleNameback to summary
public String simpleName()

Record Component getter of simpleName.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.