Spirosi
Spirosi

Reputation: 324

How to get current CPU clock speed same as in Task Manager?

How to get current CPU clock speed the same as in Task Manager? WMI CurrentClockSpeed returns the value that is less or equal than MaxClockSpeed and not exactly the same as Task Manager's clock speed.

Upvotes: 0

Views: 1475

Answers (2)

John Lin
John Lin

Reputation: 21

It's coming from the PerformanceCounter by importing the System.Diagnostics module. Please refer to the link for the code example. Just change the parameter to get the value from "Processor Information", "% Processor Performance" and then calculate the CPU frequency by the equation CPU Frequency = "% Processor Performance" * Processor base Frequency. You could use the Windows build-in application "Performance Monitor" to check more PerformanceCounter indexes to find what you want.

Upvotes: 2

rfmodulator
rfmodulator

Reputation: 3738

Because the clock speed changes so frequently, much quicker than Task Manager is updating, you're unlikely to ever get the same value.

Upvotes: 1

Related Questions