Sorry for the long overwhelming post, I tried to provide EVERYTHING I did that made me reach to making this post. I hope this isn't too much to ask, I wanted to remake the Task Manager CPU performance window with Rainmeter for funnies but I ran into a few things which I think would be nice to have in Rainmeter by default, at least on SysInfo.
The thing is, for everything I'm requesting, all of this can already be done with Powershell, thus this is not urgent, or impossible, but because of how much stuff you have possible right now without complicating yourself, I'm running into a few problems (which will be detailed below).
Sooo... for what I made - stuff that dosen't exist in Rainmeter but I wish they did since they were very easy to get - I used the following Powershell commands
So why am I requesting this if I can already do everything with Powershell? 2 primary things
I've tried to look for the API calls that can be used to get the same counters as above for this this:
The thing is, for everything I'm requesting, all of this can already be done with Powershell, thus this is not urgent, or impossible, but because of how much stuff you have possible right now without complicating yourself, I'm running into a few problems (which will be detailed below).
Sooo... for what I made - stuff that dosen't exist in Rainmeter but I wish they did since they were very easy to get - I used the following Powershell commands
- Processor Name (Get-CimInstance Win32_Processor).Name
- Utilization (Get-CimInstance Win32_Processor).LoadPercentage
- Processes (Get-Process | Measure-Object).Count
- Threads (Get-Process | % { $_.Threads.Count } | Measure-Object -Sum).Sum
- Handles (Get-Process | % { $_.Handles } | Measure-Object -Sum).Sum
- Base speed (Get-CimInstance Win32_Processor).CurrentClockSpeed
- Current Voltage (Get-CimInstance Win32_Processor).CurrentVoltage
- Cores (Get-CimInstance Win32_Processor).NumberOfEnabledCore
- Logical Cores (Get-CimInstance Win32_Processor).NumberOfLogicalProcessors
- L2 cache (Get-CimInstance Win32_Processor).L2CacheSize
- L3 cache (Get-CimInstance Win32_Processor).L3CacheSize
- Virtualization (Get-CimInstance Win32_Processor).VirtualizationFirmwareEnabled
So why am I requesting this if I can already do everything with Powershell? 2 primary things
- On the very first update, the measures will always be nil.
- I am aware that you can save some of the info that never changes to to a file, or only run the measures once, or hide everything until it returns anything, I have an OnRefreshAction that runs for those things that never change and stay the same (like the Processor Name, Cores, Cache Size). Preferably you would not want to write this info to a file if you're something like repair shop though.
- For stuff that needs constant updating, like the number of Processes, Handles and Threads, RunCommand and pwsh is KILLING my CPU and I keep getting the Error 101: Program still running: powershell for commands that, even when measured with Measure-Command with a result smaller than 1000 milliseconds, I still get the error, at a point it just desync without reason.
- My suspicion is that for what I'm doing, pwsh first has to create the process, create an instance, read the instance, update the instance, parse the instance and then kill the instance and then the child... process, which is most likely why the graph keeps showing those spikes, and most likely why it ends up desync-ing.
- So... what if we make a script that always runs and never disposes the object? With this code my CPU is flat, so that most likely means the spikes happen because Rainmeter opens and kills a process every second (and probably because Roslyn is smart enough to not dispose of the object here). I am aware that I can use the Command Line Arguments here going forward, but this is reaching the complexity that I mentioned earlier that I didn't wanna reach
Code:
do { Write-Host (Get-Process | % { $_.Handles } | Measure-Object -Sum).Sum Sleep 1} while ($true)
I've tried to look for the API calls that can be used to get the same counters as above for this this:
- For Processes, Threads, Handles both NtQuerySystemInformation's SystemProcessInformation and System.Diagnostics.Process can be used
- For everything else, I wasn't able to find something easy, the only thing I found is that you need to create a ManagementObject to get the WMI/CIM instance, in C# you can do and then parse that variable to get the necessary info.
Code:
var searcher = new ManagementObjectSearcher("select * from Win32_Processor")
Statistics: Posted by Jeff — Today, 3:53 pm — Replies 1 — Views 28