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

Incorrect CPU usage on Windows #17

Open
Weilbyte opened this issue Sep 25, 2022 · 6 comments
Open

Incorrect CPU usage on Windows #17

Weilbyte opened this issue Sep 25, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@Weilbyte
Copy link

Weilbyte commented Sep 25, 2022

The CPU counter on the dashboard does not seem to be correct (at 0). Tested on Windows Server 2022 with OpenJDK 19.

@Weilbyte Weilbyte changed the title Incorrect usage counters on Windows Incorrect CPU usage on Windows Sep 25, 2022
@fugasjunior
Copy link
Owner

Thanks for the feedback. The counter seems to work normally on Windows 10, so there likely is something specific with Windows Server. I'll try to replicate the issue and fix it if possible.

@Weilbyte
Copy link
Author

Does it require certain permissions or something?

@fugasjunior
Copy link
Owner

I've just installed the latest version of the app on a Windows Server 2019 and ran It using OpenJDK 19. I wasn't able to reproduce the issue, the CPU usage is showing correct values.
image

Do you know which branch/commit were you using when you built the application? You may also try to set up the new version v0.2.0 I've just released to see if it solves the problem.

As far as I know, there should be no requirement for special permissions.

@Weilbyte
Copy link
Author

Running on the v0.2.0 release, on Windows Server 2022 under a non-admin user and CPU usage is shown as -100%. I am suspecting that this might either be due to the server running as a non-privileged user, though other than a privilege issue with creating symlinks which was fixed by a GPO edit, there have been no other issues with this.

@fugasjunior
Copy link
Owner

Thank you for the feedback! I've just tried with a non-privileged user and was able to temporarily reproduce the issue.

However, it's acting pretty random - for the first few seconds upon viewing the dashboard, the value is stuck either at -100%, 0%, or 100%. After a few seconds, though, the counter catches up and starts showing proper values. After that, even restarting the application doesn't make the issue reappear. I need to sign out of the Windows account and log back in to reproduce it again temporarily. Are you experiencing similar behavior, or does the counter not work at all?

I'll dig deeper and perhaps try adjusting the implementation of the system resource displays to avoid this issue.

@Weilbyte
Copy link
Author

Thanks for the response. The counter does not move from -100% at all.

Furthermore, I have attempted to test this by running the following program on both an administrator and an un-privileged account.

import com.sun.management.OperatingSystemMXBean;
import java.lang.management.ManagementFactory;

class test {
    public static void main(String[] args) {
        OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
        System.out.println(osBean.getCpuLoad());
    }
}

Administrator:

PS C:\srv\arma3-gui> java .\test.java
0.0

User:

PS C:\srv\arma3-gui> java .\test.java
-1.0

It appears that when running as a non-privileged user, Java is unable to retrieve the CPU usage (?).

@fugasjunior fugasjunior added the bug Something isn't working label Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants