mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Display VM Heap sizes in Admin System Properties.
Sort System Properties. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2065 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package org.alfresco.web.ui.common.component.debug;
|
package org.alfresco.web.ui.common.component.debug;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component which displays the system properties of the VM
|
* Component which displays the system properties of the VM
|
||||||
@@ -36,8 +37,34 @@ public class UISystemProperties extends BaseDebugComponent
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.web.ui.common.component.debug.BaseDebugComponent#getDebugData()
|
* @see org.alfresco.web.ui.common.component.debug.BaseDebugComponent#getDebugData()
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public Map getDebugData()
|
public Map getDebugData()
|
||||||
{
|
{
|
||||||
return System.getProperties();
|
// note: sort properties
|
||||||
|
Map properties = new TreeMap();
|
||||||
|
|
||||||
|
// add the jvm system properties
|
||||||
|
Map systemProperties = System.getProperties();
|
||||||
|
properties.putAll(systemProperties);
|
||||||
|
|
||||||
|
// add heap size properties
|
||||||
|
properties.put("heap.size", formatBytes(Runtime.getRuntime().totalMemory()));
|
||||||
|
properties.put("heap.maxsize", formatBytes(Runtime.getRuntime().maxMemory()));
|
||||||
|
properties.put("heap.free", formatBytes(Runtime.getRuntime().freeMemory()));
|
||||||
|
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to format bytes for human output
|
||||||
|
*
|
||||||
|
* @param bytes bytes
|
||||||
|
* @return formatted string
|
||||||
|
*/
|
||||||
|
private static String formatBytes(long bytes)
|
||||||
|
{
|
||||||
|
float f = bytes / 1024l;
|
||||||
|
f = f / 1024l;
|
||||||
|
return String.format("%.3f MB (%d bytes)", f, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user