]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/machine/sdt.h
xnu-1228.12.14.tar.gz
[apple/xnu.git] / osfmk / mach / machine / sdt.h
1 /*
2 * Copyright (c) 2007 Apple Inc. All rights reserved.
3 */
4 /*
5 * CDDL HEADER START
6 *
7 * The contents of this file are subject to the terms of the
8 * Common Development and Distribution License, Version 1.0 only
9 * (the "License"). You may not use this file except in compliance
10 * with the License.
11 *
12 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 * or http://www.opensolaris.org/os/licensing.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 *
17 * When distributing Covered Code, include this CDDL HEADER in each
18 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 * If applicable, add the following below this CDDL HEADER, with the
20 * fields enclosed by brackets "[]" replaced with your own identifying
21 * information: Portions Copyright [yyyy] [name of copyright owner]
22 *
23 * CDDL HEADER END
24 */
25 /*
26 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #ifndef _MACH_MACHINE_SYS_SDT_H
31 #define _MACH_MACHINE_SYS_SDT_H
32
33 #include <mach/machine/sdt_isa.h>
34
35 /*
36 * The following macros are used to create static probes. The argument types
37 * should be no greater than uintptr_t in size each. The behavior of larger
38 * types is undefined.
39 */
40
41 #define DTRACE_PROBE(provider, name) { \
42 DTRACE_CALL0ARGS(provider, name) \
43 }
44
45 #define DTRACE_PROBE1(provider, name, arg0) { \
46 uintptr_t __dtrace_args[ARG1_EXTENT] __attribute__ ((aligned (16))); \
47 __dtrace_args[0] = (uintptr_t)arg0; \
48 DTRACE_CALL1ARG(provider, name) \
49 }
50
51 #define DTRACE_PROBE2(provider, name, arg0, arg1) { \
52 uintptr_t __dtrace_args[ARGS2_EXTENT] __attribute__ ((aligned (16))); \
53 __dtrace_args[0] = (uintptr_t)arg0; \
54 __dtrace_args[1] = (uintptr_t)arg1; \
55 DTRACE_CALL2ARGS(provider, name) \
56 }
57
58 #define DTRACE_PROBE3(provider, name, arg0, arg1, arg2) { \
59 uintptr_t __dtrace_args[ARGS3_EXTENT] __attribute__ ((aligned (16))); \
60 __dtrace_args[0] = (uintptr_t)arg0; \
61 __dtrace_args[1] = (uintptr_t)arg1; \
62 __dtrace_args[2] = (uintptr_t)arg2; \
63 DTRACE_CALL3ARGS(provider, name) \
64 }
65
66 #define DTRACE_PROBE4(provider, name, arg0, arg1, arg2, arg3) { \
67 uintptr_t __dtrace_args[ARGS4_EXTENT] __attribute__ ((aligned (16))); \
68 __dtrace_args[0] = (uintptr_t)arg0; \
69 __dtrace_args[1] = (uintptr_t)arg1; \
70 __dtrace_args[2] = (uintptr_t)arg2; \
71 __dtrace_args[3] = (uintptr_t)arg3; \
72 DTRACE_CALL4ARGS(provider, name) \
73 }
74
75 #define DTRACE_PROBE5(provider, name, arg0, arg1, arg2, arg3, arg4) { \
76 uintptr_t __dtrace_args[ARGS5_EXTENT] __attribute__ ((aligned (16))); \
77 __dtrace_args[0] = (uintptr_t)arg0; \
78 __dtrace_args[1] = (uintptr_t)arg1; \
79 __dtrace_args[2] = (uintptr_t)arg2; \
80 __dtrace_args[3] = (uintptr_t)arg3; \
81 __dtrace_args[4] = (uintptr_t)arg4; \
82 DTRACE_CALL5ARGS(provider, name) \
83 }
84
85 #define DTRACE_PROBE6(provider, name, arg0, arg1, arg2, arg3, arg4, arg5) { \
86 uintptr_t __dtrace_args[ARGS6_EXTENT] __attribute__ ((aligned (16))); \
87 __dtrace_args[0] = (uintptr_t)arg0; \
88 __dtrace_args[1] = (uintptr_t)arg1; \
89 __dtrace_args[2] = (uintptr_t)arg2; \
90 __dtrace_args[3] = (uintptr_t)arg3; \
91 __dtrace_args[4] = (uintptr_t)arg4; \
92 __dtrace_args[5] = (uintptr_t)arg5; \
93 DTRACE_CALL6ARGS(provider, name) \
94 }
95
96 #define DTRACE_PROBE7(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6) { \
97 uintptr_t __dtrace_args[ARGS7_EXTENT] __attribute__ ((aligned (16))); \
98 __dtrace_args[0] = (uintptr_t)arg0; \
99 __dtrace_args[1] = (uintptr_t)arg1; \
100 __dtrace_args[2] = (uintptr_t)arg2; \
101 __dtrace_args[3] = (uintptr_t)arg3; \
102 __dtrace_args[4] = (uintptr_t)arg4; \
103 __dtrace_args[5] = (uintptr_t)arg5; \
104 __dtrace_args[6] = (uintptr_t)arg6; \
105 DTRACE_CALL7ARGS(provider, name) \
106 }
107
108 #define DTRACE_PROBE8(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \
109 uintptr_t __dtrace_args[ARGS8_EXTENT] __attribute__ ((aligned (16))); \
110 __dtrace_args[0] = (uintptr_t)arg0; \
111 __dtrace_args[1] = (uintptr_t)arg1; \
112 __dtrace_args[2] = (uintptr_t)arg2; \
113 __dtrace_args[3] = (uintptr_t)arg3; \
114 __dtrace_args[4] = (uintptr_t)arg4; \
115 __dtrace_args[5] = (uintptr_t)arg5; \
116 __dtrace_args[6] = (uintptr_t)arg6; \
117 __dtrace_args[7] = (uintptr_t)arg7; \
118 DTRACE_CALL8ARGS(provider, name) \
119 }
120
121 #define DTRACE_PROBE9(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { \
122 uintptr_t __dtrace_args[ARGS9_EXTENT] __attribute__ ((aligned (16))); \
123 __dtrace_args[0] = (uintptr_t)arg0; \
124 __dtrace_args[1] = (uintptr_t)arg1; \
125 __dtrace_args[2] = (uintptr_t)arg2; \
126 __dtrace_args[3] = (uintptr_t)arg3; \
127 __dtrace_args[4] = (uintptr_t)arg4; \
128 __dtrace_args[5] = (uintptr_t)arg5; \
129 __dtrace_args[6] = (uintptr_t)arg6; \
130 __dtrace_args[7] = (uintptr_t)arg7; \
131 __dtrace_args[8] = (uintptr_t)arg8; \
132 DTRACE_CALL9ARGS(provider, name) \
133 }
134
135 #define DTRACE_PROBE10(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \
136 uintptr_t __dtrace_args[ARGS10_EXTENT] __attribute__ ((aligned (16))); \
137 __dtrace_args[0] = (uintptr_t)arg0; \
138 __dtrace_args[1] = (uintptr_t)arg1; \
139 __dtrace_args[2] = (uintptr_t)arg2; \
140 __dtrace_args[3] = (uintptr_t)arg3; \
141 __dtrace_args[4] = (uintptr_t)arg4; \
142 __dtrace_args[5] = (uintptr_t)arg5; \
143 __dtrace_args[6] = (uintptr_t)arg6; \
144 __dtrace_args[7] = (uintptr_t)arg7; \
145 __dtrace_args[8] = (uintptr_t)arg8; \
146 __dtrace_args[9] = (uintptr_t)arg9; \
147 DTRACE_CALL10ARGS(provider, name) \
148 }
149
150
151 #ifdef KERNEL
152
153 #if CONFIG_DTRACE
154
155 #define DTRACE_SCHED(name) \
156 DTRACE_PROBE(__sched_, name);
157
158 #define DTRACE_SCHED1(name, type1, arg1) \
159 DTRACE_PROBE1(__sched_, name, arg1);
160
161 #define DTRACE_SCHED2(name, type1, arg1, type2, arg2) \
162 DTRACE_PROBE2(__sched_, name, arg1, arg2);
163
164 #define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) \
165 DTRACE_PROBE3(__sched_, name, arg1, arg2, arg3);
166
167 #define DTRACE_SCHED4(name, type1, arg1, type2, arg2, \
168 type3, arg3, type4, arg4) \
169 DTRACE_PROBE4(__sched_, name, arg1, arg2, arg3, arg4);
170
171 #define DTRACE_PROC(name) \
172 DTRACE_PROBE(__proc_, name);
173
174 #define DTRACE_PROC1(name, type1, arg1) \
175 DTRACE_PROBE1(__proc_, name, arg1);
176
177 #define DTRACE_PROC2(name, type1, arg1, type2, arg2) \
178 DTRACE_PROBE2(__proc_, name, arg1, arg2);
179
180 #define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) \
181 DTRACE_PROBE3(__proc_, name, arg1, arg2, arg3);
182
183 #define DTRACE_PROC4(name, type1, arg1, type2, arg2, \
184 type3, arg3, type4, arg4) \
185 DTRACE_PROBE4(__proc_, name, arg1, arg2, arg3, arg4);
186
187 #define DTRACE_IO(name) \
188 DTRACE_PROBE(__io_, name);
189
190 #define DTRACE_IO1(name, type1, arg1) \
191 DTRACE_PROBE1(__io_, name, arg1);
192
193 #define DTRACE_IO2(name, type1, arg1, type2, arg2) \
194 DTRACE_PROBE2(__io_, name, type1, arg1, type2, arg2);
195
196 #define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) \
197 DTRACE_PROBE3(__io_, name, arg1, arg2, arg3);
198
199 #define DTRACE_IO4(name, type1, arg1, type2, arg2, \
200 type3, arg3, type4, arg4) \
201 DTRACE_PROBE4(__io_, name, arg1, arg2, arg3, arg4);
202
203 #define DTRACE_INT5(name, type1, arg1, type2, arg2, \
204 type3, arg3, type4, arg4, type5, arg5) \
205 DTRACE_PROBE5(__sdt_, name, arg1, arg2, arg3, arg4, arg5);
206
207 #define DTRACE_TMR3(name, type1, arg1, type2, arg2, type3, arg3) \
208 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
209
210 #define DTRACE_VM(name) \
211 DTRACE_PROBE(__vminfo_, name)
212
213 #define DTRACE_VM1(name, type1, arg1) \
214 DTRACE_PROBE1(__vminfo_, name, arg1)
215
216 #define DTRACE_VM2(name, type1, arg1, type2, arg2) \
217 DTRACE_PROBE2(__vminfo_, name, arg1, arg2)
218
219 #define DTRACE_VM3(name, type1, arg1, type2, arg2, type3, arg3) \
220 DTRACE_PROBE3(__vminfo_, name, arg1, arg2, arg3)
221
222 #define DTRACE_VM4(name, type1, arg1, type2, arg2, \
223 type3, arg3, type4, arg4) \
224 DTRACE_PROBE4(__vminfo_, name, arg1, arg2, arg3, arg4)
225
226 #else /* CONFIG_DTRACE */
227
228 #define DTRACE_SCHED(name) do {} while (0)
229 #define DTRACE_SCHED1(name, type1, arg1) do {} while (0)
230 #define DTRACE_SCHED2(name, type1, arg1, type2, arg2) do {} while (0)
231 #define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) do {} while (0)
232 #define DTRACE_SCHED4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while (0)
233
234 #define DTRACE_PROC(name) do {} while(0)
235 #define DTRACE_PROC1(name, type1, arg1) do {} while(0)
236 #define DTRACE_PROC2(name, type1, arg1, type2, arg2) do {} while (0)
237 #define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) do {} while (0)
238 #define DTRACE_PROC4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while(0)
239 #define DTRACE_IO(name) do {} while(0)
240 #define DTRACE_IO1(name, type1, arg1) do {} while(0)
241 #define DTRACE_IO2(name, type1, arg1, type2, arg2) do {} while(0)
242 #define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) do {} while(0)
243 #define DTRACE_IO4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while(0)
244 #define DTRACE_INT5(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) do {} while(0)
245 #define DTRACE_TMR3(name, type1, arg1, type2, arg2, type3, arg3) do {} while(0)
246
247 #define DTRACE_VM(name) do {} while(0)
248 #define DTRACE_VM1(name, type1, arg1) do {} while(0)
249 #define DTRACE_VM2(name, type1, arg1, type2, arg2) do {} while(0)
250 #define DTRACE_VM3(name, type1, arg1, type2, arg2, type3, arg3) do {} while(0)
251 #define DTRACE_VM4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while(0)
252
253 #endif /* CONFIG_DTRACE */
254
255 #endif /* KERNEL */
256
257 #endif /* _MACH_MACHINE_SYS_SDT_H */