Class ProfilerSystem

java.lang.Object
net.minecraft.util.profiler.ProfilerSystem
All Implemented Interfaces:
Profiler, ReadableProfiler

public class ProfilerSystem
extends Object
implements ReadableProfiler
  • Field Details

    • TIMEOUT_NANOSECONDS

      private static final long TIMEOUT_NANOSECONDS
    • LOGGER

      private static final Logger LOGGER
    • path

      private final List<String> path
    • timeList

      private final LongList timeList
    • locationInfos

      private final Map<String,​ProfilerSystem.LocatedInfo> locationInfos
    • endTickGetter

      private final IntSupplier endTickGetter
    • timeGetter

      private final LongSupplier timeGetter
    • startTime

      private final long startTime
    • startTick

      private final int startTick
    • location

      private String location
    • tickStarted

      private boolean tickStarted
    • currentInfo

    • checkTimeout

      private final boolean checkTimeout
  • Constructor Details

    • ProfilerSystem

      public ProfilerSystem​(LongSupplier timeGetter, IntSupplier tickGetter, boolean checkTimeout)
  • Method Details

    • startTick

      public void startTick()
      Specified by:
      startTick in interface Profiler
    • endTick

      public void endTick()
      Specified by:
      endTick in interface Profiler
    • push

      public void push​(String location)
      Specified by:
      push in interface Profiler
    • push

      public void push​(Supplier<String> locationGetter)
      Specified by:
      push in interface Profiler
    • pop

      public void pop()
      Specified by:
      pop in interface Profiler
    • swap

      public void swap​(String location)
      Specified by:
      swap in interface Profiler
    • swap

      @Environment(CLIENT) public void swap​(Supplier<String> locationGetter)
      Specified by:
      swap in interface Profiler
    • getCurrentInfo

      private ProfilerSystem.LocatedInfo getCurrentInfo()
    • visit

      public void visit​(String marker)
      Increment the visit count for a marker.

      This is useful to keep track of number of calls made to performance- wise expensive methods.

      Specified by:
      visit in interface Profiler
      Parameters:
      marker - a unique marker
    • visit

      public void visit​(Supplier<String> markerGetter)
      Increment the visit count for a marker.

      This is useful to keep track of number of calls made to performance- wise expensive methods.

      This method is preferred if getting the marker is costly; the supplier won't be called if the profiler is disabled.

      Specified by:
      visit in interface Profiler
      Parameters:
      markerGetter - the getter for a unique marker
    • getResult

      public ProfileResult getResult()
      Specified by:
      getResult in interface ReadableProfiler