Changeset: 702b55cbad26 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=702b55cbad26
Modified Files:
        NT/monetdb_config.h.in
        gdk/gdk_posix.c
Branch: Apr2012
Log Message:

Implemented MT_getrss() on Windows.


diffs (46 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -168,6 +168,9 @@
 /* Define to 1 if you have the `getopt_long' function. */
 /* #undef HAVE_GETOPT_LONG */
 
+/* Define to 1 if you have the `GetProcessMemoryInfo' function. */
+#define HAVE_GETPROCESSMEMORYINFO 1
+
 /* Define to 1 if you have the `getrlimit' function. */
 /* #undef HAVE_GETRLIMIT */
 
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -735,12 +735,17 @@ MT_init_posix(void)
 size_t
 MT_getrss(void)
 {
+#ifdef HAVE_GETPROCESSMEMORYINFO
+       PROCESS_MEMORY_COUNTERS ctr;
+
+       if (GetProcessMemoryInfo(GetCurrentProcess(), &ctr, sizeof(ctr)))
+               return ctr.WorkingSetSize;
+#elif defined(HAVE_PROCFS_H) && defined(__sun__)
+       /* retrieve RSS the Solaris way (2.6+) */
        static char MT_mmap_procfile[128] = { 0 };
        int fd;
+       psinfo_t psbuff;
 
-#if defined(HAVE_PROCFS_H) && defined(__sun__)
-       /* retrieve RSS the Solaris way (2.6+) */
-       psinfo_t psbuff;
        if (MT_mmap_procfile[0] == 0) {
                /* getpid returns pid_t, cast to long to be sure */
                sprintf(MT_mmap_procfile, "/proc/%ld/psinfo", (long) getpid());
@@ -755,6 +760,8 @@ MT_getrss(void)
        }
 #else
        /* get RSS  -- linux only for the moment */
+       static char MT_mmap_procfile[128] = { 0 };
+       int fd;
 
        if (MT_mmap_procfile[0] == 0) {
                /* getpid returns pid_t, cast to long to be sure */
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to