Getting Systeminformations
-
Hi, do someone know how to get Systeminformations (like Memory Usage, Device Information, CPU, Totalmemory) in Win32 C++ under WindowsXP / Windows 98 / Linux ? My Ideas: CPU With an Highresolutiontimer i can calculate the CPU Speed (MHz) but not the Facturer... I have found some sources for older cpus, but i can't detect newer ones and neither special attributes like do they use mmx or sse2... VGA With OpenGL I can retrieve Informations about the graphic adapter like extentions, current videomode. But I need Informations of video buffers (do they supply quadbuffer for iGlasses?) or video memory (128MB DDR, 93.2 MB free) Thanks alot for reading this, may be there is anyone who can help me...
Sendel
-
Hi, do someone know how to get Systeminformations (like Memory Usage, Device Information, CPU, Totalmemory) in Win32 C++ under WindowsXP / Windows 98 / Linux ? My Ideas: CPU With an Highresolutiontimer i can calculate the CPU Speed (MHz) but not the Facturer... I have found some sources for older cpus, but i can't detect newer ones and neither special attributes like do they use mmx or sse2... VGA With OpenGL I can retrieve Informations about the graphic adapter like extentions, current videomode. But I need Informations of video buffers (do they supply quadbuffer for iGlasses?) or video memory (128MB DDR, 93.2 MB free) Thanks alot for reading this, may be there is anyone who can help me...
Sendel
You can get most system information you want. Here's a way of calculating CPU speed. It's not 100% accurate but close enough: #pragma warning( disable: 4035 ) inline unsigned __int64 GetCycleCount() { _asm { _emit 0x0F _emit 0x31 } } #pragma warning( default: 4035 ) int GetCPUSpeed() { Sleep( 0 ); const unsigned __int64 ui64StartCycle = GetCycleCount(); Sleep( 1000 ); return static_cast( ( GetCycleCount() - ui64StartCycle ) / 1000000 ); }
-
You can get most system information you want. Here's a way of calculating CPU speed. It's not 100% accurate but close enough: #pragma warning( disable: 4035 ) inline unsigned __int64 GetCycleCount() { _asm { _emit 0x0F _emit 0x31 } } #pragma warning( default: 4035 ) int GetCPUSpeed() { Sleep( 0 ); const unsigned __int64 ui64StartCycle = GetCycleCount(); Sleep( 1000 ); return static_cast( ( GetCycleCount() - ui64StartCycle ) / 1000000 ); }
That's what i have done already, so what i have is: Have: CPU Speed, Graphiccard Vendor, Driver Information, current Videomode, supported extentions Need: CPU Vendor, CPU Supported Chipsets (mmx, sse etc), Total Physical System memory, Free Physical System Memory, Graphiccard Total Video Memory, Graphiccard Free Video Memory, Graphiccard Memory Type (DDR, SGRAM, SDRAM...), Graphiccard supported Buffers (Quadbuffer, Front/Back Buffer, GBuffer, TBuffer,...), Graphiccard supported Videomodes But thanks alot for your help !
Sendel
-
That's what i have done already, so what i have is: Have: CPU Speed, Graphiccard Vendor, Driver Information, current Videomode, supported extentions Need: CPU Vendor, CPU Supported Chipsets (mmx, sse etc), Total Physical System memory, Free Physical System Memory, Graphiccard Total Video Memory, Graphiccard Free Video Memory, Graphiccard Memory Type (DDR, SGRAM, SDRAM...), Graphiccard supported Buffers (Quadbuffer, Front/Back Buffer, GBuffer, TBuffer,...), Graphiccard supported Videomodes But thanks alot for your help !
Sendel
Sendel wrote: Need: CPU Vendor, CPU Supported Chipsets (mmx, sse etc), Perhaps this helps you: http://www.codeproject.com/system/camel.asp[^] Sendel wrote: Total Physical System memory, Free Physical System Memory http://codeproject.com/system/computerinfo.asp[^] Detecting Graphiccard things is a bit harder. Have you tried the DirectX API? -Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;) -
Sendel wrote: Need: CPU Vendor, CPU Supported Chipsets (mmx, sse etc), Perhaps this helps you: http://www.codeproject.com/system/camel.asp[^] Sendel wrote: Total Physical System memory, Free Physical System Memory http://codeproject.com/system/computerinfo.asp[^] Detecting Graphiccard things is a bit harder. Have you tried the DirectX API? -Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;)This is my solution: i don't know where I found this source, but its quite good: and with comments ;-P
#include #pragma comment(lib, "winmm.lib") DWORD GetCPUSpeed() { LARGE_INTEGER ulFreq, ulTicks, ulValue, ulStartCounter, ulEAX_EDX; // Query for high-resolution counter frequency (this is not the CPU frequency): if (QueryPerformanceFrequency(&ulFreq)) { // Query current value: QueryPerformanceCounter(&ulTicks); // Calculate end value (one second interval); this is (current + frequency) ulValue.QuadPart = ulTicks.QuadPart + ulFreq.QuadPart; // Read CPU time-stamp counter: __asm RDTSC // And save in ulEAX_EDX: __asm mov ulEAX_EDX.LowPart, EAX __asm mov ulEAX_EDX.HighPart, EDX // Store starting counter value: ulStartCounter.QuadPart = ulEAX_EDX.QuadPart; // Loop for one second (measured with the high-resolution counter): do { QueryPerformanceCounter(&ulTicks); } while (ulTicks.QuadPart <= ulValue.QuadPart); // Now again read CPU time-stamp counter: __asm RDTSC // And save: __asm mov ulEAX_EDX.LowPart, EAX __asm mov ulEAX_EDX.HighPart, EDX DWORD tmp = (DWORD) ((ulEAX_EDX.QuadPart - ulStartCounter.QuadPart) / 1000000); timediff = tmp/10000000.0*0.001; // Calculate number of cycles done in interval; 1000000 Hz = 1 MHz return tmp; } else { // No high-resolution counter present: return 0; } }
Thanks for all information,=Sendel=