Class 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}
    • 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 seconds
      com.google.common.collect.ImmutableList<ForgeTimings<T>> getTimingData()
      Returns the timings data recorded by the tracker
      void reset()
      Resets the tracker (clears timings and stops any in-progress timings)
      void trackEnd​(T tracking)
      Ends the timing of the currently tracking object
      private void trackEnd​(T object, long nanoTime)  
      void trackStart​(T toTrack)
      Starts timing of the provided object
      private void trackStart​(T toTrack, long nanoTime)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • TimeTracker

        public TimeTracker()
    • 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)