]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/vm_statistics.h
xnu-792.22.5.tar.gz
[apple/xnu.git] / osfmk / mach / vm_statistics.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
8f6c56a5
A
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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
8ad349bb 24 * limitations under the License.
8f6c56a5
A
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
1c79356b
A
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
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.
41 *
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.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: mach/vm_statistics.h
60 * Author: Avadis Tevanian, Jr., Michael Wayne Young, David Golub
61 *
62 * Virtual memory statistics structure.
63 *
64 */
65
91447636
A
66#ifndef _MACH_VM_STATISTICS_H_
67#define _MACH_VM_STATISTICS_H_
1c79356b
A
68
69#include <mach/machine/vm_types.h>
70
71struct vm_statistics {
91447636
A
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 */
84
85 natural_t purgeable_count; /* # of pages purgeable */
86 natural_t purges; /* # of pages purged */
1c79356b
A
87};
88
89typedef struct vm_statistics *vm_statistics_t;
90typedef struct vm_statistics vm_statistics_data_t;
91
91447636
A
92struct 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 */
105};
106
107typedef struct vm_statistics_rev0 *vm_statistics_rev0_t;
108typedef struct vm_statistics_rev0 vm_statistics_rev0_data_t;
1c79356b
A
109
110/* included for the vm_map_page_query call */
111
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
116
91447636 117#ifdef MACH_KERNEL_PRIVATE
1c79356b
A
118
119/*
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.
124 */
125
126struct pmap_statistics {
127 integer_t resident_count; /* # of pages mapped (total)*/
128 integer_t wired_count; /* # of pages wired */
129};
130
131typedef struct pmap_statistics *pmap_statistics_t;
132
91447636
A
133#endif /* MACH_KERNEL_PRIVATE */
134
135/*
136 * VM allocation flags:
137 *
138 * VM_FLAGS_FIXED
139 * (really the absence of VM_FLAGS_ANYWHERE)
140 * Allocate new VM region at the specified virtual address, if possible.
141 *
142 * VM_FLAGS_ANYWHERE
143 * Allocate new VM region anywhere it would fit in the address space.
144 *
145 * VM_FLAGS_PURGABLE
146 * Create a purgable VM object for that new VM region.
147 *
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.
153 *
154 * VM_FLAGS_OVERWRITE
155 * The new VM region can replace existing VM regions if necessary
156 * (to be used in combination with VM_FLAGS_FIXED).
157 */
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
165
1c79356b
A
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))
172
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
55e303ae
A
178#define VM_MEMORY_REALLOC 6
179#define VM_MEMORY_MALLOC_TINY 7
1c79356b
A
180
181#define VM_MEMORY_ANALYSIS_TOOL 10
182
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
190
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
9bccf70c 197#define VM_MEMORY_JAVA 44
1c79356b
A
198#define VM_MEMORY_ATS 50
199
1c79356b
A
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
204
205/* Reserve 240-255 for application */
206#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
207#define VM_MEMORY_APPLICATION_SPECIFIC_16 255
208
209#define VM_MAKE_TAG(tag) (tag<<24)
91447636
A
210
211#endif /* _MACH_VM_STATISTICS_H_ */