From 9eacb0eab6eb8e35bb26ab3db660973fddf9e8fb Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sun, 23 Sep 2012 00:25:13 +0200 Subject: Provide basic page cache statistics * Makefrag.am (EXTRA_DIST): Add kern/gnumach.srv. (include_mach_HEADERS): Add include/mach/gnumach.defs and include/mach/vm_cache_statistics.h (nodist_libkernel_a_SOURCES): Add kern/gnumach.server.defs.c, kern/gnumach.server.h, kern/gnumach.server.c, kern/gnumach.server.msgids, kern/gnumach.server.defs. * include/mach/mach_types.h: Add #include . * kern/ipc_kobject.c (ipc_kobject_server): Declare and call gnumach_server_routine. * vm/vm_object.c (vm_object_cached_pages): New variable. (vm_object_cached_pages_lock_data): Likewise. (vm_object_deallocate): Update number of cached pages. (vm_object_lookup): Likewise. (vm_object_lookup_name): Likewise. (vm_object_destroy): Likewise. (vm_object_enter): Likewise. * vm/vm_object.h (ref_count): Declare as int. (resident_page_count): Likewise. (vm_object_cached_count): Add extern declaration. (vm_object_cached_pages): Likewise. (vm_object_cached_pages_lock_data): Likewise. (vm_object_cached_pages_update): New macro. * vm/vm_resident.c (vm_page_insert): Assert resident page count doesn't overflow, update number of cached pages as appropriate. (vm_page_replace): Likewise. (vm_page_remove): Update number of cached pages as appropriate. * vm/vm_user.c: Add #include . (vm_cache_statistics): New function. * vm/vm_user.h: Add #include . (vm_cache_statistics): New declaration. * include/mach/gnumach.defs: New file. --- include/mach/gnumach.defs | 39 +++++++++++++++++++++++++++++++++++++++ include/mach/mach_types.h | 1 + 2 files changed, 40 insertions(+) create mode 100644 include/mach/gnumach.defs (limited to 'include') diff --git a/include/mach/gnumach.defs b/include/mach/gnumach.defs new file mode 100644 index 0000000..7331334 --- /dev/null +++ b/include/mach/gnumach.defs @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 Free Software Foundation + * + * 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 Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +subsystem +#if KERNEL_SERVER + KernelServer +#endif /* KERNEL_SERVER */ +#if KERNEL_USER + KernelUser +#endif /* KERNEL_USER */ + gnumach 4200; + +#include +#include + +type vm_cache_statistics_data_t = struct[11] of integer_t; + +/* + * Return page cache statistics for the host on which the target task + * resides. + */ +routine vm_cache_statistics( + target_task : vm_task_t; + out vm_cache_stats : vm_cache_statistics_data_t); diff --git a/include/mach/mach_types.h b/include/mach/mach_types.h index f6ceac3..8768482 100644 --- a/include/mach/mach_types.h +++ b/include/mach/mach_types.h @@ -52,6 +52,7 @@ #include #include #include +#include #ifdef MACH_KERNEL #include /* for task_array_t */ -- cgit v1.2.3