]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/counters.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / kern / counters.h
1 /*
2 * Copyright (c) 2000 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 * HISTORY
30 *
31 * Revision 1.1.1.1 1998/09/22 21:05:35 wsanchez
32 * Import of Mac OS X kernel (~semeria)
33 *
34 * Revision 1.1.1.1 1998/03/07 02:25:54 wsanchez
35 * Import of OSF Mach kernel (~mburg)
36 *
37 * Revision 1.1.13.7 1995/02/24 15:19:14 alanl
38 * Merge with DIPC2_SHARED.
39 * [1995/02/22 20:19:55 alanl]
40 *
41 * Revision 1.1.19.4 1994/11/04 10:16:23 dwm
42 * mk6 CR668 - 1.3b26 merge
43 * add counters, then remove unused items
44 * [1994/11/04 09:45:39 dwm]
45 *
46 * Revision 1.1.13.5 1994/09/23 02:16:08 ezf
47 * change marker to not FREE
48 * [1994/09/22 21:32:13 ezf]
49 *
50 * Revision 1.1.13.4 1994/09/16 06:29:25 dwm
51 * mk6 CR551 - remove unused SAFE_VM_FAULT pseudo-continuation,
52 * remove unused args from vm_page_wait, vm_fault(_page).
53 * Fix vm_page_wait counters, and rm thread_handoff counter.
54 * [1994/09/16 06:23:26 dwm]
55 *
56 * Revision 1.1.13.3 1994/09/10 21:45:55 bolinger
57 * Merge up to NMK17.3
58 * [1994/09/08 19:57:29 bolinger]
59 *
60 * Revision 1.1.13.2 1994/06/21 17:28:43 dlb
61 * Add two vm_fault counters from NMK17.
62 * [94/06/17 dlb]
63 *
64 * Revision 1.1.10.3 1994/06/15 09:12:05 paire
65 * Corrected spelling of c_vm_fault_wait_on_unlock variable.
66 * [94/06/15 paire]
67 *
68 * Revision 1.1.13.1 1994/06/14 17:00:01 bolinger
69 * Merge up to NMK17.2.
70 * [1994/06/14 16:53:41 bolinger]
71 *
72 * Revision 1.1.10.2 1994/05/30 07:37:03 bernadat
73 * Added new c_vm_fault_retry_on_unlock and c_vm_fault_retry_on_w_prot.
74 * Sorted the whole list of counters.
75 * [paire@gr.osf.org]
76 * [94/05/26 bernadat]
77 *
78 * Revision 1.1.10.1 1994/02/11 14:25:21 paire
79 * Added missing c_exception_raise_state_block and
80 * c_exception_raise_state_identity_block counters.
81 * Change from NMK16.1 [93/08/09 paire]
82 * [94/02/04 paire]
83 *
84 * Revision 1.1.2.3 1993/06/07 22:12:36 jeffc
85 * CR9176 - ANSI C violations: trailing tokens on CPP
86 * directives, extra semicolons after decl_ ..., asm keywords
87 * [1993/06/07 19:04:11 jeffc]
88 *
89 * Revision 1.1.2.2 1993/06/02 23:35:54 jeffc
90 * Added to OSF/1 R1.3 from NMK15.0.
91 * [1993/06/02 21:12:09 jeffc]
92 *
93 * Revision 1.1 1992/09/30 02:29:32 robert
94 * Initial revision
95 *
96 * $EndLog$
97 */
98 /* CMU_HIST */
99 /*
100 * Revision 2.3 91/05/14 16:40:30 mrt
101 * Correcting copyright
102 *
103 * Revision 2.2 91/03/16 15:16:06 rpd
104 * Created.
105 * [91/03/13 rpd]
106 *
107 */
108 /* CMU_ENDHIST */
109 /*
110 * Mach Operating System
111 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
112 * All Rights Reserved.
113 *
114 * Permission to use, copy, modify and distribute this software and its
115 * documentation is hereby granted, provided that both the copyright
116 * notice and this permission notice appear in all copies of the
117 * software, derivative works or modified versions, and any portions
118 * thereof, and that both notices appear in supporting documentation.
119 *
120 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
121 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
122 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
123 *
124 * Carnegie Mellon requests users of this software to return to
125 *
126 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
127 * School of Computer Science
128 * Carnegie Mellon University
129 * Pittsburgh PA 15213-3890
130 *
131 * any improvements or extensions that they make and grant Carnegie Mellon
132 * the rights to redistribute these changes.
133 */
134 /*
135 */
136
137 #ifndef _KERN_COUNTERS_
138 #define _KERN_COUNTERS_
139
140 #include <mach_counters.h>
141
142 /*
143 * We can count various interesting events and paths.
144 *
145 * Use counter() to change the counters, eg:
146 * counter(c_idle_thread_block++);
147 * Use counter_always() for non-conditional counters.
148 */
149
150 #define counter_always(code) code
151
152 #if MACH_COUNTERS
153
154 #define counter(code) counter_always(code)
155
156 #else /* MACH_COUNTERS */
157
158 #define counter(code)
159
160 #endif /* MACH_COUNTERS */
161
162 /*
163 * We define the counters with individual integers,
164 * instead of a big structure, so that ddb
165 * will know the addresses of the counters.
166 */
167
168 typedef unsigned int mach_counter_t;
169
170 extern mach_counter_t c_thread_invoke_csw;
171 extern mach_counter_t c_thread_invoke_same;
172 extern mach_counter_t c_thread_invoke_same_cont;
173 extern mach_counter_t c_thread_invoke_misses;
174 extern mach_counter_t c_thread_invoke_hits;
175 extern mach_counter_t c_incoming_interrupts;
176 extern mach_counter_t c_syscalls_unix;
177 extern mach_counter_t c_syscalls_mach;
178
179 #if MACH_COUNTERS
180 extern mach_counter_t c_action_thread_block;
181 extern mach_counter_t c_ast_taken_block;
182 extern mach_counter_t c_clock_ticks;
183 extern mach_counter_t c_dev_io_blocks;
184 extern mach_counter_t c_dev_io_tries;
185 extern mach_counter_t c_idle_thread_block;
186 extern mach_counter_t c_idle_thread_handoff;
187 extern mach_counter_t c_io_done_thread_block;
188 extern mach_counter_t c_ipc_mqueue_receive_block_kernel;
189 extern mach_counter_t c_ipc_mqueue_receive_block_user;
190 extern mach_counter_t c_ipc_mqueue_send_block;
191 extern mach_counter_t c_net_thread_block;
192 extern mach_counter_t c_reaper_thread_block;
193 extern mach_counter_t c_sched_thread_block;
194 extern mach_counter_t c_stacks_current;
195 extern mach_counter_t c_stacks_max;
196 extern mach_counter_t c_stacks_min;
197 extern mach_counter_t c_swtch_block;
198 extern mach_counter_t c_swtch_pri_block;
199 extern mach_counter_t c_thread_switch_block;
200 extern mach_counter_t c_thread_switch_handoff;
201 extern mach_counter_t c_vm_fault_page_block_backoff_kernel;
202 extern mach_counter_t c_vm_fault_page_block_busy_kernel;
203 extern mach_counter_t c_vm_fault_retry_on_w_prot;
204 extern mach_counter_t c_vm_fault_wait_on_unlock;
205 extern mach_counter_t c_vm_map_simplified_lower;
206 extern mach_counter_t c_vm_map_simplified_upper;
207 extern mach_counter_t c_vm_map_simplify_called;
208 extern mach_counter_t c_vm_page_wait_block;
209 extern mach_counter_t c_vm_pageout_block;
210 extern mach_counter_t c_vm_pageout_scan_block;
211 extern mach_counter_t c_vm_fault_retry_on_w_prot;
212 extern mach_counter_t c_vm_fault_wait_on_unlock;
213 #endif /* MACH_COUNTERS */
214
215 #endif /* _KERN_COUNTERS_ */
216