]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/vm_statistics.h
xnu-344.23.tar.gz
[apple/xnu.git] / osfmk / mach / vm_statistics.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
de355530
A
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.
1c79356b 11 *
de355530
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
de355530
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
1c79356b
A
25/*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
29 *
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.
35 *
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.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50/*
51 */
52/*
53 * File: mach/vm_statistics.h
54 * Author: Avadis Tevanian, Jr., Michael Wayne Young, David Golub
55 *
56 * Virtual memory statistics structure.
57 *
58 */
59
60#ifndef VM_STATISTICS_H_
61#define VM_STATISTICS_H_
62
63#include <mach/machine/vm_types.h>
64
65struct 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 */
78};
79
80typedef struct vm_statistics *vm_statistics_t;
81typedef struct vm_statistics vm_statistics_data_t;
82
83
84/* included for the vm_map_page_query call */
85
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
90
91
92/*
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.
97 */
98
99struct pmap_statistics {
100 integer_t resident_count; /* # of pages mapped (total)*/
101 integer_t wired_count; /* # of pages wired */
102};
103
104typedef struct pmap_statistics *pmap_statistics_t;
105
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))
114
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
121#define VM_MEMORY_ANALYSIS_TOOL 10
122
123#define VM_MEMORY_MACH_MSG 20
124#define VM_MEMORY_IOKIT 21
125#define VM_MEMORY_STACK 30
126#define VM_MEMORY_GUARD 31
127#define VM_MEMORY_SHARED_PMAP 32
128/* memory containing a dylib */
129#define VM_MEMORY_DYLIB 33
130
131// Placeholders for now -- as we analyze the libraries and find how they
132// use memory, we can make these labels more specific.
133#define VM_MEMORY_APPKIT 40
134#define VM_MEMORY_FOUNDATION 41
135#define VM_MEMORY_COREGRAPHICS 42
136#define VM_MEMORY_CARBON 43
9bccf70c 137#define VM_MEMORY_JAVA 44
1c79356b
A
138#define VM_MEMORY_ATS 50
139
140
141/* memory allocated by the dynamic loader for itself */
142#define VM_MEMORY_DYLD 60
143/* malloc'd memory created by dyld */
144#define VM_MEMORY_DYLD_MALLOC 61
145
146/* Reserve 240-255 for application */
147#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
148#define VM_MEMORY_APPLICATION_SPECIFIC_16 255
149
150#define VM_MAKE_TAG(tag) (tag<<24)
151#endif /* VM_STATISTICS_H_ */