Code

octo@casella:~/collectd $ svn merge -r753:807 trunk branches/processes
[collectd.git] / src / memory.c
index b1a62475161b059626902ee1c22db0d840804f05..00fd1bf9504c5430bfbc3ab352819c25bde81a47 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/memory.c
- * Copyright (C) 2005  Florian octo Forster
+ * Copyright (C) 2005,2006  Florian octo Forster
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
 #include "common.h"
 #include "plugin.h"
 
-/* TODO #include <mach/vm-stuff*> */
 #ifdef HAVE_MACH_KERN_RETURN_H
 # include <mach/kern_return.h>
 #endif
 #ifdef HAVE_MACH_MACH_INIT_H
 # include <mach/mach_init.h>
 #endif
+#ifdef HAVE_MACH_MACH_HOST_H
+# include <mach/mach_host.h>
+#endif
 #ifdef HAVE_MACH_HOST_PRIV_H
 # include <mach/host_priv.h>
 #endif
+#ifdef HAVE_MACH_VM_STATISTICS_H
+# include <mach/vm_statistics.h>
+#endif
 
 #if defined (HOST_VM_INFO) || defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT)
 # define MEMORY_HAVE_READ 1
@@ -75,7 +80,7 @@ static void memory_init (void)
 {
 #if defined(HOST_VM_INFO)
        port_host = mach_host_self ();
-       host_page_size(port_host, &pagesize);
+       host_page_size (port_host, &pagesize);
 /* #endif HOST_VM_INFO */
 
 #elif defined(KERNEL_LINUX)
@@ -160,7 +165,7 @@ static void memory_read (void)
        wired    = vm_data.wire_count     * pagesize;
        active   = vm_data.active_count   * pagesize;
        inactive = vm_data.inactive_count * pagesize;
-       free     = vm_stat.free_count     * pagesize;
+       free     = vm_data.free_count     * pagesize;
 
        memory_submit (wired + active, -1, inactive, free);
 /* #endif HOST_VM_INFO */