Can we get the CPU and Memory use? #414
-
Hello 👋 Here's just a question. I've checked the readme and it sounds like the quick answer is "no", but I'm guessing if there's a way to get the % of CPU and memory being used. Feel free to just say no and close the issue if that's the case, and thanks for your time! 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi there! You should be able to do this; Windows provides a variety of APIs for getting this data. Perhaps the easiest choice is via WMI: There's an example of executing a WMI query that you could adapt here: Update: also see the new example, here: |
Beta Was this translation helpful? Give feedback.
Hi there!
You should be able to do this; Windows provides a variety of APIs for getting this data.
Perhaps the easiest choice is via WMI:
https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmi-performance-counter-types
There's an example of executing a WMI query that you could adapt here:
https://github.com/timsneath/win32/blob/main/example/wmi_wql.dart
Update: also see the new example, here:
https://github.com/timsneath/win32/blob/main/example/wmi_perf.dart