Skip to content

Can we get the CPU and Memory use? #414

Answered by timsneath
rocboronat asked this question in Q&A
Discussion options

You must be logged in to vote

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

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by timsneath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #413 on April 21, 2022 16:09.