diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java index a17c9245..e8401fcc 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java +++ b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java @@ -146,34 +146,32 @@ public SystemStatistics getSystemStatistics() { return builder.build(); } - public PlatformStatistics getPlatformStatistics(Map startingGcStatistics, boolean detailed) { + public PlatformStatistics getPlatformStatistics(Map startingGcStatistics, boolean includeWorldStatistics) { PlatformStatistics.Builder builder = PlatformStatistics.newBuilder(); PlatformStatistics.Memory.Builder memory = PlatformStatistics.Memory.newBuilder() .setHeap(memoryUsageProto(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage())) .setNonHeap(memoryUsageProto(ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage())); - if (detailed) { - List memoryPoolMXBeans = ManagementFactory.getMemoryPoolMXBeans(); - for (MemoryPoolMXBean memoryPool : memoryPoolMXBeans) { - if (memoryPool.getType() != MemoryType.HEAP) { - continue; - } + List memoryPoolMXBeans = ManagementFactory.getMemoryPoolMXBeans(); + for (MemoryPoolMXBean memoryPool : memoryPoolMXBeans) { + if (memoryPool.getType() != MemoryType.HEAP) { + continue; + } - MemoryUsage usage = memoryPool.getUsage(); - MemoryUsage collectionUsage = memoryPool.getCollectionUsage(); + MemoryUsage usage = memoryPool.getUsage(); + MemoryUsage collectionUsage = memoryPool.getCollectionUsage(); - if (usage.getMax() == -1) { - usage = new MemoryUsage(usage.getInit(), usage.getUsed(), usage.getCommitted(), usage.getCommitted()); - } - - memory.addPools(PlatformStatistics.Memory.MemoryPool.newBuilder() - .setName(memoryPool.getName()) - .setUsage(memoryUsageProto(usage)) - .setCollectionUsage(memoryUsageProto(collectionUsage)) - .build() - ); + if (usage.getMax() == -1) { + usage = new MemoryUsage(usage.getInit(), usage.getUsed(), usage.getCommitted(), usage.getCommitted()); } + + memory.addPools(PlatformStatistics.Memory.MemoryPool.newBuilder() + .setName(memoryPool.getName()) + .setUsage(memoryUsageProto(usage)) + .setCollectionUsage(memoryUsageProto(collectionUsage)) + .build() + ); } builder.setMemory(memory.build()); @@ -240,7 +238,7 @@ public PlatformStatistics getPlatformStatistics(Map