mirror of
https://git.freebsd.org/ports.git
synced 2025-06-17 18:50:33 -04:00
economic models, in particular dynamic stochastic general equilibrium (DSGE) and overlapping generations (OLG) models. WWW: http://www.dynare.org PR: ports/160153 Submitted by: Fernando <fernando.apesteguia@gmail.com>
53 lines
1.2 KiB
Text
53 lines
1.2 KiB
Text
--- 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 <sys/types.h>
|
|
+#include <sys/sysctl.h>
|
|
|
|
#if !defined(__MINGW32__)
|
|
# include <sys/resource.h>
|
|
@@ -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;
|
|
}
|
|
|
|
@
|