|
1 /* |
|
2 * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 * |
|
23 */ |
|
24 |
|
25 #if defined(SOLARIS) && defined(DTRACE_ENABLED) |
|
26 |
|
27 #include <sys/sdt.h> |
|
28 |
|
29 #define DTRACE_ONLY(x) x |
|
30 #define NOT_DTRACE(x) |
|
31 |
|
32 #else // ndef SOLARIS || ndef DTRACE_ENABLED |
|
33 |
|
34 #define DTRACE_ONLY(x) |
|
35 #define NOT_DTRACE(x) x |
|
36 |
|
37 #define DTRACE_PROBE(a,b) {;} |
|
38 #define DTRACE_PROBE1(a,b,c) {;} |
|
39 #define DTRACE_PROBE2(a,b,c,d) {;} |
|
40 #define DTRACE_PROBE3(a,b,c,d,e) {;} |
|
41 #define DTRACE_PROBE4(a,b,c,d,e,f) {;} |
|
42 #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;} |
|
43 |
|
44 #endif |
|
45 |
|
46 #define HS_DTRACE_PROBE_FN(provider,name)\ |
|
47 __dtrace_##provider##___##name |
|
48 |
|
49 #define HS_DTRACE_PROBE_DECL_N(provider,name,args) \ |
|
50 DTRACE_ONLY(extern "C" void HS_DTRACE_PROBE_FN(provider,name) args) |
|
51 #define HS_DTRACE_PROBE_CDECL_N(provider,name,args) \ |
|
52 DTRACE_ONLY(extern void HS_DTRACE_PROBE_FN(provider,name) args) |
|
53 |
|
54 /* Dtrace probe declarations */ |
|
55 #define HS_DTRACE_PROBE_DECL(provider,name) \ |
|
56 HS_DTRACE_PROBE_DECL0(provider,name) |
|
57 #define HS_DTRACE_PROBE_DECL0(provider,name)\ |
|
58 HS_DTRACE_PROBE_DECL_N(provider,name,(void)) |
|
59 #define HS_DTRACE_PROBE_DECL1(provider,name,t0)\ |
|
60 HS_DTRACE_PROBE_DECL_N(provider,name,(uintptr_t)) |
|
61 #define HS_DTRACE_PROBE_DECL2(provider,name,t0,t1)\ |
|
62 HS_DTRACE_PROBE_DECL_N(provider,name,(uintptr_t,uintptr_t)) |
|
63 #define HS_DTRACE_PROBE_DECL3(provider,name,t0,t1,t2)\ |
|
64 HS_DTRACE_PROBE_DECL_N(provider,name,(uintptr_t,uintptr_t,uintptr_t)) |
|
65 #define HS_DTRACE_PROBE_DECL4(provider,name,t0,t1,t2,t3)\ |
|
66 HS_DTRACE_PROBE_DECL_N(provider,name,(uintptr_t,uintptr_t,uintptr_t,\ |
|
67 uintptr_t)) |
|
68 #define HS_DTRACE_PROBE_DECL5(provider,name,t0,t1,t2,t3,t4)\ |
|
69 HS_DTRACE_PROBE_DECL_N(provider,name,(\ |
|
70 uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t)) |
|
71 #define HS_DTRACE_PROBE_DECL6(provider,name,t0,t1,t2,t3,t4,t5)\ |
|
72 HS_DTRACE_PROBE_DECL_N(provider,name,(\ |
|
73 uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t)) |
|
74 #define HS_DTRACE_PROBE_DECL7(provider,name,t0,t1,t2,t3,t4,t5,t6)\ |
|
75 HS_DTRACE_PROBE_DECL_N(provider,name,(\ |
|
76 uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t)) |
|
77 #define HS_DTRACE_PROBE_DECL8(provider,name,t0,t1,t2,t3,t4,t5,t6,t7)\ |
|
78 HS_DTRACE_PROBE_DECL_N(provider,name,(\ |
|
79 uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,\ |
|
80 uintptr_t)) |
|
81 #define HS_DTRACE_PROBE_DECL9(provider,name,t0,t1,t2,t3,t4,t5,t6,t7,t8)\ |
|
82 HS_DTRACE_PROBE_DECL_N(provider,name,(\ |
|
83 uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,\ |
|
84 uintptr_t,uintptr_t)) |
|
85 #define HS_DTRACE_PROBE_DECL10(provider,name,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9)\ |
|
86 HS_DTRACE_PROBE_DECL_N(provider,name,(\ |
|
87 uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,uintptr_t,\ |
|
88 uintptr_t,uintptr_t,uintptr_t)) |
|
89 |
|
90 /* Dtrace probe definitions */ |
|
91 #define HS_DTRACE_PROBE_N(provider,name, args) \ |
|
92 DTRACE_ONLY(HS_DTRACE_PROBE_FN(provider,name) args) |
|
93 |
|
94 #define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name) |
|
95 #define HS_DTRACE_PROBE0(provider,name)\ |
|
96 HS_DTRACE_PROBE_N(provider,name,()) |
|
97 #define HS_DTRACE_PROBE1(provider,name,a0)\ |
|
98 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0)) |
|
99 #define HS_DTRACE_PROBE2(provider,name,a0,a1)\ |
|
100 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1)) |
|
101 #define HS_DTRACE_PROBE3(provider,name,a0,a1,a2)\ |
|
102 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2)) |
|
103 #define HS_DTRACE_PROBE4(provider,name,a0,a1,a2,a3)\ |
|
104 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ |
|
105 (uintptr_t)a3)) |
|
106 #define HS_DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)\ |
|
107 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ |
|
108 (uintptr_t)a3,(uintptr_t)a4)) |
|
109 #define HS_DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)\ |
|
110 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ |
|
111 (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5)) |
|
112 #define HS_DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)\ |
|
113 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ |
|
114 (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6)) |
|
115 #define HS_DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)\ |
|
116 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ |
|
117 (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7)) |
|
118 #define HS_DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ |
|
119 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ |
|
120 (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\ |
|
121 (uintptr_t)a8)) |
|
122 #define HS_DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9)\ |
|
123 HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ |
|
124 (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\ |
|
125 (uintptr_t)a8,(uintptr_t)a9)) |