diff options
author | Richard Braun <rbraun@sceen.net> | 2013-01-12 16:23:09 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-01-12 16:23:09 +0100 |
commit | 3081d01a686922957fa298a3101f3cb1e8200ce7 (patch) | |
tree | 094e2b0227dd1d3badc0db82a98d8cb7503a87ff /rootdir.c | |
parent | 1b7ad5c5d601b6388f0fc871b4fa42d231c05400 (diff) |
Report VM cache size in meminfo
* rootdir.c: Include <mach/gnumach.h> and <mach/vm_cache_statistics.h>.
(rootdir_gc_meminfo): Call vm_cache_statistics and return the VM cache size.
Diffstat (limited to 'rootdir.c')
-rw-r--r-- | rootdir.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -17,8 +17,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <mach/gnumach.h> #include <mach/vm_param.h> #include <mach/vm_statistics.h> +#include <mach/vm_cache_statistics.h> #include <mach/default_pager.h> #include <hurd/paths.h> #include <stdio.h> @@ -263,6 +265,7 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) host_basic_info_data_t hbi; mach_msg_type_number_t cnt; struct vm_statistics vmstats; + struct vm_cache_statistics cache_stats; default_pager_info_t swap; error_t err; @@ -270,6 +273,10 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) if (err) return EIO; + err = vm_cache_statistics (mach_task_self (), &cache_stats); + if (err) + return EIO; + cnt = HOST_BASIC_INFO_COUNT; err = host_info (mach_host_self (), HOST_BASIC_INFO, (host_info_t) &hbi, &cnt); if (err) @@ -294,7 +301,7 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) (long unsigned) hbi.memory_size / 1024, (long unsigned) vmstats.free_count * PAGE_SIZE / 1024, 0, - 0, + (long unsigned) cache_stats.cache_count * PAGE_SIZE / 1024, (long unsigned) vmstats.active_count * PAGE_SIZE / 1024, (long unsigned) vmstats.inactive_count * PAGE_SIZE / 1024, (long unsigned) vmstats.wire_count * PAGE_SIZE / 1024, |