Dynare++: use portable C++11 primitive for detecting the number of logical processors

time-shift
Sébastien Villemot 2019-04-01 15:10:37 +02:00
parent 7e46d8267c
commit a6ff8495cd
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 5 additions and 14 deletions

View File

@ -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"

View File

@ -23,7 +23,6 @@ struct SystemResources
static long pageSize();
static long physicalPages();
static long availablePhysicalPages();
static long onlineProcessors();
static long availableMemory();
double load_avg;