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