CPU & RAM
Blitz3D Forums/Blitz3D Programming/CPU & RAM
| ||
Are there any commands to get the avaiable RAM and the CPU usage? |
| ||
Not built in (that i know of) but you could probably get this info from a kernel32 call or something. Check in the decls section in the codearcs |
| ||
heres how to get the memory info without decls... memstatus = createbank(31) mem = calldll("kernel32.dll","GlobalMemoryStatus",memstatus) availableMemory = peekint(memstatus,12) / 1024 / 1024 Print "Available Physical Memory: "+ availableMemory + "MB" Waitkey() End |
| ||
peekint(memstatus,0) = info len peekint(memstatus,4) = Memory Load (in percent) peekint(memstatus,8) = Total Physical (you can also get this from the callDll return value (mem)) peekint(memstatus,12) = Available Physical Memory peekint(memstatus,16) = Total Page File peekint(memstatus,20) = Available Page File peekint(memstatus,24) = Total Virtual peekint(memstatus,28) = Available Virtual |
| ||
Getting CPU usage could be tricky as I am not aware of any standard API function for returning this (except by using performance monitors and not everyone has that enabled) |
| ||
http://www.blitzbasic.com/codearcs/codearcs.php?code=403 |
| ||
Yeah but I can all but guarantee you that DLL (which probably uses the 2-3 different enum process and cumulative process useage methods to get the data) will not work on a good number of people PCs... even if you use all 5 methods including undocumented/depreciated functions in ntdll.dll you will still unfortunatly not be able to guarantee it works on all clients machines. |
| ||
Thanks guys :P |