arma-server-manager icon indicating copy to clipboard operation
arma-server-manager copied to clipboard

Incorrect CPU usage on Windows

Open Weilbyte opened this issue 3 years ago • 6 comments

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

Weilbyte avatar Sep 25 '22 01:09 Weilbyte

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.

fugasjunior avatar Sep 25 '22 07:09 fugasjunior

Does it require certain permissions or something?

Weilbyte avatar Sep 25 '22 11:09 Weilbyte

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.

fugasjunior avatar Sep 25 '22 13:09 fugasjunior

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.

Weilbyte avatar Sep 26 '22 15:09 Weilbyte

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.

fugasjunior avatar Sep 26 '22 16:09 fugasjunior

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 (?).

Weilbyte avatar Sep 26 '22 18:09 Weilbyte