大师Z教的:每5秒记录一下内存,写到一个文件里,然后利用Excel画一下图就行了
<meta http-equiv="refresh" content="5"> <%@ page contentType="text/html; charset=UTF-8"%> <%@ page import="java.io.*"%> <% Runtime lRuntime = Runtime.getRuntime(); long freeM = lRuntime.freeMemory() / 1024 / 1024; out.println("Free Memory: " + freeM + "M<br/>"); File file = new File("c:/temp/tomcat_jvm.csv"); Writer writer = new FileWriter(file, true); String content = ""+freeM; writer.write(content); writer.write("\n"); writer.close(); %>