Record Class ResourceSnapshot
java.lang.Object
java.lang.Record
org.ek9lang.compiler.common.ResourceSnapshot
public record ResourceSnapshot(long wallNanos, long cpuNanos, long allocatedBytes, long gcCount, long gcMillis, LockMetrics.Snapshot lock)
extends Record
THE measurement of a window of compilation - a phase or a stage of one - used by the verbose
PHASE_METRICS
and *_STAGE lines so every window is measured the same way. Take one at the start, one at the end, and
describe the difference.
- cpu / busyCores - process CPU time, and that divided by wall time: how many cores the window kept busy. A window that barely speeds up with more threads is either stalling on many cores (busyCores high) or not running on many cores at all (busyCores near 1) - wall time alone cannot tell those apart, and they need opposite fixes.
- alloc - bytes allocated by all threads: the pressure behind garbage collection.
- gc - collections and their accumulated time.
- lock - acquisitions of, waits for and holds of the program lock, only when
LockMetricsis enabled (-Dek9.lockMetrics=true).
Any figure the JVM cannot supply is reported as -1 rather than guessed.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceSnapshot(long wallNanos, long cpuNanos, long allocatedBytes, long gcCount, long gcMillis, LockMetrics.Snapshot lock) Creates an instance of aResourceSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of theallocatedBytesrecord component.doubleMegabytes allocated from this snapshot tolater; -1 when unavailable.doublebusyCoresTo(ResourceSnapshot later) How many cores were busy on average from this snapshot tolater; -1 when CPU time is unavailable.longcpuNanos()Returns the value of thecpuNanosrecord component.describeTo(ResourceSnapshot later) The resource use from this snapshot tolater, as appended to a verbose timing line:cpu 123.4 ms busyCores 3.21 alloc 456.7 MB gc 3 in 12 msand, when lock metrics are on,lock 1234 acquisitions wait 5.6 ms held 78.9 ms.final booleanIndicates whether some other object is "equal to" this one.longgcCount()Returns the value of thegcCountrecord component.longgcMillis()Returns the value of thegcMillisrecord component.final inthashCode()Returns a hash code value for this object.lock()Returns the value of thelockrecord component.doublemillisTo(ResourceSnapshot later) Wall time from this snapshot tolater, in milliseconds.static ResourceSnapshotnow()The counters now.final StringtoString()Returns a string representation of this record class.longReturns the value of thewallNanosrecord component.
-
Constructor Details
-
ResourceSnapshot
public ResourceSnapshot(long wallNanos, long cpuNanos, long allocatedBytes, long gcCount, long gcMillis, LockMetrics.Snapshot lock) Creates an instance of aResourceSnapshotrecord class.- Parameters:
wallNanos- the value for thewallNanosrecord componentcpuNanos- the value for thecpuNanosrecord componentallocatedBytes- the value for theallocatedBytesrecord componentgcCount- the value for thegcCountrecord componentgcMillis- the value for thegcMillisrecord componentlock- the value for thelockrecord component
-
-
Method Details
-
now
The counters now. -
millisTo
Wall time from this snapshot tolater, in milliseconds. -
busyCoresTo
How many cores were busy on average from this snapshot tolater; -1 when CPU time is unavailable. -
allocatedMegabytesTo
Megabytes allocated from this snapshot tolater; -1 when unavailable. -
describeTo
The resource use from this snapshot tolater, as appended to a verbose timing line:cpu 123.4 ms busyCores 3.21 alloc 456.7 MB gc 3 in 12 msand, when lock metrics are on,lock 1234 acquisitions wait 5.6 ms held 78.9 ms. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
wallNanos
public long wallNanos()Returns the value of thewallNanosrecord component.- Returns:
- the value of the
wallNanosrecord component
-
cpuNanos
public long cpuNanos()Returns the value of thecpuNanosrecord component.- Returns:
- the value of the
cpuNanosrecord component
-
allocatedBytes
public long allocatedBytes()Returns the value of theallocatedBytesrecord component.- Returns:
- the value of the
allocatedBytesrecord component
-
gcCount
public long gcCount()Returns the value of thegcCountrecord component.- Returns:
- the value of the
gcCountrecord component
-
gcMillis
public long gcMillis()Returns the value of thegcMillisrecord component.- Returns:
- the value of the
gcMillisrecord component
-
lock
Returns the value of thelockrecord component.- Returns:
- the value of the
lockrecord component
-