/** * Calculates the average memory consumption by updating the stored information with * the provided current information.<p> * * @param currentStatus the memory status to update the average with */ public void calculateAverage(CmsMemoryStatus currentStatus) { int newCount = m_count + 1; m_maxMemory = ((m_count * m_maxMemory) + currentStatus.getMaxMemory()) / newCount; m_totalMemory = ((m_count * m_totalMemory) + currentStatus.getTotalMemory()) / newCount; m_usedMemory = ((m_count * m_usedMemory) + currentStatus.getUsedMemory()) / newCount; m_freeMemory = ((m_count * m_freeMemory) + currentStatus.getFreeMemory()) / newCount; m_usage = (m_usedMemory * 100) / m_maxMemory; m_count = newCount; }
/** * Calculates the average memory consumption by updating the stored information with * the provided current information.<p> * * @param currentStatus the memory status to update the average with */ public void calculateAverage(CmsMemoryStatus currentStatus) { int newCount = m_count + 1; m_maxMemory = ((m_count * m_maxMemory) + currentStatus.getMaxMemory()) / newCount; m_totalMemory = ((m_count * m_totalMemory) + currentStatus.getTotalMemory()) / newCount; m_usedMemory = ((m_count * m_usedMemory) + currentStatus.getUsedMemory()) / newCount; m_freeMemory = ((m_count * m_freeMemory) + currentStatus.getFreeMemory()) / newCount; m_usage = m_usedMemory * 100 / m_maxMemory; m_count = newCount; }
new Long(m_memoryCurrent.getTotalMemory()), new Long(m_memoryCurrent.getFreeMemory()), new Long(m_memoryCurrent.getUsedMemory()), new Long(m_memoryCurrent.getUsage()), new Integer(m_maxUsagePercent)})); new Long(m_memoryCurrent.getTotalMemory()), new Long(m_memoryCurrent.getFreeMemory()), new Long(m_memoryCurrent.getUsedMemory()), new Long(m_memoryCurrent.getUsage()), new Integer(m_maxUsagePercent), new Long(m_memoryAverage.getTotalMemory()), new Long(m_memoryAverage.getFreeMemory()), new Long(m_memoryAverage.getUsedMemory()), new Long(m_memoryAverage.getUsage()), new Integer(m_memoryAverage.getCount())}));
new Long(m_memoryCurrent.getTotalMemory()), new Long(m_memoryCurrent.getFreeMemory()), new Long(m_memoryCurrent.getUsedMemory()), new Long(m_memoryCurrent.getUsage()), new Integer(m_maxUsagePercent)})); new Long(m_memoryCurrent.getTotalMemory()), new Long(m_memoryCurrent.getFreeMemory()), new Long(m_memoryCurrent.getUsedMemory()), new Long(m_memoryCurrent.getUsage()), new Integer(m_maxUsagePercent), new Long(m_memoryAverage.getTotalMemory()), new Long(m_memoryAverage.getFreeMemory()), new Long(m_memoryAverage.getUsedMemory()), new Long(m_memoryAverage.getUsage()), new Integer(m_memoryAverage.getCount())}));
+ " mb\n\n" + "Memory currently used : " + m_memoryCurrent.getUsedMemory() + " mb (" + m_memoryCurrent.getUsage()