]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/counters.h
68b651b36c426c9080d3745ed73ea61c0da9389d
[apple/xnu.git] / osfmk / kern / counters.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33 /*
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58 /*
59 */
60
61 #ifndef _KERN_COUNTERS_
62 #define _KERN_COUNTERS_
63
64 #include <mach_counters.h>
65
66 /*
67 * We can count various interesting events and paths.
68 *
69 * Use counter() to change the counters, eg:
70 * counter(c_idle_thread_block++);
71 * Use counter_always() for non-conditional counters.
72 */
73
74 #define counter_always(code) code
75
76 #if MACH_COUNTERS
77
78 #define counter(code) counter_always(code)
79
80 #else /* MACH_COUNTERS */
81
82 #define counter(code)
83
84 #endif /* MACH_COUNTERS */
85
86 /*
87 * We define the counters with individual integers,
88 * instead of a big structure, so that ddb
89 * will know the addresses of the counters.
90 */
91
92 typedef unsigned int mach_counter_t;
93
94 extern mach_counter_t c_thread_invoke_csw;
95 extern mach_counter_t c_thread_invoke_same;
96 extern mach_counter_t c_thread_invoke_same_cont;
97 extern mach_counter_t c_thread_invoke_misses;
98 extern mach_counter_t c_thread_invoke_hits;
99 extern mach_counter_t c_incoming_interrupts;
100 extern mach_counter_t c_syscalls_unix;
101 extern mach_counter_t c_syscalls_mach;
102
103 #if MACH_COUNTERS
104 extern mach_counter_t c_action_thread_block;
105 extern mach_counter_t c_ast_taken_block;
106 extern mach_counter_t c_clock_ticks;
107 extern mach_counter_t c_dev_io_blocks;
108 extern mach_counter_t c_dev_io_tries;
109 extern mach_counter_t c_idle_thread_block;
110 extern mach_counter_t c_idle_thread_handoff;
111 extern mach_counter_t c_io_done_thread_block;
112 extern mach_counter_t c_ipc_mqueue_receive_block_kernel;
113 extern mach_counter_t c_ipc_mqueue_receive_block_user;
114 extern mach_counter_t c_ipc_mqueue_send_block;
115 extern mach_counter_t c_net_thread_block;
116 extern mach_counter_t c_reaper_thread_block;
117 extern mach_counter_t c_sched_thread_block;
118 extern mach_counter_t c_stacks_current;
119 extern mach_counter_t c_stacks_max;
120 extern mach_counter_t c_stacks_min;
121 extern mach_counter_t c_swtch_block;
122 extern mach_counter_t c_swtch_pri_block;
123 extern mach_counter_t c_thread_switch_block;
124 extern mach_counter_t c_thread_switch_handoff;
125 extern mach_counter_t c_vm_fault_page_block_backoff_kernel;
126 extern mach_counter_t c_vm_fault_page_block_busy_kernel;
127 extern mach_counter_t c_vm_fault_retry_on_w_prot;
128 extern mach_counter_t c_vm_fault_wait_on_unlock;
129 extern mach_counter_t c_vm_map_simplified;
130 extern mach_counter_t c_vm_map_simplify_called;
131 extern mach_counter_t c_vm_map_simplify_entry_called;
132 extern mach_counter_t c_vm_page_wait_block;
133 extern mach_counter_t c_vm_pageout_block;
134 extern mach_counter_t c_vm_pageout_scan_block;
135 #endif /* MACH_COUNTERS */
136
137 #endif /* _KERN_COUNTERS_ */
138