Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[systeminfo] memory#availableHeap reports wrong values #13709

Closed
UrsusS opened this issue Nov 13, 2022 · 7 comments
Closed

[systeminfo] memory#availableHeap reports wrong values #13709

UrsusS opened this issue Nov 13, 2022 · 7 comments
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@UrsusS
Copy link

UrsusS commented Nov 13, 2022

OH 3.4.0.M4
After having used the UI configuration for the systeminfo thing, the reported value for available heap is much to low.
Before with M3 (and textual config), the values have been around 50 - 120 MB, now it is ~ 2.1E-16 MB.

This happens on my both machines where I've upgraded and changed the kind of configuration.

grafik

@mherwege
Copy link
Contributor

@UrsusS Did you try removing the state description? The value should show in Bytes by default. I tested on a RPi 4 with Java OpenJDK 11.0.16 and it works correctly for me.
What operating system and linux version did you test with?
The code retrieving this was not touched in the most recent PR's to this binding.

@UrsusS
Copy link
Author

UrsusS commented Nov 18, 2022

The item was defined as:
Number:DataAmount num_Server_Heap_Available "Verfügbarer Heap Speicher [%d MB]" <none> (gSystemInfo, gRestoreOnStartup, gLog, gDel1M) {channel="systeminfo:computer:kopf:memory#availableHeap"}
changing it to
Number:DataAmount num_Server_Heap_Available "" <none> (gSystemInfo, gRestoreOnStartup, gLog, gDel1M) {channel="systeminfo:computer:kopf:memory#availableHeap"}
gives a very high number in Byte.

version: 3.4.0.M4
javaVersion: 11.0.16
javaVendor: Raspbian
osName: Linux
osVersion: 5.15.76-v7l+

@mherwege
Copy link
Contributor

Does the value in Bytes correspond to the available heap? I know it is a high value. This code has not changed. The only thing I can see is that there have been quite a few changes to units in core.
Did you try %.0f MB as a state description?
@J-N-K Is there a chance that conversion from Bytes to MBytes using a state description broke in one way or the other with M4?

@UrsusS
Copy link
Author

UrsusS commented Nov 22, 2022

Hard to say if these values correspond to the available heap. The value isn't constant, it is highly fluctuating.
%.0f MB didn't solve it, I just get 0 MB

@mherwege
Copy link
Contributor

I tested once more, and the issue is not with the binding, but with the unit conversion from B to MB. This is outside of the binding. I defined a Number:DataAmount item linked to this channel. If you use %0.f %unit% as a state description, it correctly shows the available heap in bytes. You can use the used heap % channel and see it go up/down with the available heap. But replacing that with %0.f MB does indeed show 0 MB as a result. So the unit conversion does not work.
I then tried creating a Number:DataAmount item, not linked to any channel and manually set a value. I tried changing the state description, but it never did the conversion correctly.
@lolodomo, @J-N-K do you have any view on this?

@lolodomo
Copy link
Contributor

The issue should be fixed with OH 3.4 milestone 6. can you confirm @UrsusS ?

@lolodomo lolodomo added the bug An unexpected problem or unintended behavior of an add-on label Dec 12, 2022
@lolodomo
Copy link
Contributor

@UrsusS : please reopen in case it is not fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

No branches or pull requests

3 participants