edit based on comments

This commit is contained in:
Rohith Nair 2017-05-17 17:46:10 +02:00
parent b95f4fb6a0
commit 59ec8a1bf5

View File

@ -24,10 +24,6 @@
#define OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
#include <sys/utsname.h>
#include <unistd.h>
#include <ctime>
#include <sys/statvfs.h>
#include <sys/sysinfo.h>
#include <opm/simulators/ParallelFileMerger.hpp>
#include <opm/simulators/ensureDirectoryExists.hpp>
@ -334,24 +330,20 @@ namespace Opm
}
void printPRTHeader()
{
if ( output_cout_ )
{
// Print header for PRT file.
if ( output_cout_ ) {
const std::string version = moduleVersionName();
const double megabyte = 1024 * 1024;
unsigned num_cpu = std::thread::hardware_concurrency();
struct utsname arch;
char userName[64] = {0};
int getUser = getlogin_r(userName, sizeof(userName)-1);
const char* user = getlogin();
time_t now = std::time(0);
struct tm tstruct;
char tmstr[80];
tstruct = *localtime(&now);
strftime(tmstr, sizeof(tmstr), "%d-%m-%Y at %X", &tstruct);
struct sysinfo info;
sysinfo( &info );
const double mem_size = (size_t)info.totalram * (size_t)info.mem_unit / megabyte;
const double mem_size = getTotalSystemMemory() / megabyte;
std::ostringstream ss;
ss << "\n\n\n ######## # ###### # #\n";
ss << " # # # # # # \n";
@ -367,9 +359,8 @@ namespace Opm
ss << "Architecture = " << arch.sysname << " " << arch.machine << " (Release: " << arch.release;
ss << ", Version: " << arch.version << " )\n";
}
if (getUser == 0) {
char * userLogin = getlogin();
ss << "User = " << userLogin << std::endl;
if (user) {
ss << "User = " << user << std::endl;
}
ss << "Simulation started on " << tmstr << " hrs\n";
OpmLog::note(ss.str());
@ -779,6 +770,12 @@ namespace Opm
throw std::invalid_argument( "Cannot find input case " + casename );
}
unsigned long long getTotalSystemMemory()
{
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
return pages * page_size;
}
int64_t convertMessageType(const Message::type& mtype)
{