]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/vm_statistics.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / mach / vm_statistics.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28 /*
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
32 *
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
38 *
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53 /*
54 */
55 /*
56 * File: mach/vm_statistics.h
57 * Author: Avadis Tevanian, Jr., Michael Wayne Young, David Golub
58 *
59 * Virtual memory statistics structure.
60 *
61 */
62
63 #ifndef VM_STATISTICS_H_
64 #define VM_STATISTICS_H_
65
66 #include <mach/machine/vm_types.h>
67
68 struct vm_statistics {
69 integer_t free_count; /* # of pages free */
70 integer_t active_count; /* # of pages active */
71 integer_t inactive_count; /* # of pages inactive */
72 integer_t wire_count; /* # of pages wired down */
73 integer_t zero_fill_count; /* # of zero fill pages */
74 integer_t reactivations; /* # of pages reactivated */
75 integer_t pageins; /* # of pageins */
76 integer_t pageouts; /* # of pageouts */
77 integer_t faults; /* # of faults */
78 integer_t cow_faults; /* # of copy-on-writes */
79 integer_t lookups; /* object cache lookups */
80 integer_t hits; /* object cache hits */
81 };
82
83 typedef struct vm_statistics *vm_statistics_t;
84 typedef struct vm_statistics vm_statistics_data_t;
85
86
87 /* included for the vm_map_page_query call */
88
89 #define VM_PAGE_QUERY_PAGE_PRESENT 0x1
90 #define VM_PAGE_QUERY_PAGE_FICTITIOUS 0x2
91 #define VM_PAGE_QUERY_PAGE_REF 0x4
92 #define VM_PAGE_QUERY_PAGE_DIRTY 0x8
93
94
95 /*
96 * Each machine dependent implementation is expected to
97 * keep certain statistics. They may do this anyway they
98 * so choose, but are expected to return the statistics
99 * in the following structure.
100 */
101
102 struct pmap_statistics {
103 integer_t resident_count; /* # of pages mapped (total)*/
104 integer_t wired_count; /* # of pages wired */
105 };
106
107 typedef struct pmap_statistics *pmap_statistics_t;
108
109 #define VM_FLAGS_FIXED 0x0
110 #define VM_FLAGS_ANYWHERE 0x1
111 #define VM_FLAGS_ALIAS_MASK 0xFF000000
112 #define VM_GET_FLAGS_ALIAS(flags, alias) \
113 (alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
114 #define VM_SET_FLAGS_ALIAS(flags, alias) \
115 (flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) | \
116 (((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
117
118 #define VM_MEMORY_MALLOC 1
119 #define VM_MEMORY_MALLOC_SMALL 2
120 #define VM_MEMORY_MALLOC_LARGE 3
121 #define VM_MEMORY_MALLOC_HUGE 4
122 #define VM_MEMORY_SBRK 5// uninteresting -- no one should call
123
124 #define VM_MEMORY_ANALYSIS_TOOL 10
125
126 #define VM_MEMORY_MACH_MSG 20
127 #define VM_MEMORY_IOKIT 21
128 #define VM_MEMORY_STACK 30
129 #define VM_MEMORY_GUARD 31
130 #define VM_MEMORY_SHARED_PMAP 32
131 /* memory containing a dylib */
132 #define VM_MEMORY_DYLIB 33
133
134 // Placeholders for now -- as we analyze the libraries and find how they
135 // use memory, we can make these labels more specific.
136 #define VM_MEMORY_APPKIT 40
137 #define VM_MEMORY_FOUNDATION 41
138 #define VM_MEMORY_COREGRAPHICS 42
139 #define VM_MEMORY_CARBON 43
140 #define VM_MEMORY_JAVA 44
141 #define VM_MEMORY_ATS 50
142
143
144 /* memory allocated by the dynamic loader for itself */
145 #define VM_MEMORY_DYLD 60
146 /* malloc'd memory created by dyld */
147 #define VM_MEMORY_DYLD_MALLOC 61
148
149 /* Reserve 240-255 for application */
150 #define VM_MEMORY_APPLICATION_SPECIFIC_1 240
151 #define VM_MEMORY_APPLICATION_SPECIFIC_16 255
152
153 #define VM_MAKE_TAG(tag) (tag<<24)
154 #endif /* VM_STATISTICS_H_ */