May 9, 2002 #2 Guest_imported New member Jan 1, 1970 0 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("%d",(ulResult.QuadPart/1000000)+3); } mhz contains the speed of your CPU Upvote 0 Downvote
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("%d",(ulResult.QuadPart/1000000)+3); } mhz contains the speed of your CPU