--- dynare++/kord/journal.cweb.orig 2011-08-21 20:56:09.000000000 +0200 +++ dynare++/kord/journal.cweb 2011-08-21 23:02:31.000000000 +0200 @@ -5,6 +5,8 @@ @c #include "journal.h" #include "kord_exception.h" +#include +#include #if !defined(__MINGW32__) # include @@ -72,7 +74,16 @@ @<|SystemResources::availableMemory| code@>= long int SystemResources::availableMemory() { - return pageSize()*sysconf(_SC_AVPHYS_PAGES); + long value; + size_t len; + char *path = "vm.stats.vm.v_free_count"; + + if (sysctlbyname(path, &value, &len, NULL, 0) == -1) { + return (-1); + } + + + return pageSize() * value; } @ Here we read the current values of resource usage. For MinGW, we @@ -84,6 +95,10 @@ long int& idrss, long int& majflt) { struct timeval now; + long value; + size_t len; + char *path = "vm.stats.vm.v_free_count"; + gettimeofday(&now, NULL); elapsed = now.tv_sec-start.tv_sec + (now.tv_usec-start.tv_usec)*1.0e-6; @@ -107,7 +122,11 @@ load_avg = -1.0; #endif - pg_avail = sysconf(_SC_AVPHYS_PAGES); + if (sysctlbyname(path, &value, &len, NULL, 0) == -1) { + pg_avail = -1; + } + + pg_avail = value; } @