2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
36 * All Rights Reserved.
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
61 * File: mach/vm_statistics.h
62 * Author: Avadis Tevanian, Jr., Michael Wayne Young, David Golub
64 * Virtual memory statistics structure.
68 #ifndef _MACH_VM_STATISTICS_H_
69 #define _MACH_VM_STATISTICS_H_
71 #include <mach/machine/vm_types.h>
73 struct vm_statistics
{
74 natural_t free_count
; /* # of pages free */
75 natural_t active_count
; /* # of pages active */
76 natural_t inactive_count
; /* # of pages inactive */
77 natural_t wire_count
; /* # of pages wired down */
78 natural_t zero_fill_count
; /* # of zero fill pages */
79 natural_t reactivations
; /* # of pages reactivated */
80 natural_t pageins
; /* # of pageins */
81 natural_t pageouts
; /* # of pageouts */
82 natural_t faults
; /* # of faults */
83 natural_t cow_faults
; /* # of copy-on-writes */
84 natural_t lookups
; /* object cache lookups */
85 natural_t hits
; /* object cache hits */
87 natural_t purgeable_count
; /* # of pages purgeable */
88 natural_t purges
; /* # of pages purged */
91 typedef struct vm_statistics
*vm_statistics_t
;
92 typedef struct vm_statistics vm_statistics_data_t
;
94 struct vm_statistics_rev0
{
95 natural_t free_count
; /* # of pages free */
96 natural_t active_count
; /* # of pages active */
97 natural_t inactive_count
; /* # of pages inactive */
98 natural_t wire_count
; /* # of pages wired down */
99 natural_t zero_fill_count
; /* # of zero fill pages */
100 natural_t reactivations
; /* # of pages reactivated */
101 natural_t pageins
; /* # of pageins */
102 natural_t pageouts
; /* # of pageouts */
103 natural_t faults
; /* # of faults */
104 natural_t cow_faults
; /* # of copy-on-writes */
105 natural_t lookups
; /* object cache lookups */
106 natural_t hits
; /* object cache hits */
109 typedef struct vm_statistics_rev0
*vm_statistics_rev0_t
;
110 typedef struct vm_statistics_rev0 vm_statistics_rev0_data_t
;
112 /* included for the vm_map_page_query call */
114 #define VM_PAGE_QUERY_PAGE_PRESENT 0x1
115 #define VM_PAGE_QUERY_PAGE_FICTITIOUS 0x2
116 #define VM_PAGE_QUERY_PAGE_REF 0x4
117 #define VM_PAGE_QUERY_PAGE_DIRTY 0x8
119 #ifdef MACH_KERNEL_PRIVATE
122 * Each machine dependent implementation is expected to
123 * keep certain statistics. They may do this anyway they
124 * so choose, but are expected to return the statistics
125 * in the following structure.
128 struct pmap_statistics
{
129 integer_t resident_count
; /* # of pages mapped (total)*/
130 integer_t wired_count
; /* # of pages wired */
133 typedef struct pmap_statistics
*pmap_statistics_t
;
135 #endif /* MACH_KERNEL_PRIVATE */
138 * VM allocation flags:
141 * (really the absence of VM_FLAGS_ANYWHERE)
142 * Allocate new VM region at the specified virtual address, if possible.
145 * Allocate new VM region anywhere it would fit in the address space.
148 * Create a purgable VM object for that new VM region.
150 * VM_FLAGS_NO_PMAP_CHECK
151 * (for DEBUG kernel config only, ignored for other configs)
152 * Do not check that there is no stale pmap mapping for the new VM region.
153 * This is useful for kernel memory allocations at bootstrap when building
154 * the initial kernel address space while some memory is already in use.
157 * The new VM region can replace existing VM regions if necessary
158 * (to be used in combination with VM_FLAGS_FIXED).
160 #define VM_FLAGS_FIXED 0x0000
161 #define VM_FLAGS_ANYWHERE 0x0001
162 #define VM_FLAGS_PURGABLE 0x0002
163 #ifdef KERNEL_PRIVATE
164 #define VM_FLAGS_NO_PMAP_CHECK 0x0004
165 #endif /* KERNEL_PRIVATE */
166 #define VM_FLAGS_OVERWRITE 0x0008
168 #define VM_FLAGS_ALIAS_MASK 0xFF000000
169 #define VM_GET_FLAGS_ALIAS(flags, alias) \
170 (alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
171 #define VM_SET_FLAGS_ALIAS(flags, alias) \
172 (flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) | \
173 (((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
175 #define VM_MEMORY_MALLOC 1
176 #define VM_MEMORY_MALLOC_SMALL 2
177 #define VM_MEMORY_MALLOC_LARGE 3
178 #define VM_MEMORY_MALLOC_HUGE 4
179 #define VM_MEMORY_SBRK 5// uninteresting -- no one should call
180 #define VM_MEMORY_REALLOC 6
181 #define VM_MEMORY_MALLOC_TINY 7
183 #define VM_MEMORY_ANALYSIS_TOOL 10
185 #define VM_MEMORY_MACH_MSG 20
186 #define VM_MEMORY_IOKIT 21
187 #define VM_MEMORY_STACK 30
188 #define VM_MEMORY_GUARD 31
189 #define VM_MEMORY_SHARED_PMAP 32
190 /* memory containing a dylib */
191 #define VM_MEMORY_DYLIB 33
193 // Placeholders for now -- as we analyze the libraries and find how they
194 // use memory, we can make these labels more specific.
195 #define VM_MEMORY_APPKIT 40
196 #define VM_MEMORY_FOUNDATION 41
197 #define VM_MEMORY_COREGRAPHICS 42
198 #define VM_MEMORY_CARBON 43
199 #define VM_MEMORY_JAVA 44
200 #define VM_MEMORY_ATS 50
202 /* memory allocated by the dynamic loader for itself */
203 #define VM_MEMORY_DYLD 60
204 /* malloc'd memory created by dyld */
205 #define VM_MEMORY_DYLD_MALLOC 61
207 /* Reserve 240-255 for application */
208 #define VM_MEMORY_APPLICATION_SPECIFIC_1 240
209 #define VM_MEMORY_APPLICATION_SPECIFIC_16 255
211 #define VM_MAKE_TAG(tag) (tag<<24)
213 #endif /* _MACH_VM_STATISTICS_H_ */