unsigned long long Platform_Windows::MemoryInstalled() { unsigned long long physicalMemory = 0; GetPhysicallyInstalledSystemMemory(&physicalMemory); physicalMemory *= 1024; return physicalMemory; }
ccReturn ccSysinfoInitialize(void) { SYSTEM_INFO sysinfo; MEMORYSTATUSEX memstat; memstat.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&memstat); ccAssert(_ccSysinfo == NULL); ccMalloc(_ccSysinfo, sizeof(ccSysinfo)); if(GetPhysicallyInstalledSystemMemory(&_ccSysinfo->ramTotal) == FALSE) goto fail; _ccSysinfo->ramTotal <<= 10; GetSystemInfo(&sysinfo); _ccSysinfo->processorCount = sysinfo.dwNumberOfProcessors; _ccSysinfo->fileMaxOpen = _getmaxstdio(); return CC_SUCCESS; fail: free(_ccSysinfo); return CC_FAIL; }
SystemInfo::PlatformData::PlatformData() { ULONGLONG ram; if (GetPhysicallyInstalledSystemMemory(&ram) == TRUE) { totalRam = static_cast<size_t>(ram) * 1024; } }
void currentSystemMemoryInformation() { unsigned long long installedMemory = 0; GetPhysicallyInstalledSystemMemory(&installedMemory); MEMORYSTATUSEX memstatus; memstatus.dwLength = sizeof(memstatus); GlobalMemoryStatusEx(&memstatus); printf("\nInstalled Memory : %lld Gigabytes",((installedMemory/1024)/1024)); printf("\nPhysical Usable memory %lld, Gigabytes",((memstatus.ullTotalPhys/1024)/1024)); printf("\nCurrent memory in use : %d%", memstatus.dwMemoryLoad); printf("\nPage Size : %d", sysInfo.dwPageSize); // Page Size }
//Get the system information and print everything on screen (and in the log file) void GameDebugger::GetSystemSpecs(ALLEGRO_DISPLAY* mydisplay) { GetSystemInfo(&SystemInfo); struct tm* mytime = GetDateAndTime(); fprintf(OutputFile, "-- START OF LOG FILE --\nTIMESTAMP: %02i/%02i/%02i - %02i:%02i:%02i\n\n",1+mytime->tm_mday, 1+mytime->tm_mon, 1900+mytime->tm_year, mytime->tm_hour, mytime->tm_min, mytime->tm_sec); GetPhysicallyInstalledSystemMemory(&pMemory); myMemory.dwLength = sizeof(myMemory); GlobalMemoryStatus(&myMemory); fprintf(OutputFile, "-- SYSTEM SPECS --\n\n"); fprintf(OutputFile, "CPU: %s\n", cpuInstInfo.cpusignature); fprintf(OutputFile, "Cores: %i\n", SystemInfo.dwNumberOfProcessors); #ifdef _DEBUG printf("-- SYSTEM SPECS --\n\n"); printf("CPU: %s\n", cpuInstInfo.cpusignature); printf("Cores: %i\n", SystemInfo.dwNumberOfProcessors); #endif if(cpuInstInfo.PFLAGS.PYSICAL_ADDRESS_E) { fprintf(OutputFile, "Physical Address Extension (PAE) Available (x86_64)\n"); #ifdef _DEBUG printf("Physical Address Extension (PAE) Available (x86_64)\n"); #endif } fprintf(OutputFile, "Other processor extensions: "); printf("Other processor extensions: "); if(cpuInstInfo.PFLAGS.LONGMODE) { fprintf(OutputFile, "lm "); #ifdef _DEBUG printf("lm "); #endif } if(cpuInstInfo.PFLAGS.MMX_INSTRUCTIONS) { fprintf(OutputFile, "mmx "); #ifdef _DEBUG printf("mmx "); #endif } if(cpuInstInfo.PFLAGS.EXT_MMX) { fprintf(OutputFile, "mmxext "); #ifdef _DEBUG printf("mmxext "); #endif } if(cpuInstInfo.PFLAGS.B3DNOW) { fprintf(OutputFile, "3dnow "); #ifdef _DEBUG printf("3dnow "); #endif } if(cpuInstInfo.PFLAGS.EXT_3DNOW) { fprintf(OutputFile, "3dnowext "); #ifdef _DEBUG printf("3dnowext "); #endif } if(cpuInstInfo.PFLAGS.MULTIPROCESSOR_CAPABLE) { fprintf(OutputFile, "mp "); #ifdef _DEBUG printf("mp "); #endif } fprintf(OutputFile, "\n\n -- RAM INFORMATION -- \n\n"); fprintf(OutputFile, "Physical RAM: %I64u Mb\n",pMemory/1024); fprintf(OutputFile, "Available RAM: %i Mb\n",myMemory.dwAvailPhys / 1024 / 1024); fprintf(OutputFile, "Total PageFile: %i Mb\n",myMemory.dwTotalPageFile / 1024 / 1024); fprintf(OutputFile, "Available PageFile: %i Mb\n",myMemory.dwAvailPageFile / 1024 / 1024); fprintf(OutputFile, "Total Virtual Memory: %i Mb\n",myMemory.dwTotalVirtual / 1024 / 1024); fprintf(OutputFile, "Available Virtual Memory: %i Mb\n",myMemory.dwAvailVirtual / 1024 / 1024); #ifdef _DEBUG printf("\n\n -- RAM INFORMATION -- \n\n"); printf("Physical RAM: %I64u Mb\n",pMemory/1024); printf("Available RAM: %i Mb\n",myMemory.dwAvailPhys / 1024 / 1024); printf("Total PageFile: %i Mb\n",myMemory.dwTotalPageFile / 1024 / 1024); printf("Available PageFile: %i Mb\n",myMemory.dwAvailPageFile / 1024 / 1024); printf("Total Virtual Memory: %i Mb\n",myMemory.dwTotalVirtual / 1024 / 1024); printf("Available Virtual Memory: %i Mb\n",myMemory.dwAvailVirtual / 1024 / 1024); #endif if(IsD3D(mydisplay)) { #ifdef _DEBUG printf("Using Direct 3D\n"); #endif fprintf(OutputFile, "Using Direct 3D\n"); GetD3DInfo(mydisplay); }else{ #ifdef _DEBUG printf("Using OpenGL 3D\n"); #endif fprintf(OutputFile, "Using OpenGL\n"); GetGLInfo(mydisplay); } return; }