Class BenchmarkManager

java.lang.Object
net.minestom.server.monitoring.BenchmarkManager

public final class BenchmarkManager extends Object
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 Details

    • BenchmarkManager

      public BenchmarkManager()
  • Method Details

    • enable

      public void enable(@NotNull @NotNull Duration duration)
    • disable

      public void disable()
    • addThreadMonitor

      public void addThreadMonitor(@NotNull @NotNull String threadName)
    • getUsedMemory

      public long getUsedMemory()
      Gets the heap memory used by the server in bytes.
      Returns:
      the memory used by the server
    • getResultMap

      @NotNull public @NotNull Map<String,ThreadResult> getResultMap()
    • getCpuMonitoringMessage

      @NotNull public @NotNull Component getCpuMonitoringMessage()