Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CPU Speed

Status
Not open for further replies.

lGOOODl

Programmer
Dec 4, 2001
31
DK
How can i get the speed of my cpu ?

Thx
GOOOD
 
Try this this should work
if not let me know.

void cyourclass::CPUSPEED()
{
LARGE_INTEGER ulFreq,
ulTicks,
ulValue,
ulStartCounter,
ulEAX_EDX,
ulResult;

QueryPerformanceFrequency(&ulFreq);
QueryPerformanceCounter(&ulTicks);
ulValue.QuadPart = ulTicks.QuadPart + ulFreq.QuadPart;

__asm RDTSC
__asm mov ulEAX_EDX.LowPart, EAX
__asm mov ulEAX_EDX.HighPart, EDX
ulStartCounter.QuadPart = ulEAX_EDX.QuadPart;

do
{

QueryPerformanceCounter(&ulTicks);
}
while( ulTicks.QuadPart <= ulValue.QuadPart) ;


__asm RDTSC
__asm mov ulEAX_EDX.LowPart, EAX
__asm mov ulEAX_EDX.HighPart,EDX

ulResult.QuadPart = ulEAX_EDX.QuadPart - ulStartCounter.QuadPart;
CString mhz;
mhz.Format(&quot;%d&quot;,(ulResult.QuadPart/1000000)+3);

}

mhz contains the speed of your CPU
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top