Add update and jvm flags to debugpaste

This commit is contained in:
NotMyFault 2019-12-27 16:53:38 +01:00
parent f97e52ea0b
commit 0ad2682210

View File

@ -22,6 +22,7 @@ import java.lang.management.RuntimeMXBean;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
@ -66,6 +67,8 @@ public class DebugPaste extends SubCommand {
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n');
b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n');
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n'); b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n');
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n'); b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n');
b.append("Java Name: ").append(rb.getVmName()).append('\n'); b.append("Java Name: ").append(rb.getVmName()).append('\n');