public final class Timings extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
generateReport(CommandSource source)
Generates a report and sends it to the specified command source.
|
static void |
generateReport(MessageChannel channel)
Generates a report and sends it to the specified
MessageChannel. |
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 timings system is enabled.
|
static boolean |
isVerboseTimingsEnabled()
Gets whether or not the verbose level of timings is enabled.
|
static Timing |
of(Object plugin,
String name)
Gets a
Timing for a plugin corresponding to a name. |
static Timing |
of(Object plugin,
String name,
Timing groupHandler)
Gets a handler that has a groupHandler timer handler.
|
static Timing |
ofStart(Object plugin,
String name)
Returns a
Timing object after starting it, useful for
try-with-resources. |
static Timing |
ofStart(Object plugin,
String name,
Timing groupHandler)
Returns a
Timing object after starting it, useful for
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 timings system should be enabled.
|
static void |
setVerboseTimingsEnabled(boolean enabled)
Sets whether or not the timings should monitor at verbose level.
|
public static Timing of(Object plugin, String name)
Timing for a plugin corresponding to a name.plugin - The plugin instance to own the timingname - Name of the timingTiming instancepublic static Timing of(Object plugin, String name, Timing groupHandler)
plugin - The plugin instance to own the timingname - Name of the timinggroupHandler - Parent handler to mirror .start/stop calls toTiming instancepublic static Timing ofStart(Object plugin, String name)
Timing object after starting it, useful for
try-with-resources.
try (Timing ignored = Timings.ofStart(plugin, someName)) {
// timed section
}
plugin - Plugin to own the timingname - Name of timingTiming instancepublic static Timing ofStart(Object plugin, String name, Timing groupHandler)
Timing object after starting it, useful for
try-with-resources.
try (Timing ignored = Timings.ofStart(plugin, someName,
groupHandler)) {
// timed section
}
plugin - Plugin to own the timingname - Name of timinggroupHandler - Parent handler to mirror start/stop calls toTiming instancepublic static boolean isTimingsEnabled()
public static void setTimingsEnabled(boolean enabled)
enabled - Should timings be reportedpublic static boolean isVerboseTimingsEnabled()
public static void setVerboseTimingsEnabled(boolean enabled)
enabled - Should high-frequency timings be reportedpublic static int getHistoryInterval()
public static void setHistoryInterval(int interval)
This will re-check 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)
This value is capped at a maximum of getHistoryInterval() * MAX_HISTORY_FRAMES (12).
Will not reset timing data but may truncate old history if the new length is less than old length.
length - Duration in tickspublic static void reset()
public static void generateReport(@Nullable CommandSource source)
If source is null, the ConsoleSource will be used.
source - The source to show the report topublic static void generateReport(MessageChannel channel)
MessageChannel.channel - The channel to send report to