how to get the processor type and speed of the user?
i tried the GetSystemInfo(...) but can''t seem to figure out the way there,
i would like to use a Win32API for this, thanks!!
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
CPUID, dunno about speed.
---visit #directxdev on afternet <- not just for directx, despite the name
There is no system property for speed, you''re going to have to write a program to measure it (run something like DXDiag, will give your CPU speed within a few mhz).
You can find a name in the registry under HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\VendorIdentifier. It is a string and contains GenuineIntel (no space) for Intel and AuthenticAMD (again no space) AMD. There are seeral other codes that you can find on the net. It is easier than using CPUID.
Check out other value in that key cuz there are things like ~Mhz and Identifier and name.
quote: Original post by Puzzler183
Check out other value in that key cuz there are things like ~Mhz and Identifier and name.
On a standard windows machine the information you can find is:
VendorIdentifier (ie. "GenuineIntel")
Identifier (ie. "x86 Family 6 Model 8 Stepping 6")
Update Status (a numeric value)
If you want information on what information is accessable about a processor read this article, ''cuz'' the CPU speed is not something that is reported by the chip, the only way to get the mhz is either 1) through a special program written for your specific motherboard or 2) by making a rough estimation, as programs like DXDiag do. With the right algorithm you can be within a 1-3 mhz of the exact speed.
DWORD GetCpuSpeed(){ DWORD dwStartTicks = 0; DWORD dwEndTicks = 0; DWORD dwTotalTicks = 0; DWORD dwCpuSpeed = 0; // check for high-resolution timer LARGE_INTEGER qwFrequency = {0}; if(QueryPerformanceFrequency(&qwFrequency) && qwFrequency.QuadPart > 0) { LARGE_INTEGER qwStart = {0}; LARGE_INTEGER qwStop = {0}; // 1. step - get start ticks QueryPerformanceCounter(&qwStart); for(;;) { QueryPerformanceCounter(&qwStop); if((qwStop.QuadPart - qwStart.QuadPart) * 1000 / qwFrequency.QuadPart > 1) { __asm { xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx _emit 0x0f // CPUID _emit 0xa2 _emit 0x0f // RDTSC _emit 0x31 mov [dwStartTicks], eax } break; } } qwStart.QuadPart = qwStop.QuadPart; // 2. step - get end ticks after 1000 ms for(;;) { QueryPerformanceCounter(&qwStop); if((qwStop.QuadPart - qwStart.QuadPart) / qwFrequency.QuadPart >= 1) { __asm { xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx _emit 0x0f // CPUID _emit 0xa2 _emit 0x0f // RDTSC _emit 0x31 mov [dwEndTicks], eax } break; } } } else { DWORD dwStart = 0; DWORD dwStop = 0; // 1. step - get start ticks dwStart = GetTickCount(); for(;;) { dwStop = GetTickCount(); if((dwStop - dwStart) > 1) // ROLLOVER PAST 1 { __asm { xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx _emit 0x0f // CPUID _emit 0xa2 _emit 0x0f // RDTSC _emit 0x31 mov [dwStartTicks], eax } break; } } dwStart = dwStop; // 2. step - get end ticks after 1000 ms for(;;) { dwStop = GetTickCount(); if((dwStop - dwStart) >= 1000) { __asm { xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx _emit 0x0f // CPUID _emit 0xa2 _emit 0x0f // RDTSC _emit 0x31 mov [dwEndTicks], eax } break; } } } // compute result dwTotalTicks = dwEndTicks - dwStartTicks; dwCpuSpeed = dwTotalTicks / 1000000; // MHz return(dwCpuSpeed);}
Oh I''m sorry Michaelson. If my using "cuz" instead of "because" made the post hard for you to read or you had some other problem, you should have let me know cuz I owuld have changed it for you.
thanks guys,
i followed the sample on the MSDN, but i had a problem using the
RegQueryValueEx(hKey,
"~MHZ",
NULL,
NULL,
(LPBYTE)speed,
&dwBufLen);
because MHZ is not a string but a hex number, so how would i go fixin'' this?
i followed the sample on the MSDN, but i had a problem using the
RegQueryValueEx(hKey,
"~MHZ",
NULL,
NULL,
(LPBYTE)speed,
&dwBufLen);
because MHZ is not a string but a hex number, so how would i go fixin'' this?
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement