From 7b126f5d13a9905644ee260978fce9216f2684a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9meth=20Noel?= Date: Wed, 30 Jun 2021 00:32:06 +0200 Subject: [PATCH] Updated BenchmarkManager.java --- .../net/minestom/server/monitoring/BenchmarkManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/monitoring/BenchmarkManager.java b/src/main/java/net/minestom/server/monitoring/BenchmarkManager.java index 7521b6a8e..389147358 100644 --- a/src/main/java/net/minestom/server/monitoring/BenchmarkManager.java +++ b/src/main/java/net/minestom/server/monitoring/BenchmarkManager.java @@ -7,13 +7,13 @@ import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.format.NamedTextColor; import net.minestom.server.MinecraftServer; import net.minestom.server.utils.MathUtils; -import net.minestom.server.utils.time.UpdateOption; import net.minestom.server.utils.validate.Check; import org.jetbrains.annotations.NotNull; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; +import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -25,7 +25,7 @@ import static net.minestom.server.MinecraftServer.*; /** * Small monitoring tools that can be used to check the current memory usage and Minestom threads CPU usage. *

- * Needs to be enabled with {@link #enable(UpdateOption)}. Memory can then be accessed with {@link #getUsedMemory()} + * Needs to be enabled with {@link #enable(Duration)}. Memory can then be accessed with {@link #getUsedMemory()} * and the CPUs usage with {@link #getResultMap()} or {@link #getCpuMonitoringMessage()}. *

* Be aware that this is not the most accurate method, you should use a proper java profiler depending on your needs. @@ -57,10 +57,10 @@ public final class BenchmarkManager { private long time; - public void enable(@NotNull UpdateOption updateOption) { + public void enable(@NotNull Duration duration) { Check.stateCondition(enabled, "A benchmark is already running, please disable it first."); - time = updateOption.getTimeUnit().toMilliseconds(updateOption.getValue()); + time = duration.toMillis(); final Thread thread = new Thread(null, () -> {