统计tomcat内存使用情况的jsp代码
2018-07-20 来源:open-open
<%@ page import="java.lang.management.*" %> <%@ page import="java.util.*" %> <html> <head> <title>JVM Memory Monitor</title> </head> <body> <% Iterator iter = ManagementFactory.getMemoryPoolMXBeans().iterator(); while (iter.hasNext()) { MemoryPoolMXBean item = (MemoryPoolMXBean) iter.next(); %> <table border="0" width="100%"> <tr><td colspan="2" align="center"><h3>Memory MXBean</h3></td></tr> <tr><td width="200">Heap Memory Usage</td><td> <%=ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()%> </td></tr> <tr> <td>Non-Heap Memory Usage</td> <td><%=ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage()%></td> </tr> <tr><td colspan="2"> </td></tr> <tr><td colspan="2" align="center"><h3>Memory Pool MXBeans</h3></td></tr> <% Iterator iter = ManagementFactory.getMemoryPoolMXBeans().iterator(); while (iter.hasNext()) { MemoryPoolMXBean item = (MemoryPoolMXBean) iter.next(); %> <tr><td colspan="2"> <table border="0" width="100%" style="border: 1px #98AAB1 solid;"> <tr><td colspan="2" align="center"><b><%= item.getName() %></b></td></tr> <tr><td width="200">Type</td><td><%= item.getType() %></td></tr> <tr><td>Usage</td><td><%= item.getUsage() %></td></tr> <tr><td>Peak Usage</td><td><%= item.getPeakUsage() %></td></tr> <tr><td>Collection Usage</td><td><%= item.getCollectionUsage() %></td></tr> </table> </td></tr> <tr><td colspan="2"> </td></tr> <% } %> </table> </body> </html>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
下一篇:PHP实现截取字符串的通用方法
最新资讯
热门推荐