Class TimeTracker<T>
- java.lang.Object
-
- net.minecraftforge.server.timings.TimeTracker<T>
-
- Type Parameters:
T
-
public class TimeTracker<T> extends java.lang.Object
A class to assist in the collection of data to measure the update times of ticking objects {currently Tile Entities and Entities}
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ref.WeakReference<T>
currentlyTracking
private boolean
enabled
static TimeTracker<Entity>
ENTITY_UPDATE
A tracker for timing entity updatesstatic TimeTracker<TileEntity>
TILE_ENTITY_UPDATE
A tracker for timing tile entity updateprivate long
timing
private java.util.Map<T,int[]>
timings
private int
trackingDuration
private long
trackTime
-
Constructor Summary
Constructors Constructor Description TimeTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enable(int duration)
Starts recording tracking data for the given duration in secondscom.google.common.collect.ImmutableList<ForgeTimings<T>>
getTimingData()
Returns the timings data recorded by the trackervoid
reset()
Resets the tracker (clears timings and stops any in-progress timings)void
trackEnd(T tracking)
Ends the timing of the currently tracking objectprivate void
trackEnd(T object, long nanoTime)
void
trackStart(T toTrack)
Starts timing of the provided objectprivate void
trackStart(T toTrack, long nanoTime)
-
-
-
Field Detail
-
TILE_ENTITY_UPDATE
public static final TimeTracker<TileEntity> TILE_ENTITY_UPDATE
A tracker for timing tile entity update
-
ENTITY_UPDATE
public static final TimeTracker<Entity> ENTITY_UPDATE
A tracker for timing entity updates
-
enabled
private boolean enabled
-
trackingDuration
private int trackingDuration
-
timings
private java.util.Map<T,int[]> timings
-
currentlyTracking
private java.lang.ref.WeakReference<T> currentlyTracking
-
trackTime
private long trackTime
-
timing
private long timing
-
-
Method Detail
-
getTimingData
public com.google.common.collect.ImmutableList<ForgeTimings<T>> 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
public void trackEnd(T tracking)
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
public void trackStart(T toTrack)
Starts timing of the provided object- Parameters:
toTrack
- The object to start timing
-
trackEnd
private void trackEnd(T object, long nanoTime)
-
trackStart
private void trackStart(T toTrack, long nanoTime)
-
-