src/java.base/share/classes/sun/launcher/LauncherHelper.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Fri Jun  1 11:48:41 2018
--- new/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Fri Jun  1 11:48:40 2018

*** 1,7 **** --- 1,7 ---- /* ! * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 89,98 **** --- 89,101 ---- import java.util.stream.Stream; import jdk.internal.misc.VM; import jdk.internal.module.ModuleBootstrap; import jdk.internal.module.Modules; + import jdk.internal.platform.Container; + import jdk.internal.platform.Metrics; + public final class LauncherHelper { // No instantiation private LauncherHelper() {}
*** 149,158 **** --- 152,162 ---- * * stackSize: in bytes, as set by the launcher, a zero-value indicates * this code determine this value, using a suitable method or omit the * line entirely. */ + @SuppressWarnings("fallthrough") static void showSettings(boolean printToStderr, String optionFlag, long initialHeapSize, long maxHeapSize, long stackSize) { initOutput(printToStderr); String opts[] = optionFlag.split(":");
*** 167,180 **** --- 171,192 ---- printProperties(); break; case "locale": printLocale(); break; + case "system": + if (System.getProperty("os.name").contains("Linux")) { + printSystemMetrics(); + break; + } default: printVmSettings(initialHeapSize, maxHeapSize, stackSize); printProperties(); printLocale(); + if (System.getProperty("os.name").contains("Linux")) { + printSystemMetrics(); + } break; } } /*
*** 305,314 **** --- 317,419 ---- ostream.print(INDENT + INDENT); } } } + public static void printSystemMetrics() { + Metrics c = Container.metrics(); + + ostream.println("Operating System Metrics:"); + + if (c == null) { + ostream.println(INDENT + "No metrics available for this platform"); + return; + } + + ostream.println(INDENT + "Provider: " + c.getProvider()); + ostream.println(INDENT + "Effective CPU Count: " + c.getEffectiveCpuCount()); + ostream.println(INDENT + "CPU Period: " + c.getCpuPeriod()); + ostream.println(INDENT + "CPU Quota: " + c.getCpuQuota()); + ostream.println(INDENT + "CPU Shares: " + c.getCpuShares()); + + int cpus[] = c.getCpuSetCpus(); + ostream.println(INDENT + "List of Processors, " + + cpus.length + " total: "); + + ostream.print(INDENT); + for (int i = 0; i < cpus.length; i++) { + ostream.print(cpus[i] + " "); + } + if (cpus.length > 0) { + ostream.println(""); + } + + cpus = c.getEffectiveCpuSetCpus(); + ostream.println(INDENT + "List of Effective Processors, " + + cpus.length + " total: "); + + ostream.print(INDENT); + for (int i = 0; i < cpus.length; i++) { + ostream.print(cpus[i] + " "); + } + if (cpus.length > 0) { + ostream.println(""); + } + + int mems[] = c.getCpuSetMems(); + ostream.println(INDENT + "List of Memory Nodes, " + + mems.length + " total: "); + + ostream.print(INDENT); + for (int i = 0; i < mems.length; i++) { + ostream.print(mems[i] + " "); + } + if (mems.length > 0) { + ostream.println(""); + } + + mems = c.getEffectiveCpuSetMems(); + ostream.println(INDENT + "List of Available Memory Nodes, " + + mems.length + " total: "); + + ostream.print(INDENT); + for (int i = 0; i < mems.length; i++) { + ostream.print(mems[i] + " "); + } + if (mems.length > 0) { + ostream.println(""); + } + + ostream.println(INDENT + "CPUSet Memory Pressure Enabled: " + + c.isCpuSetMemoryPressureEnabled()); + + long limit = c.getMemoryLimit(); + ostream.println(INDENT + "Memory Limit: " + + ((limit >= 0) ? SizePrefix.scaleValue(limit) : "Unlimited")); + + limit = c.getMemorySoftLimit(); + ostream.println(INDENT + "Memory Soft Limit: " + + ((limit >= 0) ? SizePrefix.scaleValue(limit) : "Unlimited")); + + limit = c.getMemoryAndSwapLimit(); + ostream.println(INDENT + "Memory & Swap Limit: " + + ((limit >= 0) ? SizePrefix.scaleValue(limit) : "Unlimited")); + + limit = c.getKernelMemoryLimit(); + ostream.println(INDENT + "Kernel Memory Limit: " + + ((limit >= 0) ? SizePrefix.scaleValue(limit) : "Unlimited")); + + limit = c.getTcpMemoryLimit(); + ostream.println(INDENT + "TCP Memory Limit: " + + ((limit >= 0) ? SizePrefix.scaleValue(limit) : "Unlimited")); + + ostream.println(INDENT + "Out Of Memory Killer Enabled: " + + c.isMemoryOOMKillEnabled()); + + ostream.println(""); + } + private enum SizePrefix { KILO(1024, "K"), MEGA(1024 * 1024, "M"), GIGA(1024 * 1024 * 1024, "G"),

src/java.base/share/classes/sun/launcher/LauncherHelper.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File