2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
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.
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.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
56 * File: mach/vm_statistics.h
57 * Author: Avadis Tevanian, Jr., Michael Wayne Young, David Golub
59 * Virtual memory statistics structure.
63 #ifndef VM_STATISTICS_H_
64 #define VM_STATISTICS_H_
66 #include <mach/machine/vm_types.h>
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 */
83 typedef struct vm_statistics
*vm_statistics_t
;
84 typedef struct vm_statistics vm_statistics_data_t
;
87 /* included for the vm_map_page_query call */
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
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.
102 struct pmap_statistics
{
103 integer_t resident_count
; /* # of pages mapped (total)*/
104 integer_t wired_count
; /* # of pages wired */
107 typedef struct pmap_statistics
*pmap_statistics_t
;
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))
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
124 #define VM_MEMORY_ANALYSIS_TOOL 10
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
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
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
149 /* Reserve 240-255 for application */
150 #define VM_MEMORY_APPLICATION_SPECIFIC_1 240
151 #define VM_MEMORY_APPLICATION_SPECIFIC_16 255
153 #define VM_MAKE_TAG(tag) (tag<<24)
154 #endif /* VM_STATISTICS_H_ */