Package com.tnsai.quality.sandbox
Record Class ResourceUsage
java.lang.Object
java.lang.Record
com.tnsai.quality.sandbox.ResourceUsage
- Record Components:
peakMemoryMb- peak resident-set size during executioncpuMillis- CPU time consumed (user + system)diskBytes- bytes written to scratch disk during executionwallClockMs- wall-clock duration of the execution
public record ResourceUsage(long peakMemoryMb, long cpuMillis, long diskBytes, long wallClockMs)
extends Record
Post-execution resource accounting from a sandbox (TNS-296).
Backends populate as much as their underlying mechanism reports;
unsupported metrics are returned as
-1 (so 0 means
"the sandbox really did use zero" rather than "we don't know").- Since:
- 0.10.0 (TNS-296)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longSentinel for "metric unavailable from this backend". -
Constructor Summary
ConstructorsConstructorDescriptionResourceUsage(long peakMemoryMb, long cpuMillis, long diskBytes, long wallClockMs) Creates an instance of aResourceUsagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thecpuMillisrecord component.longReturns the value of thediskBytesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of thepeakMemoryMbrecord component.final StringtoString()Returns a string representation of this record class.static ResourceUsageunknown()longReturns the value of thewallClockMsrecord component.
-
Field Details
-
UNKNOWN
public static final long UNKNOWNSentinel for "metric unavailable from this backend".- See Also:
-
-
Constructor Details
-
ResourceUsage
public ResourceUsage(long peakMemoryMb, long cpuMillis, long diskBytes, long wallClockMs) Creates an instance of aResourceUsagerecord class.- Parameters:
peakMemoryMb- the value for thepeakMemoryMbrecord componentcpuMillis- the value for thecpuMillisrecord componentdiskBytes- the value for thediskBytesrecord componentwallClockMs- the value for thewallClockMsrecord component
-
-
Method Details
-
unknown
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared with '=='. -
peakMemoryMb
public long peakMemoryMb()Returns the value of thepeakMemoryMbrecord component.- Returns:
- the value of the
peakMemoryMbrecord component
-
cpuMillis
public long cpuMillis()Returns the value of thecpuMillisrecord component.- Returns:
- the value of the
cpuMillisrecord component
-
diskBytes
public long diskBytes()Returns the value of thediskBytesrecord component.- Returns:
- the value of the
diskBytesrecord component
-
wallClockMs
public long wallClockMs()Returns the value of thewallClockMsrecord component.- Returns:
- the value of the
wallClockMsrecord component
-