public final class Timings extends Object
Modifier and Type | Field and Description |
---|---|
static Timing |
NULL_HANDLER |
Modifier and Type | Method and Description |
---|---|
static void |
generateReport(@Nullable CommandSender sender)
Generates a report and sends it to the specified command sender.
|
static void |
generateReport(@NotNull TimingsReportListener sender)
Generates a report and sends it to the specified listener.
|
static int |
getHistoryInterval()
Gets the interval between Timing History report generation.
|
static int |
getHistoryLength()
Gets how long in ticks Timings history is kept for the server.
|
static boolean |
isTimingsEnabled()
Gets whether or not the Spigot Timings system is enabled
|
static boolean |
isVerboseTimingsEnabled()
Sets whether or not the Timings should monitor at Verbose level.
|
static @NotNull Timing |
of(@NotNull Plugin plugin,
@NotNull String name)
Returns a Timing for a plugin corresponding to a name.
|
static @NotNull Timing |
of(@NotNull Plugin plugin,
@NotNull String name,
@Nullable Timing groupHandler)
Returns a handler that has a groupHandler timer handler.
|
static @NotNull Timing |
ofStart(@NotNull Plugin plugin,
@NotNull String name)
Returns a Timing object after starting it, useful for Java7 try-with-resources.
|
static @NotNull Timing |
ofStart(@NotNull Plugin plugin,
@NotNull String name,
@Nullable Timing groupHandler)
Returns a Timing object after starting it, useful for Java7 try-with-resources.
|
static void |
reset()
Resets all Timing Data
|
static void |
setHistoryInterval(int interval)
Sets the interval between Timing History report generations.
|
static void |
setHistoryLength(int length)
Sets how long Timing History reports are kept for the server.
|
static void |
setTimingsEnabled(boolean enabled)
Sets whether or not the Spigot Timings system should be enabled
|
static void |
setVerboseTimingsEnabled(boolean enabled)
Sets whether or not the Timings should monitor at Verbose level.
|
public static final Timing NULL_HANDLER
@NotNull public static @NotNull Timing of(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String name)
plugin
- Plugin to own the Timingname
- Name of Timing@NotNull public static @NotNull Timing of(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String name, @Nullable @Nullable Timing groupHandler)
Returns a handler that has a groupHandler timer handler. Parent timers should not have their start/stop methods called directly, as the children will call it for you.
Parent Timers are used to group multiple subsections together and get a summary of them combined Parent Handler can not be changed after first callplugin
- Plugin to own the Timingname
- Name of TiminggroupHandler
- Parent handler to mirror .start/stop calls to@NotNull public static @NotNull Timing ofStart(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String name)
plugin
- Plugin to own the Timingname
- Name of Timing@NotNull public static @NotNull Timing ofStart(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String name, @Nullable @Nullable Timing groupHandler)
plugin
- Plugin to own the Timingname
- Name of TiminggroupHandler
- Parent handler to mirror .start/stop calls topublic static boolean isTimingsEnabled()
public static void setTimingsEnabled(boolean enabled)
Sets whether or not the Spigot Timings system should be enabled
Calling this will reset timing data.enabled
- Should timings be reportedpublic static boolean isVerboseTimingsEnabled()
Sets whether or not the Timings should monitor at Verbose level.
When Verbose is disabled, high-frequency timings will not be available.
public static void setVerboseTimingsEnabled(boolean enabled)
Sets whether or not the Timings should monitor at Verbose level.
When Verbose is disabled, high-frequency timings will not be available. Calling this will reset timing data.enabled
- Should high-frequency timings be reportedpublic static int getHistoryInterval()
Gets the interval between Timing History report generation.
Defaults to 5 minutes (6000 ticks)public static void setHistoryInterval(int interval)
Sets the interval between Timing History report generations.
Defaults to 5 minutes (6000 ticks)
This will recheck your history length, so lowering this value will lower your history length if you need more than 60 history windows.interval
- Interval in tickspublic static int getHistoryLength()
public static void setHistoryLength(int length)
length
- Duration in tickspublic static void reset()
public static void generateReport(@Nullable @Nullable CommandSender sender)
sender
- The sender to send to, or null to use the ConsoleCommandSenderpublic static void generateReport(@NotNull @NotNull TimingsReportListener sender)
BufferedCommandSender
to get full response when done!sender
- The listener to send responses too.Copyright © 2021. All rights reserved.