Record Class TickTime

java.lang.Object
java.lang.Record
ca.spottedleaf.common.time.TickTime

public record TickTime(long previousTickStart, long scheduledTickStart, long tickStart, long tickStartCPU, long tickEnd, long tickEndCPU, long intermediateTaskExecutionTime, long intermediateTaskExecutionTimeCPU, boolean supportCPUTime) extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    TickTime(long previousTickStart, long scheduledTickStart, long tickStart, long tickStartCPU, long tickEnd, long tickEndCPU, long intermediateTaskExecutionTime, long intermediateTaskExecutionTimeCPU, boolean supportCPUTime)
    Creates an instance of a TickTime record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final long
    differenceFromLastTick(long tickInterval)
    The difference in time from the start of the last tick to the start of the current tick.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns whether there was a tick that occurred before this one.
    long
    Returns the value of the intermediateTaskExecutionTime record component.
    long
    Returns the value of the intermediateTaskExecutionTimeCPU record component.
    long
    Returns the value of the previousTickStart record component.
    long
    Returns the value of the scheduledTickStart record component.
    final long
    The difference between the start tick time and the scheduled start tick time.
    boolean
    Returns the value of the supportCPUTime record component.
    final long
    The total CPU time from the start tick time to the end tick time.
    long
    Returns the value of the tickEnd record component.
    long
    Returns the value of the tickEndCPU record component.
    final long
    The difference from the end tick time and the start tick time.
    long
    Returns the value of the tickStart record component.
    long
    Returns the value of the tickStartCPU record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TickTime

      public TickTime(long previousTickStart, long scheduledTickStart, long tickStart, long tickStartCPU, long tickEnd, long tickEndCPU, long intermediateTaskExecutionTime, long intermediateTaskExecutionTimeCPU, boolean supportCPUTime)
      Creates an instance of a TickTime record class.
      Parameters:
      previousTickStart - the value for the previousTickStart record component
      scheduledTickStart - the value for the scheduledTickStart record component
      tickStart - the value for the tickStart record component
      tickStartCPU - the value for the tickStartCPU record component
      tickEnd - the value for the tickEnd record component
      tickEndCPU - the value for the tickEndCPU record component
      intermediateTaskExecutionTime - the value for the intermediateTaskExecutionTime record component
      intermediateTaskExecutionTimeCPU - the value for the intermediateTaskExecutionTimeCPU record component
      supportCPUTime - the value for the supportCPUTime record component
  • Method Details

    • startOvershoot

      public final long startOvershoot()
      The difference between the start tick time and the scheduled start tick time. This value is < 0 if the tick started before the scheduled tick time.
    • tickLength

      public final long tickLength()
      The difference from the end tick time and the start tick time. Always >= 0 (unless nanoTime is just wrong).
    • tickCpuTime

      public final long tickCpuTime()
      The total CPU time from the start tick time to the end tick time. Generally should be equal to the tickLength, unless there is CPU starvation or the tick thread was blocked by I/O or other tasks. Returns Long.MIN_VALUE if CPU time measurement is not supported.
    • differenceFromLastTick

      public final long differenceFromLastTick(long tickInterval)
      The difference in time from the start of the last tick to the start of the current tick. If there is no last tick, then this value is max(tickInterval, tickLength).
      Parameters:
      tickInterval - The expected interval between ticks.
    • hasLastTick

      public boolean hasLastTick()
      Returns whether there was a tick that occurred before this one.
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • previousTickStart

      public long previousTickStart()
      Returns the value of the previousTickStart record component.
      Returns:
      the value of the previousTickStart record component
    • scheduledTickStart

      public long scheduledTickStart()
      Returns the value of the scheduledTickStart record component.
      Returns:
      the value of the scheduledTickStart record component
    • tickStart

      public long tickStart()
      Returns the value of the tickStart record component.
      Returns:
      the value of the tickStart record component
    • tickStartCPU

      public long tickStartCPU()
      Returns the value of the tickStartCPU record component.
      Returns:
      the value of the tickStartCPU record component
    • tickEnd

      public long tickEnd()
      Returns the value of the tickEnd record component.
      Returns:
      the value of the tickEnd record component
    • tickEndCPU

      public long tickEndCPU()
      Returns the value of the tickEndCPU record component.
      Returns:
      the value of the tickEndCPU record component
    • intermediateTaskExecutionTime

      public long intermediateTaskExecutionTime()
      Returns the value of the intermediateTaskExecutionTime record component.
      Returns:
      the value of the intermediateTaskExecutionTime record component
    • intermediateTaskExecutionTimeCPU

      public long intermediateTaskExecutionTimeCPU()
      Returns the value of the intermediateTaskExecutionTimeCPU record component.
      Returns:
      the value of the intermediateTaskExecutionTimeCPU record component
    • supportCPUTime

      public boolean supportCPUTime()
      Returns the value of the supportCPUTime record component.
      Returns:
      the value of the supportCPUTime record component