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