From 6918396adb8b018d6b67ebe38c9a7759285f66c2 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sat, 12 Jan 2013 16:23:09 +0100 Subject: Report VM cache size in meminfo * rootdir.c: Include and . (rootdir_gc_meminfo): Call vm_cache_statistics and return the VM cache size. --- rootdir.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rootdir.c b/rootdir.c index 1fa71b03..31e2d8c6 100644 --- a/rootdir.c +++ b/rootdir.c @@ -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 #include #include +#include #include #include #include @@ -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, -- cgit v1.2.3