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
ConstructorsConstructorDescriptionTickTime(long previousTickStart, long scheduledTickStart, long tickStart, long tickStartCPU, long tickEnd, long tickEndCPU, long intermediateTaskExecutionTime, long intermediateTaskExecutionTimeCPU, boolean supportCPUTime) Creates an instance of aTickTimerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal longdifferenceFromLastTick(long tickInterval) The difference in time from the start of the last tick to the start of the current tick.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns whether there was a tick that occurred before this one.longReturns the value of theintermediateTaskExecutionTimerecord component.longReturns the value of theintermediateTaskExecutionTimeCPUrecord component.longReturns the value of thepreviousTickStartrecord component.longReturns the value of thescheduledTickStartrecord component.final longThe difference between the start tick time and the scheduled start tick time.booleanReturns the value of thesupportCPUTimerecord component.final longThe total CPU time from the start tick time to the end tick time.longtickEnd()Returns the value of thetickEndrecord component.longReturns the value of thetickEndCPUrecord component.final longThe difference from the end tick time and the start tick time.longReturns the value of thetickStartrecord component.longReturns the value of thetickStartCPUrecord component.final StringtoString()Returns a string representation of this record class.
-
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 aTickTimerecord class.- Parameters:
previousTickStart- the value for thepreviousTickStartrecord componentscheduledTickStart- the value for thescheduledTickStartrecord componenttickStart- the value for thetickStartrecord componenttickStartCPU- the value for thetickStartCPUrecord componenttickEnd- the value for thetickEndrecord componenttickEndCPU- the value for thetickEndCPUrecord componentintermediateTaskExecutionTime- the value for theintermediateTaskExecutionTimerecord componentintermediateTaskExecutionTimeCPU- the value for theintermediateTaskExecutionTimeCPUrecord componentsupportCPUTime- the value for thesupportCPUTimerecord component
-
-
Method Details
-
startOvershoot
public final long startOvershoot()The difference between the start tick time and the scheduled start tick time. This value is< 0if 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
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
previousTickStart
public long previousTickStart()Returns the value of thepreviousTickStartrecord component.- Returns:
- the value of the
previousTickStartrecord component
-
scheduledTickStart
public long scheduledTickStart()Returns the value of thescheduledTickStartrecord component.- Returns:
- the value of the
scheduledTickStartrecord component
-
tickStart
public long tickStart()Returns the value of thetickStartrecord component.- Returns:
- the value of the
tickStartrecord component
-
tickStartCPU
public long tickStartCPU()Returns the value of thetickStartCPUrecord component.- Returns:
- the value of the
tickStartCPUrecord component
-
tickEnd
public long tickEnd()Returns the value of thetickEndrecord component.- Returns:
- the value of the
tickEndrecord component
-
tickEndCPU
public long tickEndCPU()Returns the value of thetickEndCPUrecord component.- Returns:
- the value of the
tickEndCPUrecord component
-
intermediateTaskExecutionTime
public long intermediateTaskExecutionTime()Returns the value of theintermediateTaskExecutionTimerecord component.- Returns:
- the value of the
intermediateTaskExecutionTimerecord component
-
intermediateTaskExecutionTimeCPU
public long intermediateTaskExecutionTimeCPU()Returns the value of theintermediateTaskExecutionTimeCPUrecord component.- Returns:
- the value of the
intermediateTaskExecutionTimeCPUrecord component
-
supportCPUTime
public boolean supportCPUTime()Returns the value of thesupportCPUTimerecord component.- Returns:
- the value of the
supportCPUTimerecord component
-