sebhildebrandt / systeminformation

System Information Library for Node.JS
MIT License
2.7k stars 307 forks source link

CPU currentLoad completly off on windows #900

Open gltched-usr opened 6 months ago

gltched-usr commented 6 months ago

Describe the bug When calling the currentLoad() function the currentLoad value is completly off. I checked task manager and it says 42% load while the currentLoad value I get is ~6.134.

I understand that there can be a difference but it shouldn't be that much off.

To Reproduce Code I used:

setInterval(() => {
    getSystemInfo();
}, 1000) // tried also 5s, 10s, even 30s with same result

async function getSystemInfo() {
    try {
        const cpu = await si.currentLoad()
        //console.log(cpu)

        const cpuInfo = {
            cpuLoad: cpu.currentLoad
        };
        console.log(cpuInfo)
    } catch (error) {
        logger.error('Error:', error);
    }
}

Current Output

{ cpuLoad: 3.5504885993485344 }
{ cpuLoad: 2.9962546816479403 }
{ cpuLoad: 3.4767528284746883 }
{ cpuLoad: 3.116947884631369 }
{ cpuLoad: 3.8537064310260187 }
{ cpuLoad: 2.844856103208733 }
{ cpuLoad: 2.9877998174122333 }
{ cpuLoad: 6.137479541734861 }

Environment (please complete the following information):

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

  npx systeminformation info

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

Operating System:
──────────────────────────────────────────────────────────────────────────────────────────
Platform         : Windows
Distro           : Microsoft Windows 11 Pro
Release          : 10.0.22631
Codename         :
Kernel           : 10.0.22631
Arch             : x64
Hostname         : DESKTOP-8O4DG3J
Codepage         : 850
Build            : 22631
Hypervisor       : true
RemoteSession    :

System:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : Micro-Star International Co., Ltd
Model            : MS-7B86
Version          : 2.0
Virtual          :

CPU:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : AMD
Brand            : Ryzen 5 3600 6-Core Processor
Family           : 23
Model            : 113
Stepping         : 0
Speed            : 3.6
Cores            : 12
PhysicalCores    : 6
PerformanceCores : 12
EfficiencyCores  :
Processors       : 1
Socket           : AM4
gltched-usr commented 5 months ago

@sebhildebrandt Do you have any updates on this? I found out that scaling the output with 9 or 10 provides way closer results (downside is sometimes this produces values above 100)

strukteon commented 5 months ago

I am having the same problem

myesn commented 3 weeks ago

same+1 image