Arithmetic with WMI Command Type?
Anyone know if there is a way to do arithmetic with WMI type command or is it just plain WMI? I could technically use Powershell just trying to avoid adding an extra layer of abstraction.
For context, I am trying to solve the issue of Windows not properly reporting CPU usage, from taking a look at the data available in
Win32_PerfFormattedData_PerfOS_Processor
even though the usage isn't always accurate from my observation the Idle time does seem to be, which means I should be able to abstract the Usage % by using 100 - PercentIdleTIme
. Again, I could technically also do this within HA just sending it the straight Idle time, just extra steps for the same goal ๐14 Replies
Help us Help Others!
To help others find answers, you can mark your question as solved via
Right click solution message -> Apps -> โ
Mark Solution
Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here.
Please provide us with the version number of your client.
You can find it in the HA device info page after 'Firmware'.
@Amadeo
I find it interesting it's reporting the wrong usage in the first place ๐ค
Is it the same as resource monitor or cpu-z
Hard to capture as the agent doesn't necessarily have a "live view" but opened sensors the moment before I took this SS:
It seems to be a common thing, it was reported on the previous repo for the agent but the issue was closed as it wasn't an issue with the perfmon of the agent, just that the perfmon method used is inaccurate:
https://github.com/LAB02-Research/HASS.Agent/issues/177
Seems to have started in Win11 22H2
https://answers.microsoft.com/en-us/windows/forum/all/cpu-usage-dropped-to-5-during-gaming-after/e4b80ef6-be5a-42de-8b94-2bbaa4178778
GitHub
Bug: CpuLoad sensor reports incorrect values on Windows 11 22H2 ยท I...
Please make sure your bug isn't already listed on HASS.Agent's issue tracker: https://lab02research.youtrack.cloud/ There's a list of open bugs & features on the right. On the left ...
Just to clarify also, in my SS it shows 0 for the agent, but it isn't always 0, it fluctuates around 0-5%, but definitely not the 10%+/- it should be ๐
That's really weird. I think I have heard of this before, don't know of a fix though. It's obvsly an issue with the library we use to get the usage. So not a huge amount we can do, apart from switching libs, or adding an offset box
Wmi is pure wmi afaik
Yeah thought so
And regarding the bug, I've fixed (at least if memory serves me right) a general bug with perfomance sensors where getvalue was called twice - but I'll double check if it was correctly merged when we moved to the fork
I'm on work delegation tho so asap for this will be sunday the soonest
OK cool thanks, I will just handle the math in powershell or within HA.
I am happy to be wrong but I believe fetching the value twice is seperate, from observation it looks like the registry value being fetched matches, it's just that the reg value doesn't match what Task Manager/Perf Monitor reports. Again, I could be wrong on the reason, I just know as-is they don't match up so I did some digging ๐
@Amadeo what ended up happening here? Just so i can mark solution
The issue I mentioned was correctly moved to fork although this might be that win11 issue that os referenved in the gh issue link
Since I have win10 it'll be hard to peproduce - but I'm going to try to figure out what msi afterburned did with the update
Might be hard tho ๐