Class TimeTracker<T>

java.lang.Object
net.minecraftforge.server.timings.TimeTracker<T>
Type Parameters:
T -

public class TimeTracker<T> extends Object
A class to assist in the collection of data to measure the update times of ticking objects {currently Tile Entities and Entities}
  • Field Details

    • 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 Map<T,int[]> timings
    • currentlyTracking

      private WeakReference<T> currentlyTracking
    • trackTime

      private long trackTime
    • timing

      private long timing
  • Constructor Details

    • TimeTracker

      public TimeTracker()
  • Method Details

    • 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)