代码语言:javascript复制
<%
String TomUserType = (String) session.getAttribute("TomUserType");
if ("1".equals(TomUserType)) {
float fFreeMemory=(float)Runtime.getRuntime().freeMemory();
float fTotalMemory=(float)Runtime.getRuntime().totalMemory();
float fUsedMemory = fTotalMemory - fFreeMemory;
float fPercent=fFreeMemory/fTotalMemory*100;
%>
<h3>系统状态</h3>
<ul class="ilist">
<li>服务器名:<%= request.getServerName() %>(<%=request.getRemoteAddr()%>)</li>
<li>
内存消耗:<%=fUsedMemory/1024/1024%>M / <%=fTotalMemory/1024/1024%>M
<div style="width:200px; height:10px; background:#f00; font-size:1px">
<div style="float:right; background:#0f0; width:<%=(int)(fPercent*2)%>px; font-size:1px; height:10px"></div>
</div>
</li>
<li>操作系统:<%=System.getProperty("os.name") %></li>
<li>JDK版本:<%=System.getProperty("java.version") %></li>
</ul>
<%}%>