2 * Copyright (c) 2000-2002 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 VM_STATISTICS_H_
61 #define VM_STATISTICS_H_
63 #include <mach/machine/vm_types.h>
65 struct vm_statistics
{
66 integer_t free_count
; /* # of pages free */
67 integer_t active_count
; /* # of pages active */
68 integer_t inactive_count
; /* # of pages inactive */
69 integer_t wire_count
; /* # of pages wired down */
70 integer_t zero_fill_count
; /* # of zero fill pages */
71 integer_t reactivations
; /* # of pages reactivated */
72 integer_t pageins
; /* # of pageins */
73 integer_t pageouts
; /* # of pageouts */
74 integer_t faults
; /* # of faults */
75 integer_t cow_faults
; /* # of copy-on-writes */
76 integer_t lookups
; /* object cache lookups */
77 integer_t hits
; /* object cache hits */
80 typedef struct vm_statistics
*vm_statistics_t
;
81 typedef struct vm_statistics vm_statistics_data_t
;
84 /* included for the vm_map_page_query call */
86 #define VM_PAGE_QUERY_PAGE_PRESENT 0x1
87 #define VM_PAGE_QUERY_PAGE_FICTITIOUS 0x2
88 #define VM_PAGE_QUERY_PAGE_REF 0x4
89 #define VM_PAGE_QUERY_PAGE_DIRTY 0x8
93 * Each machine dependent implementation is expected to
94 * keep certain statistics. They may do this anyway they
95 * so choose, but are expected to return the statistics
96 * in the following structure.
99 struct pmap_statistics
{
100 integer_t resident_count
; /* # of pages mapped (total)*/
101 integer_t wired_count
; /* # of pages wired */
104 typedef struct pmap_statistics
*pmap_statistics_t
;
106 #define VM_FLAGS_FIXED 0x0
107 #define VM_FLAGS_ANYWHERE 0x1
108 #define VM_FLAGS_ALIAS_MASK 0xFF000000
109 #define VM_GET_FLAGS_ALIAS(flags, alias) \
110 (alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
111 #define VM_SET_FLAGS_ALIAS(flags, alias) \
112 (flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) | \
113 (((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
115 #define VM_MEMORY_MALLOC 1
116 #define VM_MEMORY_MALLOC_SMALL 2
117 #define VM_MEMORY_MALLOC_LARGE 3
118 #define VM_MEMORY_MALLOC_HUGE 4
119 #define VM_MEMORY_SBRK 5// uninteresting -- no one should call
120 #define VM_MEMORY_REALLOC 6
121 #define VM_MEMORY_MALLOC_TINY 7
123 #define VM_MEMORY_ANALYSIS_TOOL 10
125 #define VM_MEMORY_MACH_MSG 20
126 #define VM_MEMORY_IOKIT 21
127 #define VM_MEMORY_STACK 30
128 #define VM_MEMORY_GUARD 31
129 #define VM_MEMORY_SHARED_PMAP 32
130 /* memory containing a dylib */
131 #define VM_MEMORY_DYLIB 33
133 // Placeholders for now -- as we analyze the libraries and find how they
134 // use memory, we can make these labels more specific.
135 #define VM_MEMORY_APPKIT 40
136 #define VM_MEMORY_FOUNDATION 41
137 #define VM_MEMORY_COREGRAPHICS 42
138 #define VM_MEMORY_CARBON 43
139 #define VM_MEMORY_JAVA 44
140 #define VM_MEMORY_ATS 50
143 /* memory allocated by the dynamic loader for itself */
144 #define VM_MEMORY_DYLD 60
145 /* malloc'd memory created by dyld */
146 #define VM_MEMORY_DYLD_MALLOC 61
148 /* Reserve 240-255 for application */
149 #define VM_MEMORY_APPLICATION_SPECIFIC_1 240
150 #define VM_MEMORY_APPLICATION_SPECIFIC_16 255
152 #define VM_MAKE_TAG(tag) (tag<<24)
153 #endif /* VM_STATISTICS_H_ */