-1

Hi is it possible to get the speed (MHz) to which a CPU has been overclocked to using VB.net?

I have tried the "Win32 Processor class" but can only get the rated CPU speed from that.

Any idea how to get this?

Thanks

Raider_007
  • 29
  • 5
  • This question appears to be [off topic](http://stackoverflow.com/help/on-topic). – Jørgen R Jan 13 '16 at 13:01
  • Uhh, `CurrentClockSpeed` should give you the current clock speed, even if it is overclocked. Overclocking happens at a very low level. It is not usually detectable by software. – Cody Gray - on strike Jan 13 '16 at 13:40
  • how about [measure it with `rdtsc` instruction versus known time](https://stackoverflow.com/a/21548494/2521214) like `PerformanceCounter` or any other. if asm is not accessible in VB you can create DLL and link it to it ... – Spektre Nov 29 '21 at 08:43

1 Answers1

0

This is not possible using this class.

How to make it working

long lError = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                    "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
                    0,
                    KEY_READ,
                    &hKey);

if(lError != ERROR_SUCCESS)
  {// if the key is not found, tell the user why:
       FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
                     NULL,
                     lError,
                     0,
                     Buffer,
                     _MAX_PATH,
                     0);
           AfxMessageBox(Buffer);
       return "N/A";
   }

    // query the key:
    RegQueryValueEx(hKey, "~MHz", NULL, NULL, (LPBYTE) &dwMHz, &BufSize);

// convert the DWORD to a CString:
sMHz.Format("%i", dwMHz);

return sMHz;

siranen
  • 374
  • 1
  • 11