return the amount of physical memory */
| 220 | return the amount of physical memory |
| 221 | */ |
| 222 | static ulonglong my_getphysmem() |
| 223 | { |
| 224 | #ifdef _WIN32 |
| 225 | MEMORYSTATUSEX memstatus; |
| 226 | memstatus.dwLength= sizeof(memstatus); |
| 227 | GlobalMemoryStatusEx(&memstatus); |
| 228 | return memstatus.ullTotalPhys; |
| 229 | #else |
| 230 | ulonglong pages= 0; |
| 231 | |
| 232 | #ifdef _SC_PHYS_PAGES |
| 233 | pages= sysconf(_SC_PHYS_PAGES); |
| 234 | #endif |
| 235 | |
| 236 | #ifdef _SC_PAGESIZE |
| 237 | return pages * sysconf(_SC_PAGESIZE); |
| 238 | #else |
| 239 | return pages * my_getpagesize(); |
| 240 | #endif |
| 241 | #endif |
| 242 | } |
| 243 | |
| 244 | /* get the number of (online) CPUs */ |
| 245 | int my_getncpus() |
no test coverage detected