From f3fbcb622fba71ddd77c8114d08d3a7306ed3dc3 Mon Sep 17 00:00:00 2001 From: Matthew Skinner Date: Sat, 9 Oct 2021 19:16:23 +1100 Subject: [PATCH] [systeminfo] Fix heap graph too high on axis. (#11351) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was calculating the “used heap” based on max heap size and not on the currently allocated size. Signed-off-by: Matthew Skinner --- .../systeminfo/internal/handler/SysteminfoHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java b/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java index 866967893..05a11c5f5 100644 --- a/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java +++ b/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java @@ -294,8 +294,8 @@ public class SysteminfoHandler extends BaseThingHandler { state = new QuantityType<>(Runtime.getRuntime().freeMemory(), Units.BYTE); break; case CHANNEL_MEMORY_USED_HEAP_PERCENT: - state = new DecimalType((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) * 100 - / Runtime.getRuntime().maxMemory()); + state = new DecimalType((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) + * 100 / Runtime.getRuntime().maxMemory()); break; case CHANNEL_DISPLAY_INFORMATION: state = systeminfo.getDisplayInformation(deviceIndex);