0

I heard that WMI is being deprecated . Some say get-WMIObject is deprecated. What should I use to get System statistics like CPU usage , RAM etc USING C++. https://learn.microsoft.com/en-us/windows/win32/winrm/winrm-c---api "OR" https://learn.microsoft.com/en-us/windows/win32/wmisdk/com-api-for-wmi

I will be getting statistics of local computer. I am confused what to use WMI or WINRM or GET-CIMINSTANCE for c++.

Any other way to get those statistics using C++ (for both Windows/Linux) is also appreciated.

  • 2
    Here is a good read that underlines WMI, CIM and OMI. https://www.petri.com/what-is-the-difference-between-wmi-and-cim – Suraj S May 22 '20 at 10:51
  • I read that already. I want to get system info using C++. The link says use Get CIMinstance and not Get WMI object. But I belive only WMI com API is exposed. How can I use GET-CIMinstance in C++. Or shall I continue using COM WMI API even though the link you mentioned says GET WMI OBJECT is deprecated – Metoirite Shower May 22 '20 at 11:44

1 Answers1

0

Specifically for CPU usage, there's GetSystemTimes().

In general, consider using performance counter API.

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281