]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/machine/sdt.h
2 * Copyright (c) 2007 Apple Inc. All rights reserved.
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
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.
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]
26 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #ifndef _MACH_MACHINE_SYS_SDT_H
31 #define _MACH_MACHINE_SYS_SDT_H
33 #include <mach/machine/sdt_isa.h>
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
45 #define DTRACE_PROBE(provider, name) { \
46 DTRACE_CALL0ARGS(provider, name) \
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) \
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) \
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) \
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) \
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) \
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) \
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) \
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) \
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) \
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) \
156 #define DTRACE_SCHED(name) \
157 DTRACE_PROBE(__sched_, name);
159 #define DTRACE_SCHED1(name, type1, arg1) \
160 DTRACE_PROBE1(__sched_, name, arg1);
162 #define DTRACE_SCHED2(name, type1, arg1, type2, arg2) \
163 DTRACE_PROBE2(__sched_, name, arg1, arg2);
165 #define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) \
166 DTRACE_PROBE3(__sched_, name, arg1, arg2, arg3);
168 #define DTRACE_SCHED4(name, type1, arg1, type2, arg2, \
169 type3, arg3, type4, arg4) \
170 DTRACE_PROBE4(__sched_, name, arg1, arg2, arg3, arg4);
172 #define DTRACE_PROC(name) \
173 DTRACE_PROBE(__proc_, name);
175 #define DTRACE_PROC1(name, type1, arg1) \
176 DTRACE_PROBE1(__proc_, name, arg1);
178 #define DTRACE_PROC2(name, type1, arg1, type2, arg2) \
179 DTRACE_PROBE2(__proc_, name, arg1, arg2);
181 #define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) \
182 DTRACE_PROBE3(__proc_, name, arg1, arg2, arg3);
184 #define DTRACE_PROC4(name, type1, arg1, type2, arg2, \
185 type3, arg3, type4, arg4) \
186 DTRACE_PROBE4(__proc_, name, arg1, arg2, arg3, arg4);
188 #define DTRACE_IO(name) \
189 DTRACE_PROBE(__io_, name);
191 #define DTRACE_IO1(name, type1, arg1) \
192 DTRACE_PROBE1(__io_, name, arg1);
194 #define DTRACE_IO2(name, type1, arg1, type2, arg2) \
195 DTRACE_PROBE2(__io_, name, type1, arg1, type2, arg2);
197 #define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) \
198 DTRACE_PROBE3(__io_, name, arg1, arg2, arg3);
200 #define DTRACE_IO4(name, type1, arg1, type2, arg2, \
201 type3, arg3, type4, arg4) \
202 DTRACE_PROBE4(__io_, name, arg1, arg2, arg3, arg4);
204 #define DTRACE_INT5(name, type1, arg1, type2, arg2, \
205 type3, arg3, type4, arg4, type5, arg5) \
206 DTRACE_PROBE5(__sdt_, name, arg1, arg2, arg3, arg4, arg5);
208 #define DTRACE_TMR3(name, type1, arg1, type2, arg2, type3, arg3) \
209 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
211 #define DTRACE_VM(name) \
212 DTRACE_PROBE(__vminfo_, name)
214 #define DTRACE_VM1(name, type1, arg1) \
215 DTRACE_PROBE1(__vminfo_, name, arg1)
217 #define DTRACE_VM2(name, type1, arg1, type2, arg2) \
218 DTRACE_PROBE2(__vminfo_, name, arg1, arg2)
220 #define DTRACE_VM3(name, type1, arg1, type2, arg2, type3, arg3) \
221 DTRACE_PROBE3(__vminfo_, name, arg1, arg2, arg3)
223 #define DTRACE_VM4(name, type1, arg1, type2, arg2, \
224 type3, arg3, type4, arg4) \
225 DTRACE_PROBE4(__vminfo_, name, arg1, arg2, arg3, arg4)
227 #else /* CONFIG_DTRACE */
229 #define DTRACE_SCHED(name) do {} while (0)
230 #define DTRACE_SCHED1(name, type1, arg1) do {} while (0)
231 #define DTRACE_SCHED2(name, type1, arg1, type2, arg2) do {} while (0)
232 #define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) do {} while (0)
233 #define DTRACE_SCHED4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while (0)
235 #define DTRACE_PROC(name) do {} while(0)
236 #define DTRACE_PROC1(name, type1, arg1) do {} while(0)
237 #define DTRACE_PROC2(name, type1, arg1, type2, arg2) do {} while (0)
238 #define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) do {} while (0)
239 #define DTRACE_PROC4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while(0)
240 #define DTRACE_IO(name) do {} while(0)
241 #define DTRACE_IO1(name, type1, arg1) do {} while(0)
242 #define DTRACE_IO2(name, type1, arg1, type2, arg2) do {} while(0)
243 #define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) do {} while(0)
244 #define DTRACE_IO4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while(0)
245 #define DTRACE_INT5(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) do {} while(0)
246 #define DTRACE_TMR3(name, type1, arg1, type2, arg2, type3, arg3) do {} while(0)
248 #define DTRACE_VM(name) do {} while(0)
249 #define DTRACE_VM1(name, type1, arg1) do {} while(0)
250 #define DTRACE_VM2(name, type1, arg1, type2, arg2) do {} while(0)
251 #define DTRACE_VM3(name, type1, arg1, type2, arg2, type3, arg3) do {} while(0)
252 #define DTRACE_VM4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) do {} while(0)
254 #endif /* CONFIG_DTRACE */
258 #endif /* _MACH_MACHINE_SYS_SDT_H */