Class SimpleProfiler

java.lang.Object
org.polyfrost.oneconfig.utils.v1.SimpleProfiler

public final class SimpleProfiler extends Object
A simple class that can be used to profile code
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    pop(@NotNull String msg)
    Pop a profiler start time from the map and print the time to the log in this format
    [OneConfig Profiler/INFO] <msg> took <time>ms
    static float
    pop(@NotNull String msg, @NotNull org.apache.logging.log4j.Level level)
    Pop a profiler start time from the map and print the time to the log in this format
    [OneConfig Profiler/<level>] <msg> took <time>ms
    static boolean
    push(@NotNull String msg)
    Push a profiler start time to the map

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • push

      public static boolean push(@NotNull @NotNull String msg)
      Push a profiler start time to the map
      Parameters:
      msg - the key for this tracker
      Returns:
      true if the key was not already in the map
      See Also:
    • pop

      public static float pop(@NotNull @NotNull String msg)
      Pop a profiler start time from the map and print the time to the log in this format
      [OneConfig Profiler/INFO] <msg> took <time>ms
      Parameters:
      msg - the key that was used for push(String)

      This is also used for the message above

      Returns:
      the time in milliseconds since the push was called
      See Also:
    • pop

      public static float pop(@NotNull @NotNull String msg, @NotNull @NotNull org.apache.logging.log4j.Level level)
      Pop a profiler start time from the map and print the time to the log in this format
      [OneConfig Profiler/<level>] <msg> took <time>ms
      Parameters:
      msg - the key that was used for push(String)

      This is also used for the message above

      level - the log level to use
      Returns:
      the time in milliseconds since the push was called
      See Also: