]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/machine/sdt.h
xnu-4570.1.46.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 #ifdef KERNEL
36
37 #if CONFIG_DTRACE
38
39 /*
40 * The following macros are used to create static probes. The argument types
41 * should be no greater than uintptr_t in size each. The behavior of larger
42 * types is undefined.
43 */
44
45 #define DTRACE_PROBE(provider, name) { \
46 DTRACE_CALL0ARGS(provider, name) \
47 }
48
49 #define DTRACE_PROBE1(provider, name, arg0) { \
50 uintptr_t __dtrace_args[ARG1_EXTENT] __attribute__ ((aligned (16))); \
51 __dtrace_args[0] = (uintptr_t)arg0; \
52 DTRACE_CALL1ARG(provider, name) \
53 }
54
55 #define DTRACE_PROBE2(provider, name, arg0, arg1) { \
56 uintptr_t __dtrace_args[ARGS2_EXTENT] __attribute__ ((aligned (16))); \
57 __dtrace_args[0] = (uintptr_t)arg0; \
58 __dtrace_args[1] = (uintptr_t)arg1; \
59 DTRACE_CALL2ARGS(provider, name) \
60 }
61
62 #define DTRACE_PROBE3(provider, name, arg0, arg1, arg2) { \
63 uintptr_t __dtrace_args[ARGS3_EXTENT] __attribute__ ((aligned (16))); \
64 __dtrace_args[0] = (uintptr_t)arg0; \
65 __dtrace_args[1] = (uintptr_t)arg1; \
66 __dtrace_args[2] = (uintptr_t)arg2; \
67 DTRACE_CALL3ARGS(provider, name) \
68 }
69
70 #define DTRACE_PROBE4(provider, name, arg0, arg1, arg2, arg3) { \
71 uintptr_t __dtrace_args[ARGS4_EXTENT] __attribute__ ((aligned (16))); \
72 __dtrace_args[0] = (uintptr_t)arg0; \
73 __dtrace_args[1] = (uintptr_t)arg1; \
74 __dtrace_args[2] = (uintptr_t)arg2; \
75 __dtrace_args[3] = (uintptr_t)arg3; \
76 DTRACE_CALL4ARGS(provider, name) \
77 }
78
79 #define DTRACE_PROBE5(provider, name, arg0, arg1, arg2, arg3, arg4) { \
80 uintptr_t __dtrace_args[ARGS5_EXTENT] __attribute__ ((aligned (16))); \
81 __dtrace_args[0] = (uintptr_t)arg0; \
82 __dtrace_args[1] = (uintptr_t)arg1; \
83 __dtrace_args[2] = (uintptr_t)arg2; \
84 __dtrace_args[3] = (uintptr_t)arg3; \
85 __dtrace_args[4] = (uintptr_t)arg4; \
86 DTRACE_CALL5ARGS(provider, name) \
87 }
88
89 #define DTRACE_PROBE6(provider, name, arg0, arg1, arg2, arg3, arg4, arg5) { \
90 uintptr_t __dtrace_args[ARGS6_EXTENT] __attribute__ ((aligned (16))); \
91 __dtrace_args[0] = (uintptr_t)arg0; \
92 __dtrace_args[1] = (uintptr_t)arg1; \
93 __dtrace_args[2] = (uintptr_t)arg2; \
94 __dtrace_args[3] = (uintptr_t)arg3; \
95 __dtrace_args[4] = (uintptr_t)arg4; \
96 __dtrace_args[5] = (uintptr_t)arg5; \
97 DTRACE_CALL6ARGS(provider, name) \
98 }
99
100 #define DTRACE_PROBE7(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6) { \
101 uintptr_t __dtrace_args[ARGS7_EXTENT] __attribute__ ((aligned (16))); \
102 __dtrace_args[0] = (uintptr_t)arg0; \
103 __dtrace_args[1] = (uintptr_t)arg1; \
104 __dtrace_args[2] = (uintptr_t)arg2; \
105 __dtrace_args[3] = (uintptr_t)arg3; \
106 __dtrace_args[4] = (uintptr_t)arg4; \
107 __dtrace_args[5] = (uintptr_t)arg5; \
108 __dtrace_args[6] = (uintptr_t)arg6; \
109 DTRACE_CALL7ARGS(provider, name) \
110 }
111
112 #define DTRACE_PROBE8(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \
113 uintptr_t __dtrace_args[ARGS8_EXTENT] __attribute__ ((aligned (16))); \
114 __dtrace_args[0] = (uintptr_t)arg0; \
115 __dtrace_args[1] = (uintptr_t)arg1; \
116 __dtrace_args[2] = (uintptr_t)arg2; \
117 __dtrace_args[3] = (uintptr_t)arg3; \
118 __dtrace_args[4] = (uintptr_t)arg4; \
119 __dtrace_args[5] = (uintptr_t)arg5; \
120 __dtrace_args[6] = (uintptr_t)arg6; \
121 __dtrace_args[7] = (uintptr_t)arg7; \
122 DTRACE_CALL8ARGS(provider, name) \
123 }
124
125 #define DTRACE_PROBE9(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { \
126 uintptr_t __dtrace_args[ARGS9_EXTENT] __attribute__ ((aligned (16))); \
127 __dtrace_args[0] = (uintptr_t)arg0; \
128 __dtrace_args[1] = (uintptr_t)arg1; \
129 __dtrace_args[2] = (uintptr_t)arg2; \
130 __dtrace_args[3] = (uintptr_t)arg3; \
131 __dtrace_args[4] = (uintptr_t)arg4; \
132 __dtrace_args[5] = (uintptr_t)arg5; \
133 __dtrace_args[6] = (uintptr_t)arg6; \
134 __dtrace_args[7] = (uintptr_t)arg7; \
135 __dtrace_args[8] = (uintptr_t)arg8; \
136 DTRACE_CALL9ARGS(provider, name) \
137 }
138
139 #define DTRACE_PROBE10(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \
140 uintptr_t __dtrace_args[ARGS10_EXTENT] __attribute__ ((aligned (16))); \
141 __dtrace_args[0] = (uintptr_t)arg0; \
142 __dtrace_args[1] = (uintptr_t)arg1; \
143 __dtrace_args[2] = (uintptr_t)arg2; \
144 __dtrace_args[3] = (uintptr_t)arg3; \
145 __dtrace_args[4] = (uintptr_t)arg4; \
146 __dtrace_args[5] = (uintptr_t)arg5; \
147 __dtrace_args[6] = (uintptr_t)arg6; \
148 __dtrace_args[7] = (uintptr_t)arg7; \
149 __dtrace_args[8] = (uintptr_t)arg8; \
150 __dtrace_args[9] = (uintptr_t)arg9; \
151 DTRACE_CALL10ARGS(provider, name) \
152 }
153
154 #else
155 #define DTRACE_PROBE(provider, name) do {} while(0)
156 #define DTRACE_PROBE1(provider, name, arg0) do {} while(0)
157 #define DTRACE_PROBE2(provider, name, arg0, arg1) do {} while(0)
158 #define DTRACE_PROBE3(provider, name, arg0, arg1, arg2) do {} while(0)
159 #define DTRACE_PROBE4(provider, name, arg0, arg1, arg2, arg3) do {} while(0)
160 #define DTRACE_PROBE5(provider, name, arg0, arg1, arg2, arg3, arg4) do {} while(0)
161 #define DTRACE_PROBE6(provider, name, arg0, arg1, arg2, arg3, arg4, arg5) do {} while(0)
162 #define DTRACE_PROBE7(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6) do {} while(0)
163 #define DTRACE_PROBE8(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) do {} while(0)
164 #define DTRACE_PROBE9(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) do {} while(0)
165 #define DTRACE_PROBE10(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) do {} while(0)
166
167 #endif /* CONFIG_DTRACE */
168
169 #define DTRACE_SCHED(name) \
170 DTRACE_PROBE(__sched_, name);
171
172 #define DTRACE_SCHED1(name, type1, arg1) \
173 DTRACE_PROBE1(__sched_, name, arg1);
174
175 #define DTRACE_SCHED2(name, type1, arg1, type2, arg2) \
176 DTRACE_PROBE2(__sched_, name, arg1, arg2);
177
178 #define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) \
179 DTRACE_PROBE3(__sched_, name, arg1, arg2, arg3);
180
181 #define DTRACE_SCHED4(name, type1, arg1, type2, arg2, \
182 type3, arg3, type4, arg4) \
183 DTRACE_PROBE4(__sched_, name, arg1, arg2, arg3, arg4);
184
185 #define DTRACE_PROC(name) \
186 DTRACE_PROBE(__proc_, name);
187
188 #define DTRACE_PROC1(name, type1, arg1) \
189 DTRACE_PROBE1(__proc_, name, arg1);
190
191 #define DTRACE_PROC2(name, type1, arg1, type2, arg2) \
192 DTRACE_PROBE2(__proc_, name, arg1, arg2);
193
194 #define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) \
195 DTRACE_PROBE3(__proc_, name, arg1, arg2, arg3);
196
197 #define DTRACE_PROC4(name, type1, arg1, type2, arg2, \
198 type3, arg3, type4, arg4) \
199 DTRACE_PROBE4(__proc_, name, arg1, arg2, arg3, arg4);
200
201 #define DTRACE_IO(name) \
202 DTRACE_PROBE(__io_, name);
203
204 #define DTRACE_IO1(name, type1, arg1) \
205 DTRACE_PROBE1(__io_, name, arg1);
206
207 #define DTRACE_IO2(name, type1, arg1, type2, arg2) \
208 DTRACE_PROBE2(__io_, name, arg1, arg2);
209
210 #define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) \
211 DTRACE_PROBE3(__io_, name, arg1, arg2, arg3);
212
213 #define DTRACE_IO4(name, type1, arg1, type2, arg2, \
214 type3, arg3, type4, arg4) \
215 DTRACE_PROBE4(__io_, name, arg1, arg2, arg3, arg4);
216
217 #define DTRACE_INT5(name, type1, arg1, type2, arg2, \
218 type3, arg3, type4, arg4, type5, arg5) \
219 DTRACE_PROBE5(__sdt_, name, arg1, arg2, arg3, arg4, arg5);
220
221 #define DTRACE_MEMORYSTATUS2(name, type1, arg1, type2, arg2) \
222 DTRACE_PROBE2(__sdt_, name, arg1, arg2);
223
224 #define DTRACE_MEMORYSTATUS3(name, type1, arg1, type2, arg2, type3, arg3) \
225 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
226
227 #define DTRACE_MEMORYSTATUS6(name, type1, arg1, type2, arg2, \
228 type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
229 DTRACE_PROBE6(__vminfo_, name, arg1, arg2, arg3, arg4, arg5, arg6)
230
231 #define DTRACE_TMR3(name, type1, arg1, type2, arg2, type3, arg3) \
232 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
233
234 #define DTRACE_TMR4(name, type1, arg1, arg2, arg3, arg4) \
235 DTRACE_PROBE4(__sdt_, name, arg1, arg2, arg3, arg4);
236
237 #define DTRACE_TMR5(name, type1, arg1, type2, arg2, type3, arg3, arg4, arg5) \
238 DTRACE_PROBE5(__sdt_, name, arg1, arg2, arg3, arg4, arg5);
239
240 #define DTRACE_TMR6(name, type1, arg1, type2, arg2, type3, arg3, arg4, arg5, arg6) \
241 DTRACE_PROBE6(__sdt_, name, arg1, arg2, arg3, arg4, arg5, arg6);
242
243 #define DTRACE_TMR7(name, type1, arg1, type2, arg2, type3, arg3, arg4, arg5, arg6, arg7) \
244 DTRACE_PROBE7(__sdt_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
245
246 #define DTRACE_PHYSLAT3(name, type1, arg1, type2, arg2, type3, arg3) \
247 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
248
249 #define DTRACE_VM(name) \
250 DTRACE_PROBE(__vminfo_, name)
251
252 #define DTRACE_VM1(name, type1, arg1) \
253 DTRACE_PROBE1(__vminfo_, name, arg1)
254
255 #define DTRACE_VM2(name, type1, arg1, type2, arg2) \
256 DTRACE_PROBE2(__vminfo_, name, arg1, arg2)
257
258 #define DTRACE_VM3(name, type1, arg1, type2, arg2, type3, arg3) \
259 DTRACE_PROBE3(__vminfo_, name, arg1, arg2, arg3)
260
261 #define DTRACE_VM4(name, type1, arg1, type2, arg2, \
262 type3, arg3, type4, arg4) \
263 DTRACE_PROBE4(__vminfo_, name, arg1, arg2, arg3, arg4)
264
265 #define DTRACE_VM5(name, type1, arg1, type2, arg2, \
266 type3, arg3, type4, arg4, type5, arg5) \
267 DTRACE_PROBE5(__vminfo_, name, arg1, arg2, arg3, arg4, arg5)
268
269 #define DTRACE_VM6(name, type1, arg1, type2, arg2, \
270 type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
271 DTRACE_PROBE6(__vminfo_, name, arg1, arg2, arg3, arg4, arg5, arg6)
272
273 #define DTRACE_IP(name) \
274 DTRACE_PROBE(__ip_, name)
275
276 #define DTRACE_IP1(name, type1, arg1) \
277 DTRACE_PROBE1(__ip_, name, arg1)
278
279 #define DTRACE_IP2(name, type1, arg1, type2, arg2) \
280 DTRACE_PROBE2(__ip_, name, arg1, arg2)
281
282 #define DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3) \
283 DTRACE_PROBE3(__ip_, name, arg1, arg2, arg3)
284
285 #define DTRACE_IP4(name, type1, arg1, type2, arg2, \
286 type3, arg3, type4, arg4) \
287 DTRACE_PROBE4(__ip_, name, arg1, arg2, arg3, arg4)
288
289 #define DTRACE_IP5(name, typ1, arg1, type2, arg2, type3, arg3, \
290 type4, arg4, type5, arg5) \
291 DTRACE_PROBE5(__ip_, name, arg1, arg2, arg3, arg4, arg5)
292
293 #define DTRACE_IP6(name, type1, arg1, type2, arg2, type3, arg3, \
294 type4,arg4, type5, arg5, type6, arg6) \
295 DTRACE_PROBE6(__ip_, name, arg1, arg2, arg3, arg4, arg5, arg6)
296
297 #define DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3, \
298 type4, arg4, type5, arg5, type6, arg6, type7, arg7) \
299 DTRACE_PROBE7(__ip_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
300
301 #define DTRACE_TCP(name) \
302 DTRACE_PROBE(__tcp_, name)
303
304 #define DTRACE_TCP1(name, type1, arg1) \
305 DTRACE_PROBE1(__tcp_, name, arg1)
306
307 #define DTRACE_TCP2(name, type1, arg1, type2, arg2) \
308 DTRACE_PROBE2(__tcp_, name, arg1, arg2)
309
310 #define DTRACE_TCP3(name, type1, arg1, type2, arg2, type3, arg3) \
311 DTRACE_PROBE3(__tcp_, name, arg1, arg2, arg3)
312
313 #define DTRACE_TCP4(name, type1, arg1, type2, arg2, \
314 type3, arg3, type4, arg4) \
315 DTRACE_PROBE4(__tcp_, name, arg1, arg2, arg3, arg4)
316
317 #define DTRACE_TCP5(name, typ1, arg1, type2, arg2, type3, arg3, \
318 type4, arg4, type5, arg5) \
319 DTRACE_PROBE5(__tcp_, name, arg1, arg2, arg3, arg4, arg5)
320
321 #define DTRACE_MPTCP(name) \
322 DTRACE_PROBE(__mptcp_, name)
323
324 #define DTRACE_MPTCP1(name, type1, arg1) \
325 DTRACE_PROBE1(__mptcp_, name, arg1)
326
327 #define DTRACE_MPTCP2(name, type1, arg1, type2, arg2) \
328 DTRACE_PROBE2(__mptcp_, name, arg1, arg2)
329
330 #define DTRACE_MPTCP3(name, type1, arg1, type2, arg2, type3, arg3) \
331 DTRACE_PROBE3(__mptcp_, name, arg1, arg2, arg3)
332
333 #define DTRACE_MPTCP4(name, type1, arg1, type2, arg2, \
334 type3, arg3, type4, arg4) \
335 DTRACE_PROBE4(__mptcp_, name, arg1, arg2, arg3, arg4)
336
337 #define DTRACE_MPTCP5(name, typ1, arg1, type2, arg2, type3, arg3, \
338 type4, arg4, type5, arg5) \
339 DTRACE_PROBE5(__mptcp_, name, arg1, arg2, arg3, arg4, arg5)
340
341 #define DTRACE_MPTCP6(name, typ1, arg1, type2, arg2, type3, arg3, \
342 type4, arg4, type5, arg5, type6, arg6) \
343 DTRACE_PROBE6(__mptcp_, name, arg1, arg2, arg3, arg4, arg5, arg6)
344
345 #define DTRACE_MPTCP7(name, typ1, arg1, type2, arg2, type3, arg3, \
346 type4, arg4, type5, arg5, type6, arg6, \
347 type7, arg7) \
348 DTRACE_PROBE7(__mptcp_, name, arg1, arg2, arg3, arg4, arg5, \
349 arg6, arg7)
350
351 #define DTRACE_FSINFO(name, type, vp) \
352 DTRACE_PROBE1(__fsinfo_, name, vp)
353
354 #define DTRACE_FSINFO_IO(name, type1, vp, type2, size) \
355 DTRACE_PROBE2(__fsinfo_, name, vp, size)
356
357 #define DTRACE_BOOST(name) \
358 DTRACE_PROBE(__boost_, name);
359
360 #define DTRACE_BOOST1(name, type1, arg1) \
361 DTRACE_PROBE1(__boost_, name, arg1);
362
363 #define DTRACE_BOOST2(name, type1, arg1, type2, arg2) \
364 DTRACE_PROBE2(__boost_, name, arg1, arg2);
365
366 #define DTRACE_BOOST3(name, type1, arg1, type2, arg2, type3, arg3) \
367 DTRACE_PROBE3(__boost_, name, arg1, arg2, arg3);
368
369 #define DTRACE_BOOST4(name, type1, arg1, type2, arg2, \
370 type3, arg3, type4, arg4) \
371 DTRACE_PROBE4(__boost_, name, arg1, arg2, arg3, arg4);
372
373 #define DTRACE_BOOST5(name, type1, arg1, type2, arg2, \
374 type3, arg3, type4, arg4, type5, arg5) \
375 DTRACE_PROBE5(__boost_, name, arg1, arg2, arg3, arg4, arg5);
376
377 #define DTRACE_BOOST6(name, type1, arg1, type2, arg2, \
378 type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
379 DTRACE_PROBE6(__boost_, name, arg1, arg2, arg3, arg4, arg5, arg6);
380
381 #if PRIVATE
382 #endif /* PRIVATE */
383
384 #endif /* KERNEL */
385
386 #endif /* _MACH_MACHINE_SYS_SDT_H */