Dynare++: use portable C++11 primitive for detecting the number of logical processors
parent
7e46d8267c
commit
a6ff8495cd
|
@ -7,6 +7,7 @@
|
|||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <limits>
|
||||
#include <thread>
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <sys/time.h> // For getrusage()
|
||||
|
@ -72,16 +73,6 @@ SystemResources::availablePhysicalPages()
|
|||
#endif
|
||||
}
|
||||
|
||||
long
|
||||
SystemResources::onlineProcessors()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return sysconf(_SC_NPROCESSORS_ONLN);
|
||||
#else
|
||||
return -1; // FIXME
|
||||
#endif
|
||||
}
|
||||
|
||||
long
|
||||
SystemResources::availableMemory()
|
||||
{
|
||||
|
@ -226,11 +217,12 @@ Journal::printHeader()
|
|||
utsname info;
|
||||
uname(&info);
|
||||
*this << info.sysname << " " << info.release << " " << info.version << " "
|
||||
<< info.machine << ", processors online: " << SystemResources::onlineProcessors();
|
||||
<< info.machine;
|
||||
#else
|
||||
*this << "(not implemented for MinGW)";
|
||||
*this << "Windows";
|
||||
#endif
|
||||
*this << "\n\nStart time: ";
|
||||
*this << ", processors online: " << std::thread::hardware_concurrency()
|
||||
<< "\n\nStart time: ";
|
||||
std::time_t t = std::time(nullptr);
|
||||
*this << std::put_time(std::localtime(&t), "%c %Z")
|
||||
<< "\n\n"
|
||||
|
|
|
@ -23,7 +23,6 @@ struct SystemResources
|
|||
static long pageSize();
|
||||
static long physicalPages();
|
||||
static long availablePhysicalPages();
|
||||
static long onlineProcessors();
|
||||
static long availableMemory();
|
||||
|
||||
double load_avg;
|
||||
|
|
Loading…
Reference in New Issue