Project

General

Profile

« Previous | Next » 

Revision aa4c257a

Added by Andreas Kohlbecker about 13 years ago

showing memory usage

View differences:

src/main/webapp/manage/index.jsp
5 5
<%@page import="java.net.URL" %>
6 6
<%@page import="eu.etaxonomy.cdm.server.CdmInstanceProperties"%>
7 7
<%@page import="eu.etaxonomy.cdm.server.JvmManager" %>
8
<%@page import="java.io.IOException"%>
9
<%!
10
public void printMemoryUsage(java.lang.management.MemoryUsage memoryUsage, String label, String barWidth, String cssColorUsed, String cssColorMax, JspWriter writer) throws IOException{
11
	float mb = 1024 * 1024;
12
	float gb = mb * 1024;
13
    float max = memoryUsage.getMax() / mb;
14
    float used = memoryUsage.getUsed() / mb;
15
    float percent = used * 100 / max;
16
	writer.append("<span class=\"memory-usage\">").append(label + "(" + used + " of "  + max+ " MB)&nbsp;")
17
	.append("<div style=\"height: 100%; width:")
18
	.append(barWidth).append(";background-color:").append(cssColorMax).append("\">")
19
	.append("<div style=\"background-color:" + cssColorUsed + "; width:" + percent + "%\">&nbsp;</div></div></span>");
20
}
21
%>
22

  
8 23
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
9 24

  
10 25
<head>
......
43 58
								<!-- ============================= -->
44 59
								<div class="block-wrapper">
45 60
								  <h2 class="title block-title pngfix">Server Status</h2>
46
									<div class="block" id="status">JVM memory configuration: 
61
									<div class="block" id="status">
47 62
									   <% 
48
									   double mb = 1024 * 1024;
49
									   out.append("HeapMemory=").append(String.valueOf((JvmManager.getHeapMemoryUsage().getMax() / mb))).append("MB ;");
50
									   out.append("PermGenSpace=").append(String.valueOf((JvmManager.getPermGenSpaceUsage().getMax() / mb))).append("MB"); 
63
									   printMemoryUsage(JvmManager.getHeapMemoryUsage(), "HeapUsage", "100%", "#F48B65", "#65B1F4", out);
64
									   printMemoryUsage(JvmManager.getPermGenSpaceUsage(), "PermGenSpaceUsage", "100%","#F48B65", "#65B1F4", out);
51 65
									   %> 
52 66
									</div>
53 67
								</div>

Also available in: Unified diff