From: Matthew Skinner Date: Sat, 9 Oct 2021 08:16:23 +0000 (+1100) Subject: [systeminfo] Fix heap graph too high on axis. (#11351) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=f3fbcb622fba71ddd77c8114d08d3a7306ed3dc3;p=openhab-addons.git [systeminfo] Fix heap graph too high on axis. (#11351) Was calculating the “used heap” based on max heap size and not on the currently allocated size. Signed-off-by: Matthew Skinner --- 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 866967893c..05a11c5f51 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);