I've found the following code from here "http://www.boyet.com/Articles/CodeFromInternet.html".
It returns the speed of the CPU in GHz but works only on 32bit Windows.
using System;
using System.Management;
namespace CpuSpeed
{
class Program
{
static double? GetCpuSpeedInGHz()
{
double? GHz = null;
using (ManagementClass mc = new ManagementClass("Win32_Processor"))
{
foreach (ManagementObject mo in mc.GetInstances())
{
GHz = 0.001 * (UInt32) mo.Properties["CurrentClockSpeed"].Value;
break;
}
}
return GHz;
}
static void Main(string[] args)
{
Console.WriteLine("The current CPU speed is {0}", (GetCpuSpeedInGHz() ?? -1.0).ToString());
Console.ReadLine();
}
}
}
I've searched for 64bit management classes, but without success.
Is there any other method to get the CPU speed under 64bit Windows?