List of usage examples for java.lang Runtime totalMemory
public native long totalMemory();
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Get the total memory available to the JVM. * @return see above./* w w w . java 2 s. c o m*/ */ public static long getTotalMemory() { Runtime r = Runtime.getRuntime(); return r.totalMemory(); }
From source file:org.apache.tez.dag.app.TestMockDAGAppMaster.java
private void checkMemory(String name, MockDAGAppMaster mockApp) { long mb = 1024 * 1024; //Getting the runtime reference from system Runtime runtime = Runtime.getRuntime(); System.out.println("##### Heap utilization statistics [MB] for " + name); runtime.gc();/* ww w. j a va2 s .c o m*/ //Print used memory System.out.println("##### Used Memory:" + (runtime.totalMemory() - runtime.freeMemory()) / mb); //Print free memory System.out.println("##### Free Memory:" + runtime.freeMemory() / mb); //Print total available memory System.out.println("##### Total Memory:" + runtime.totalMemory() / mb); //Print Maximum available memory System.out.println("##### Max Memory:" + runtime.maxMemory() / mb); }
From source file:com.inverse2.ajaxtoaster.AjaxToasterServlet.java
private void returnHealth(HttpServletResponse response) throws Exception { StringBuffer healthInfo = new StringBuffer(); healthInfo.append("AjaxToaster version " + getVersion() + "<br>"); healthInfo.append("Using XMLToaster version " + com.inverse2.xmltoaster.Version.getVersion() + "<br>"); healthInfo.append("Properties file name [" + propertiesPath + "]<br>"); healthInfo.append("Script directory [" + scriptPath + "]<br>"); healthInfo.append("Logging method [" + loggingType + "]<br>"); healthInfo.append("Sleep interval [" + sleepInterval + "]<br>"); healthInfo.append("<br>"); healthInfo.append(serviceMapper.getURIMappings().replaceAll("\\n", "<br>")); healthInfo.append("<br>"); healthInfo.append("List of operations available;<br><br>"); List<ServiceOperationInfo> serviceList = servicePool.getOperationInfo(); ServiceOperationInfo operation;//from w w w . jav a 2 s .c o m for (Iterator<ServiceOperationInfo> it = serviceList.iterator(); it.hasNext();) { operation = it.next(); healthInfo.append("-- " + operation.getServiceName() + "/" + operation.getOperationName() + "<br>"); } Runtime rt = Runtime.getRuntime(); healthInfo.append("<br>JVM: Total Mem [" + rt.totalMemory() + "], Free Mem [" + rt.freeMemory() + "], Max Mem [" + rt.maxMemory() + "]<br>"); writeResponse(healthInfo.toString(), "HTML", null, response); }
From source file:fedora.server.management.DefaultManagement.java
private void finishModification(DOWriter w, String method) throws ServerException { if (w != null) { m_manager.releaseWriter(w);/*from w w w.j a v a 2 s. co m*/ } if (LOG.isDebugEnabled()) { LOG.debug("Exiting " + method); Runtime r = Runtime.getRuntime(); LOG.debug("Memory: " + r.freeMemory() + " bytes free of " + r.totalMemory() + " available."); } }
From source file:com.aurel.track.itemNavigator.ItemNavigatorAction.java
private long getUsedMemory() { Runtime rt = Runtime.getRuntime(); long mbyte = 1024L * 1024; return (rt.totalMemory() - rt.freeMemory()) / mbyte; }
From source file:com.aurel.track.itemNavigator.ItemNavigatorAction.java
private void checkMemory(long usedOld) { Runtime rt = Runtime.getRuntime(); long mbyte = 1024L * 1024; long used = (rt.totalMemory() - rt.freeMemory()) / mbyte; if (rt.freeMemory() / mbyte < 100) { LOGGER.warn("Less than 100 MByte free memory available."); }//from w ww . j av a 2 s. co m LOGGER.debug("Used memory Delta: " + (used - usedOld) + " MByte"); LOGGER.debug("Used memory total: " + used + " MByte"); }
From source file:org.fcrepo.server.management.DefaultManagement.java
private void finishModification(DOWriter w, String method) throws ServerException { if (w != null) { m_manager.releaseWriter(w);//from w w w . ja v a 2 s . c om } if (logger.isDebugEnabled()) { logger.debug("Exiting " + method); Runtime r = Runtime.getRuntime(); logger.debug("Memory: " + r.freeMemory() + " bytes free of " + r.totalMemory() + " available."); } }
From source file:ffx.potential.MolecularAssembly.java
/** * {@inheritDoc}/*from www . jav a2 s .c om*/ */ @Override public void finalize(boolean finalizeGroups, ForceField forceField) { setFinalized(false); if (finalizeGroups) { bondTime = 0; angleTime = 0; stretchBendTime = 0; ureyBradleyTime = 0; outOfPlaneBendTime = 0; torsionTime = 0; piOrbitalTorsionTime = 0; torsionTorsionTime = 0; ArrayList Polymers = getAtomNodeList(); for (ListIterator li = Polymers.listIterator(); li.hasNext();) { MSGroup group = (MSGroup) li.next(); if (logger.isLoggable(Level.FINE)) { logger.fine(" Finalizing bonded terms for polymer " + group.toString()); } try { group.finalize(true, forceField); } catch (Exception e) { String message = "Fatal exception finalizing " + group.toString(); logger.log(Level.SEVERE, message, e); System.exit(-1); } if (logger.isLoggable(Level.FINE)) { Runtime runtime = Runtime.getRuntime(); long occupiedMemory = runtime.totalMemory() - runtime.freeMemory(); long MB = 1024 * 1024; logger.fine("\n In-Use Memory (Mb): " + occupiedMemory / MB + "\n Free Memory (Mb): " + runtime.freeMemory() / MB + "\n Total Memory (Mb): " + runtime.totalMemory() / MB); } } for (MSNode m : molecules.getChildList()) { Molecule molecule = (Molecule) m; molecule.finalize(true, forceField); } for (MSNode m : water.getChildList()) { Molecule molecule = (Molecule) m; molecule.finalize(true, forceField); } for (MSNode m : ions.getChildList()) { Molecule molecule = (Molecule) m; molecule.finalize(true, forceField); } if (logger.isLoggable(Level.FINE)) { StringBuilder sb = new StringBuilder("\n Time to create bonded energy terms\n\n"); sb.append(String.format(" Bond Streching %10.3f\n", bondTime * 1.0e-9)); sb.append(String.format(" Angle Bending %10.3f\n", angleTime * 1.0e-9)); sb.append(String.format(" Stretch-Bend %10.3f\n", stretchBendTime * 1.0e-9)); sb.append(String.format(" Urey-Bradley %10.3f\n", ureyBradleyTime * 1.0e-9)); sb.append(String.format(" Out-of-Plane Bend %10.3f\n", outOfPlaneBendTime * 1.0e-9)); sb.append(String.format(" Torsionanl Angle %10.3f\n", torsionTime * 1.0e-9)); sb.append(String.format(" Pi-Orbital Torsion %10.3f\n", piOrbitalTorsionTime * 1.0e-9)); sb.append(String.format(" Torsion-Torsion %10.3f\n", torsionTorsionTime * 1.0e-9)); logger.fine(sb.toString()); } } if (!java.awt.GraphicsEnvironment.isHeadless()) { createScene(!finalizeGroups); center(); } removeLeaves(); setFinalized(true); }
From source file:edu.stanford.muse.util.Util.java
public static String getMemoryStats() { Runtime r = Runtime.getRuntime(); System.gc();/*from w w w . ja v a 2 s .c o m*/ int MB = 1024 * 1024; return r.freeMemory() / MB + " MB free, " + (r.totalMemory() / MB - r.freeMemory() / MB) + " MB used, " + r.maxMemory() / MB + " MB max, " + r.totalMemory() / MB + " MB total"; }
From source file:de.hpi.fgis.hdrs.node.Node.java
@Override public NodeStatus getNodeStatus() { Runtime rt = Runtime.getRuntime(); return new NodeStatus(rt.freeMemory() + (rt.maxMemory() - rt.totalMemory()), bufferSize.get(), conf.getInt(Configuration.KEY_NODE_TRANSACTION_BUFFER, Configuration.DEFAULT_NODE_TRANSACTION_BUFFER) - transactionMemPool.availablePermits(), segments.size(), transactions.size(), scanners.size()); }