1 17 package org.alfresco.web.ui.common.component.debug; 18 19 import java.util.Map ; 20 import java.util.TreeMap ; 21 22 27 public class UISystemProperties extends BaseDebugComponent 28 { 29 32 public String getFamily() 33 { 34 return "org.alfresco.faces.debug.SystemProperties"; 35 } 36 37 40 @SuppressWarnings ("unchecked") 41 public Map getDebugData() 42 { 43 Map properties = new TreeMap (); 45 46 Map systemProperties = System.getProperties(); 48 properties.putAll(systemProperties); 49 50 properties.put("heap.size", formatBytes(Runtime.getRuntime().totalMemory())); 52 properties.put("heap.maxsize", formatBytes(Runtime.getRuntime().maxMemory())); 53 properties.put("heap.free", formatBytes(Runtime.getRuntime().freeMemory())); 54 55 return properties; 56 } 57 58 64 private static String formatBytes(long bytes) 65 { 66 float f = bytes / 1024l; 67 f = f / 1024l; 68 return String.format("%.3fMB (%d bytes)", f, bytes); 69 } 70 } 71 | Popular Tags |