added getTotalSystemMemory() function
parent
d1638ca45c
commit
ccad33b21d
|
@ -114,6 +114,9 @@ extern MTS_EXPORT_CORE std::string getHostName();
|
||||||
/// Return the process private memory usage in bytes
|
/// Return the process private memory usage in bytes
|
||||||
extern MTS_EXPORT_CORE size_t getPrivateMemoryUsage();
|
extern MTS_EXPORT_CORE size_t getPrivateMemoryUsage();
|
||||||
|
|
||||||
|
/// Returns the total amount of memory available to the OS
|
||||||
|
extern MTS_EXPORT_CORE size_t getTotalSystemMemory();
|
||||||
|
|
||||||
/// Return the fully qualified domain name of this machine
|
/// Return the fully qualified domain name of this machine
|
||||||
extern MTS_EXPORT_CORE std::string getFQDN();
|
extern MTS_EXPORT_CORE std::string getFQDN();
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,19 @@ int getCoreCount() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t getTotalSystemMemory() {
|
||||||
|
#if defined(__WINDOWS__)
|
||||||
|
MEMORYSTATUSEX status;
|
||||||
|
status.dwLength = sizeof(status);
|
||||||
|
GlobalMemoryStatusEx(&status);
|
||||||
|
return (size_t) status.ullTotalPhys;
|
||||||
|
#else
|
||||||
|
size_t pages = sysconf(_SC_PHYS_PAGES);
|
||||||
|
size_t page_size = sysconf(_SC_PAGE_SIZE);
|
||||||
|
return pages * page_size;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
size_t getPrivateMemoryUsage() {
|
size_t getPrivateMemoryUsage() {
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
PROCESS_MEMORY_COUNTERS_EX pmc;
|
PROCESS_MEMORY_COUNTERS_EX pmc;
|
||||||
|
|
|
@ -2079,6 +2079,7 @@ void export_core() {
|
||||||
bp::def("getCoreCount", &getCoreCount);
|
bp::def("getCoreCount", &getCoreCount);
|
||||||
bp::def("getHostName", &getHostName);
|
bp::def("getHostName", &getHostName);
|
||||||
bp::def("getPrivateMemoryUsage", &getPrivateMemoryUsage);
|
bp::def("getPrivateMemoryUsage", &getPrivateMemoryUsage);
|
||||||
|
bp::def("getTotalSystemMemory", &getTotalSystemMemory);
|
||||||
bp::def("getFQDN", &getFQDN);
|
bp::def("getFQDN", &getFQDN);
|
||||||
bp::def("rdtsc", &rdtsc);
|
bp::def("rdtsc", &rdtsc);
|
||||||
bp::def("hypot2", &hypot2);
|
bp::def("hypot2", &hypot2);
|
||||||
|
|
Loading…
Reference in New Issue