Package net.minestom.server.monitoring
Class BenchmarkManager
java.lang.Object
net.minestom.server.monitoring.BenchmarkManager
Small monitoring tools that can be used to check the current memory usage and Minestom threads CPU usage.
Needs to be enabled with enable(Duration)
. Memory can then be accessed with getUsedMemory()
and the CPUs usage with getResultMap()
or getCpuMonitoringMessage()
.
Be aware that this is not the most accurate method, you should use a proper java profiler depending on your needs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addThreadMonitor
(@NotNull String threadName) void
disable()
void
@NotNull Component
@NotNull Map
<String, ThreadResult> long
Gets the heap memory used by the server in bytes.
-
Constructor Details
-
BenchmarkManager
public BenchmarkManager()
-
-
Method Details
-
enable
-
disable
public void disable() -
addThreadMonitor
-
getUsedMemory
public long getUsedMemory()Gets the heap memory used by the server in bytes.- Returns:
- the memory used by the server
-
getResultMap
-
getCpuMonitoringMessage
-