Commit 57ecdd66 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Added memory management and more vm info.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1101 b35dd754-fafc-0310-a699-88a17e54d16e
parent c28300f0
......@@ -490,6 +490,7 @@ index.jvm=JVM Version and Vendor:
index.app=Appserver:
index.os=OS / Hardware:
index.local=Locale / Timezone:
index.memory=Java Memory
# Locale Page
......
......@@ -439,6 +439,7 @@ index.jvm=JVM \u7248\u672c\u548c\u4f9b\u5e94\u5546\uff1a
index.app=Appserver:
index.os=OS\uff0f\u786c\u4ef6\uff1a
index.local=\u8bed\u8a00\u73af\u5883\uff0f\u65f6\u533a\uff1a
index.memory=Java Memory
# Locale Page
......
......@@ -75,6 +75,11 @@
else { checked = true; return true; }
}
</script>
<style type="text/css">
.bar TD {
padding : 0px;
}
</style>
<form action="index.jsp" onsubmit="return checkClick();">
<div class="jive-table">
......@@ -209,7 +214,16 @@
<tr>
<td class="c1"><fmt:message key="index.jvm" /></td>
<td class="c2">
<%= System.getProperty("java.version") %> <%= System.getProperty("java.vendor") %>
<%
String vmName = System.getProperty("java.vm.name");
if (vmName == null) {
vmName = "";
}
else {
vmName = " -- " + vmName;
}
%>
<%= System.getProperty("java.version") %> <%= System.getProperty("java.vendor") %><%= vmName %>
</td>
</tr>
<tr>
......@@ -231,6 +245,63 @@
(<%= (JiveGlobals.getTimeZone().getRawOffset()/1000/60/60) %> GMT)
</td>
</tr>
<tr>
<td><fmt:message key="index.memory" /></td>
<td>
<% // The java runtime
Runtime runtime = Runtime.getRuntime();
double freeMemory = (double)runtime.freeMemory()/(1024*1024);
double maxMemory = (double)runtime.maxMemory()/(1024*1024);
double totalMemory = (double)runtime.totalMemory()/(1024*1024);
double usedMemory = totalMemory - freeMemory;
double percentFree = ((maxMemory - usedMemory)/maxMemory)*100.0;
double percentUsed = 100 - percentFree;
int percent = 100-(int)Math.round(percentFree);
DecimalFormat mbFormat = new DecimalFormat("#0.00");
DecimalFormat percentFormat = new DecimalFormat("#0.0");
%>
<table cellpadding="0" cellspacing="0" border="0" width="300">
<tr valign="middle">
<td width="99%" valign="middle">
<div class="bar">
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="border:1px #666 solid;">
<tr>
<% if (percent == 0) { %>
<td width="100%"><img src="images/percent-bar-left.gif" width="100%" height="8" border="0" alt=""></td>
<% } else { %>
<% if (percent >= 90) { %>
<td width="<%= percent %>%" background="images/percent-bar-used-high.gif"
><img src="images/blank.gif" width="1" height="8" border="0" alt=""></td>
<% } else { %>
<td width="<%= percent %>%" background="images/percent-bar-used-low.gif"
><img src="images/blank.gif" width="1" height="8" border="0" alt=""></td>
<% } %>
<td width="<%= (100-percent) %>%" background="images/percent-bar-left.gif"
><img src="images/blank.gif" width="1" height="8" border="0" alt=""></td>
<% } %>
</tr>
</table>
</div>
</td>
<td width="1%" nowrap>
<div style="padding-left:6px;">
<%= mbFormat.format(usedMemory) %> MB of <%= mbFormat.format(maxMemory) %> MB (<%= percentFormat.format(percentUsed) %>%) used
</div>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment