[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 <matt@pcmus.com>
This commit is contained in:
Matthew Skinner 2021-10-09 19:16:23 +11:00 committed by GitHub
parent 61324f8b96
commit f3fbcb622f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -294,8 +294,8 @@ public class SysteminfoHandler extends BaseThingHandler {
state = new QuantityType<>(Runtime.getRuntime().freeMemory(), Units.BYTE); state = new QuantityType<>(Runtime.getRuntime().freeMemory(), Units.BYTE);
break; break;
case CHANNEL_MEMORY_USED_HEAP_PERCENT: case CHANNEL_MEMORY_USED_HEAP_PERCENT:
state = new DecimalType((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) * 100 state = new DecimalType((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())
/ Runtime.getRuntime().maxMemory()); * 100 / Runtime.getRuntime().maxMemory());
break; break;
case CHANNEL_DISPLAY_INFORMATION: case CHANNEL_DISPLAY_INFORMATION:
state = systeminfo.getDisplayInformation(deviceIndex); state = systeminfo.getDisplayInformation(deviceIndex);