From c3c89d335e72d6be226e431eb83b9b8fe772c21f Mon Sep 17 00:00:00 2001 From: Will Ezell Date: Fri, 20 Dec 2024 10:33:18 -0500 Subject: [PATCH] minor(memoryReport) make the free memory report what is left available to the jvm (#30948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: #30947 This now looks right, where `Free Memory = Total Memory - Filled Memory` ![Screenshot 2024-12-13 at 9 45 03 PM](https://github.com/user-attachments/assets/cba314d9-8ffb-4097-9e27-b6d5e7e90b67) --- .../ext/cmsmaintenance/cachestats_guava.jsp | 30 +++++++++++++------ .../cmsmaintenance/view_cms_maintenance.jsp | 19 ++++++++---- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/cachestats_guava.jsp b/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/cachestats_guava.jsp index 9368a093bd80..65734bb021a2 100644 --- a/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/cachestats_guava.jsp +++ b/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/cachestats_guava.jsp @@ -22,32 +22,44 @@ <%}%> + +<% + + long maxMemory = Runtime.getRuntime().maxMemory(); + long totalMemoryInUse = Runtime.getRuntime().totalMemory(); + long freeMemory = Runtime.getRuntime().freeMemory(); + long usedMemory = totalMemoryInUse - freeMemory; + long availableMemory = maxMemory - usedMemory; + +%> + +
- - - - - - - -
<%= LanguageUtil.get(pageContext, "Total-Memory-Available") %> + <%= LanguageUtil.get( pageContext, "Total-Memory-Available" ) %> / Xmx <%=UtilMethods.prettyByteify(Runtime.getRuntime().maxMemory())%> + <%=UtilMethods.prettyByteify( maxMemory )%>
<%= LanguageUtil.get(pageContext, "Memory-Allocated") %> + <%= LanguageUtil.get( pageContext, "Memory-Allocated" ) %> <%= UtilMethods.prettyByteify(Runtime.getRuntime().totalMemory())%> + <%= UtilMethods.prettyByteify( totalMemoryInUse )%>
<%= LanguageUtil.get(pageContext, "Filled-Memory") %> + <%= LanguageUtil.get( pageContext, "Filled-Memory" ) %> <%= UtilMethods.prettyByteify(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())%> + <%= UtilMethods.prettyByteify( usedMemory )%>
<%= LanguageUtil.get(pageContext, "Free-Memory") %> + <%= LanguageUtil.get( pageContext, "Free-Memory" ) %> <%= UtilMethods.prettyByteify(Runtime.getRuntime().freeMemory())%> + <%= UtilMethods.prettyByteify( availableMemory )%>
@@ -95,4 +107,4 @@ dojo.ready(function() { -
\ No newline at end of file + diff --git a/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/view_cms_maintenance.jsp b/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/view_cms_maintenance.jsp index b2695f06a601..5ee3f7470cb9 100644 --- a/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/view_cms_maintenance.jsp +++ b/dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/view_cms_maintenance.jsp @@ -1295,31 +1295,40 @@ dd.leftdl {
+ <% + + long maxMemory = Runtime.getRuntime().maxMemory(); + long totalMemoryInUse = Runtime.getRuntime().totalMemory(); + long freeMemory = Runtime.getRuntime().freeMemory(); + long usedMemory = totalMemoryInUse - freeMemory; + long availableMemory = maxMemory - usedMemory; + + %>
- - - - -
<%= LanguageUtil.get( pageContext, "Total-Memory-Available" ) %> + <%= LanguageUtil.get( pageContext, "Total-Memory-Available" ) %> / Xmx <%=UtilMethods.prettyByteify( Runtime.getRuntime().maxMemory() )%> + <%=UtilMethods.prettyByteify( maxMemory )%>
<%= LanguageUtil.get( pageContext, "Memory-Allocated" ) %> <%= UtilMethods.prettyByteify( Runtime.getRuntime().totalMemory() )%> + <%= UtilMethods.prettyByteify( totalMemoryInUse )%>
<%= LanguageUtil.get( pageContext, "Filled-Memory" ) %> <%= UtilMethods.prettyByteify( Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() )%> + <%= UtilMethods.prettyByteify( usedMemory )%>
<%= LanguageUtil.get( pageContext, "Free-Memory" ) %> <%= UtilMethods.prettyByteify( Runtime.getRuntime().freeMemory() )%> + <%= UtilMethods.prettyByteify( availableMemory )%>