Record Class ResourceUsage

java.lang.Object
java.lang.Record
com.tnsai.quality.sandbox.ResourceUsage
Record Components:
peakMemoryMb - peak resident-set size during execution
cpuMillis - CPU time consumed (user + system)
diskBytes - bytes written to scratch disk during execution
wallClockMs - 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

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Sentinel for "metric unavailable from this backend".
  • Constructor Summary

    Constructors
    Constructor
    Description
    ResourceUsage(long peakMemoryMb, long cpuMillis, long diskBytes, long wallClockMs)
    Creates an instance of a ResourceUsage record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the value of the cpuMillis record component.
    long
    Returns the value of the diskBytes record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the peakMemoryMb record component.
    final String
    Returns a string representation of this record class.
     
    long
    Returns the value of the wallClockMs record component.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • UNKNOWN

      public static final long UNKNOWN
      Sentinel 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 a ResourceUsage record class.
      Parameters:
      peakMemoryMb - the value for the peakMemoryMb record component
      cpuMillis - the value for the cpuMillis record component
      diskBytes - the value for the diskBytes record component
      wallClockMs - the value for the wallClockMs record component
  • Method Details

    • unknown

      public static ResourceUsage unknown()
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • peakMemoryMb

      public long peakMemoryMb()
      Returns the value of the peakMemoryMb record component.
      Returns:
      the value of the peakMemoryMb record component
    • cpuMillis

      public long cpuMillis()
      Returns the value of the cpuMillis record component.
      Returns:
      the value of the cpuMillis record component
    • diskBytes

      public long diskBytes()
      Returns the value of the diskBytes record component.
      Returns:
      the value of the diskBytes record component
    • wallClockMs

      public long wallClockMs()
      Returns the value of the wallClockMs record component.
      Returns:
      the value of the wallClockMs record component