是否有任何工具/插件可以识别配置文件,如内存,CPU和其他Grails Web应用程序中每个请求的使用信息。
试试这个:
public class CrunchifyJVMParameters {
public static void main(String[] args) {
int mb = 1024 * 1024;
// get Runtime instance
Runtime instance = Runtime.getRuntime();
System.out.println("***** Heap utilization statistics [MB] *****n");
// available memory
System.out.println("Total Memory: " + instance.totalMemory() / mb);
// free memory
System.out.println("Free Memory: " + instance.freeMemory() / mb);
// used memory
System.out.println("Used Memory: "
+ (instance.totalMemory() - instance.freeMemory()) / mb);
// Maximum available memory
System.out.println("Max Memory: " + instance.maxMemory() / mb);
}
}
来源 https://crunchify.com/java-runtime-get-free-used-and-total-memory-in-java/