Changeset: e2eb48ad9c81 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e2eb48ad9c81
Modified Files:
configure.ag
gdk/ChangeLog.Apr2012
gdk/gdk_posix.c
Branch: Apr2012
Log Message:
MT_getrss: implemented for Darwin
diffs (67 lines):
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2323,6 +2323,8 @@ AC_CHECK_HEADERS([crypt.h \
limits.h \
locale.h \
mach-o/dyld.h \
+ mach/mach_init.h \
+ mach/task.h \
malloc.h \
netdb.h \
netinet/in.h \
@@ -2605,6 +2607,8 @@ AC_CHECK_FUNCS([\
strtoll \
strtoull \
sysconf \
+ task_for_pid \
+ task_info \
times \
trunc \
uname \
diff --git a/gdk/ChangeLog.Apr2012 b/gdk/ChangeLog.Apr2012
--- a/gdk/ChangeLog.Apr2012
+++ b/gdk/ChangeLog.Apr2012
@@ -1,3 +1,7 @@
# ChangeLog file for MonetDB
# This file is updated with Maddlog
+* Fri Apr 27 2012 Fabian Groffen <[email protected]>
+- Implemented MT_getrss for Mac OS X systems, this allows the server to
+ know about how much memory is currently in use.
+
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -47,6 +47,12 @@ extern char *sbrk(int);
#ifdef HAVE_PROCFS_H
# include <procfs.h>
#endif
+#ifdef HAVE_MACH_TASK_H
+# include <mach/task.h>
+#endif
+#ifdef HAVE_MACH_MACH_INIT_H
+# include <mach/mach_init.h>
+#endif
#if defined(DEBUG_ALLOC) && SIZEOF_VOID_P > 4
#undef DEBUG_ALLOC
@@ -758,8 +764,17 @@ MT_getrss(void)
}
close(fd);
}
+#elif defined(HAVE_TASK_INFO) && defined(HAVE_TASK_FOR_PID)
+ /* Darwin/MACH call for process' RSS */
+ task_t task = MACH_PORT_NULL;
+ struct task_basic_info t_info;
+ mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
+
+ if (task_for_pid(current_task(), getpid(), &task) == KERN_SUCCESS &&
+ task_info(task, TASK_BASIC_INFO, (task_info_t)&t_info,
&t_info_count) != KERN_INVALID_POLICY)
+ return t_info.resident_size;
#else
- /* get RSS -- linux only for the moment */
+ /* get RSS on Linux */
static char MT_mmap_procfile[128] = { 0 };
int fd;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list