用来检测当前JVM内存的使用情况,检测当前jvm内存,主要用来检测JVM内存的
分享于 点击 5558 次 点评:14
用来检测当前JVM内存的使用情况,检测当前jvm内存,主要用来检测JVM内存的
主要用来检测JVM内存的使用情况。
可以使用linux计划任务wget获取结果并写入日期格式文件,备查。
<%-- http://www.freshblurbs.com/explaining-java-lang-outofmemoryerror-permgen-space --%><%@ page contentType="text/html;charset=UTF-8" isErrorPage="true" %><%@ page import="java.lang.management.*" %><%@ page import="java.util.*" %><%@ include file="/common/taglibs.jsp" %><html><head> <title>JVM Memory Monitor</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Cache-Control" content="no-store" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /></head><body> <h1 style="text-decoration: underline;">JVM Memory Monitor[<fmt:formatdate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss Z" />]</h1> <h2>Memory MXBean</h2> <b>Heap Memory Usage:</b> <%= ManagementFactory.getMemoryMXBean().getHeapMemoryUsage() %><br> <b>Non-Heap Memory Usage: </b><%= ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage() %><br> <h2>Memory Pool MXBeans</h2> <%Iterator iter = ManagementFactory.getMemoryPoolMXBeans().iterator();while (iter.hasNext()) {MemoryPoolMXBean item = (MemoryPoolMXBean) iter.next();%> <div style="border-bottom: 1px solid #000000"> <b>- Name:</b> <%= item.getName() %><br> <b>- Type:</b> <%= item.getType() %><br> <b>- Usage:</b> <%= item.getUsage() %><br> <b>- Peak Usage:</b> <%= item.getPeakUsage() %><br> <b>- Collection Usage:</b> <%= item.getCollectionUsage() %><br> </div> <%}%></body></html>//该片段来自于http://byrx.net
用户点评