Class TimeTracker<T>
java.lang.Object
net.neoforged.neoforge.server.timings.TimeTracker<T>
- Type Parameters:
T
-
A class to assist in the collection of data to measure the update times of ticking objects {currently Tile Entities and Entities}
-
Field Summary
Modifier and TypeFieldDescriptionstatic final TimeTracker
<BlockEntity> A tracker for timing tile entity updateprivate WeakReference
<T> private boolean
static final TimeTracker
<Entity> A tracker for timing entity updatesprivate long
private int
private long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
enable
(int duration) Starts recording tracking data for the given duration in secondscom.google.common.collect.ImmutableList
<ObjectTimings<T>> Returns the timings data recorded by the trackervoid
reset()
Resets the tracker (clears timings and stops any in-progress timings)void
Ends the timing of the currently tracking objectprivate void
void
trackStart
(T toTrack) Starts timing of the provided objectprivate void
trackStart
(T toTrack, long nanoTime)
-
Field Details
-
BLOCK_ENTITY_UPDATE
A tracker for timing tile entity update -
ENTITY_UPDATE
A tracker for timing entity updates -
enabled
private boolean enabled -
trackingDuration
private int trackingDuration -
timings
-
currentlyTracking
-
trackTime
private long trackTime -
timing
private long timing
-
-
Constructor Details
-
TimeTracker
public TimeTracker()
-
-
Method Details
-
getTimingData
Returns the timings data recorded by the tracker- Returns:
- An immutable list of timings data collected by this tracker
-
reset
public void reset()Resets the tracker (clears timings and stops any in-progress timings) -
trackEnd
Ends the timing of the currently tracking object- Parameters:
tracking
- The object to stop timing
-
enable
public void enable(int duration) Starts recording tracking data for the given duration in seconds- Parameters:
duration
- The duration for the time to track
-
trackStart
Starts timing of the provided object- Parameters:
toTrack
- The object to start timing
-
trackEnd
-
trackStart
-