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

Systeminformation.graphics This function will cause high CPU utilization #932

Open
BlockCnFuture opened this issue Sep 6, 2024 · 5 comments

Comments

@BlockCnFuture
Copy link

Describe the bug
When calling the Systeminformation.graphics function, especially when calling it within an interval, you will see high CPU utilization.

To Reproduce
Steps to reproduce the behavior:

  1. used function 'Systeminformation.graphics' in Interval, call it every two second

Current Output
This function will cause high CPU utilization

Expected behavior
Should not cause high CPU utilization

Environment (please complete the following information):

  • systeminformation package version: 5.22.4
  • OS: Windows 11
  • Hardware HP15L

To get all needed environment information, please run the following command:

  ┌─────────────────────────────────────────────────────────────────────────────────────────┐
│  SYSTEMINFORMATION                                                      Version: 5.22.4 │
└─────────────────────────────────────────────────────────────────────────────────────────┘

Operating System:
──────────────────────────────────────────────────────────────────────────────────────────
Platform         : Windows
Distro           : Microsoft Windows 11 专业版
Release          : 10.0.22631
Codename         :
Kernel           : 10.0.22631
Arch             : x64
Hostname         : tuzhis
Codepage         : 936
Build            : 22631
Hypervisor       :
RemoteSession    : true

System:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : HP
Model            : Victus by HP 15L Gaming Desktop TG02-2xxx
Version          :
Virtual          :

CPU:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : Intel
Brand            : Core™ i7-14700F
Family           : 6
Model            : 183
Stepping         : 1
Speed            : 2.1
Cores            : 28
PhysicalCores    : 20
PerformanceCores : 28
EfficiencyCores  :
Processors       : 1
Socket           : LGA1700

Additional context
This problem is probably caused by using promise.all to execute multiple PowerShell commands concurrently under Windows. You can change it to execute one by one. The execution will not be much slower, but the CPU utilization problem should be optimized a lot.

@sebhildebrandt
Copy link
Owner

@BlockCnFuture Yes, on Windows the overhead calling Opening a PowerShell process is really high. I do not suggest calling this every 2 seconds. I already mentioned the whole situation in this issue: #616

For version 6.0 I am working on something where we spin up a pool of PowerShell processes and they can then be used by each function ...

@TheRedfoox
Copy link

@sebhildebrandt Do you also not recommend calling every second graphics if si.powerShellStart(); is used? What is currently the right way to monitor GPU metrics every second?

@sebhildebrandt
Copy link
Owner

@TheRedfoox You are right, even when using si.powerShellStart() this is to often. This function needs a few seconds to get everything for the underlying window commands. Unfortunately this is all much slower in windows that in macOS or Linux.

@TheRedfoox
Copy link

@sebhildebrandt I did not find a way to call only some GPU metrics (only GPU usage) that allowed to lighten the call. Do you confirm to me that it is not possible at the moment or did I miss something in the document?

@sebhildebrandt
Copy link
Owner

@TheRedfoox Yes I can confirm that (for now). The only way would be probably to write C++ or C# code ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants