Package org.polyfrost.oneconfig.utils.v1
Class SimpleProfiler
java.lang.Object
org.polyfrost.oneconfig.utils.v1.SimpleProfiler
A simple class that can be used to profile code
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatPop a profiler start time from the map and print the time to the log in this format
[OneConfig Profiler/INFO] <msg> took <time>msstatic floatPop a profiler start time from the map and print the time to the log in this format
[OneConfig Profiler/<level>] <msg> took <time>msstatic booleanPush a profiler start time to the map
-
Method Details
-
push
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
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 forpush(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 forpush(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:
-