75 #ifdef DTRACE_ENABLED |
75 #ifdef DTRACE_ENABLED |
76 |
76 |
77 // Only bother with this argument setup if dtrace is available |
77 // Only bother with this argument setup if dtrace is available |
78 // TODO-FIXME: probes should not fire when caller is _blocked. assert() accordingly. |
78 // TODO-FIXME: probes should not fire when caller is _blocked. assert() accordingly. |
79 |
79 |
80 HS_DTRACE_PROBE_DECL5(hotspot, monitor__wait, |
|
81 jlong, uintptr_t, char*, int, long); |
|
82 HS_DTRACE_PROBE_DECL4(hotspot, monitor__waited, |
|
83 jlong, uintptr_t, char*, int); |
|
84 |
|
85 #define DTRACE_MONITOR_PROBE_COMMON(klassOop, thread) \ |
80 #define DTRACE_MONITOR_PROBE_COMMON(klassOop, thread) \ |
86 char* bytes = NULL; \ |
81 char* bytes = NULL; \ |
87 int len = 0; \ |
82 int len = 0; \ |
88 jlong jtid = SharedRuntime::get_java_tid(thread); \ |
83 jlong jtid = SharedRuntime::get_java_tid(thread); \ |
89 Symbol* klassname = ((oop)(klassOop))->klass()->klass_part()->name(); \ |
84 Symbol* klassname = ((oop)(klassOop))->klass()->klass_part()->name(); \ |
90 if (klassname != NULL) { \ |
85 if (klassname != NULL) { \ |
91 bytes = (char*)klassname->bytes(); \ |
86 bytes = (char*)klassname->bytes(); \ |
92 len = klassname->utf8_length(); \ |
87 len = klassname->utf8_length(); \ |
93 } |
88 } |
94 |
89 |
|
90 #ifndef USDT2 |
|
91 HS_DTRACE_PROBE_DECL5(hotspot, monitor__wait, |
|
92 jlong, uintptr_t, char*, int, long); |
|
93 HS_DTRACE_PROBE_DECL4(hotspot, monitor__waited, |
|
94 jlong, uintptr_t, char*, int); |
|
95 |
95 #define DTRACE_MONITOR_WAIT_PROBE(monitor, klassOop, thread, millis) \ |
96 #define DTRACE_MONITOR_WAIT_PROBE(monitor, klassOop, thread, millis) \ |
96 { \ |
97 { \ |
97 if (DTraceMonitorProbes) { \ |
98 if (DTraceMonitorProbes) { \ |
98 DTRACE_MONITOR_PROBE_COMMON(klassOop, thread); \ |
99 DTRACE_MONITOR_PROBE_COMMON(klassOop, thread); \ |
99 HS_DTRACE_PROBE5(hotspot, monitor__wait, jtid, \ |
100 HS_DTRACE_PROBE5(hotspot, monitor__wait, jtid, \ |
108 HS_DTRACE_PROBE4(hotspot, monitor__##probe, jtid, \ |
109 HS_DTRACE_PROBE4(hotspot, monitor__##probe, jtid, \ |
109 (uintptr_t)(monitor), bytes, len); \ |
110 (uintptr_t)(monitor), bytes, len); \ |
110 } \ |
111 } \ |
111 } |
112 } |
112 |
113 |
|
114 #else /* USDT2 */ |
|
115 |
|
116 #define DTRACE_MONITOR_WAIT_PROBE(monitor, klassOop, thread, millis) \ |
|
117 { \ |
|
118 if (DTraceMonitorProbes) { \ |
|
119 DTRACE_MONITOR_PROBE_COMMON(klassOop, thread); \ |
|
120 HOTSPOT_MONITOR_WAIT(jtid, \ |
|
121 (uintptr_t)(monitor), bytes, len, (millis)); \ |
|
122 } \ |
|
123 } |
|
124 |
|
125 #define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_PROBE_WAITED |
|
126 |
|
127 #define DTRACE_MONITOR_PROBE(probe, monitor, klassOop, thread) \ |
|
128 { \ |
|
129 if (DTraceMonitorProbes) { \ |
|
130 DTRACE_MONITOR_PROBE_COMMON(klassOop, thread); \ |
|
131 HOTSPOT_MONITOR_PROBE_##probe(jtid, /* probe = waited */ \ |
|
132 (uintptr_t)(monitor), bytes, len); \ |
|
133 } \ |
|
134 } |
|
135 |
|
136 #endif /* USDT2 */ |
113 #else // ndef DTRACE_ENABLED |
137 #else // ndef DTRACE_ENABLED |
114 |
138 |
115 #define DTRACE_MONITOR_WAIT_PROBE(klassOop, thread, millis, mon) {;} |
139 #define DTRACE_MONITOR_WAIT_PROBE(klassOop, thread, millis, mon) {;} |
116 #define DTRACE_MONITOR_PROBE(probe, klassOop, thread, mon) {;} |
140 #define DTRACE_MONITOR_PROBE(probe, klassOop, thread, mon) {;} |
117 |
141 |