'System.Diagnostics.PerformanceCounter current CPU usage in GHz

I need the information of the current CPU usage in GHz as the Task Manager shows is under Performance in the Speed variable.

Is it possible to get this information from the method?

I need it in Matlab by the way.

I was hoping to use this function for it:

Show CPU cores utilization in MATLAB

Thanks.



Solution 1:[1]

So, the answer is:

obj = System.Diagnostics.PerformanceCounter('Processor Information', '% Processor Performance', '_Total');

current_frequency = obj.NextValue * base_frequency;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Romaxx