|
44 | 44 |
|
45 | 45 | #include "env-inl.h"
|
46 | 46 | #include "node_errors.h"
|
| 47 | +#include "node_external_reference.h" |
47 | 48 |
|
48 | 49 | #include <cstring>
|
49 | 50 |
|
@@ -288,23 +289,35 @@ void InitDTrace(Environment* env) {
|
288 | 289 | }, env);
|
289 | 290 | }
|
290 | 291 |
|
| 292 | +#define NODE_PROBES(V) \ |
| 293 | + V(DTRACE_NET_SERVER_CONNECTION) \ |
| 294 | + V(DTRACE_NET_STREAM_END) \ |
| 295 | + V(DTRACE_HTTP_SERVER_REQUEST) \ |
| 296 | + V(DTRACE_HTTP_SERVER_RESPONSE) \ |
| 297 | + V(DTRACE_HTTP_CLIENT_REQUEST) \ |
| 298 | + V(DTRACE_HTTP_CLIENT_RESPONSE) |
| 299 | + |
291 | 300 | void InitializeDTrace(Local<Object> target,
|
292 | 301 | Local<Value> unused,
|
293 | 302 | Local<Context> context,
|
294 | 303 | void* priv) {
|
295 | 304 | Environment* env = Environment::GetCurrent(context);
|
296 | 305 |
|
297 | 306 | #if defined HAVE_DTRACE || defined HAVE_ETW
|
298 |
| -# define NODE_PROBE(name) env->SetMethod(target, #name, name); |
299 |
| - NODE_PROBE(DTRACE_NET_SERVER_CONNECTION) |
300 |
| - NODE_PROBE(DTRACE_NET_STREAM_END) |
301 |
| - NODE_PROBE(DTRACE_HTTP_SERVER_REQUEST) |
302 |
| - NODE_PROBE(DTRACE_HTTP_SERVER_RESPONSE) |
303 |
| - NODE_PROBE(DTRACE_HTTP_CLIENT_REQUEST) |
304 |
| - NODE_PROBE(DTRACE_HTTP_CLIENT_RESPONSE) |
305 |
| -# undef NODE_PROBE |
306 |
| -#endif |
| 307 | +#define V(name) env->SetMethod(target, #name, name); |
| 308 | + NODE_PROBES(V) |
| 309 | +#undef V |
| 310 | +#endif // defined HAVE_DTRACE || defined HAVE_ETW |
| 311 | +} |
| 312 | + |
| 313 | +void RegisterDtraceExternalReferences(ExternalReferenceRegistry* registry) { |
| 314 | +#if defined HAVE_DTRACE || defined HAVE_ETW |
| 315 | +#define V(name) registry->Register(name); |
| 316 | + NODE_PROBES(V) |
| 317 | +#undef V |
| 318 | +#endif // defined HAVE_DTRACE || defined HAVE_ETW |
307 | 319 | }
|
308 | 320 |
|
309 | 321 | } // namespace node
|
310 | 322 | NODE_MODULE_CONTEXT_AWARE_INTERNAL(dtrace, node::InitializeDTrace)
|
| 323 | +NODE_MODULE_EXTERNAL_REFERENCE(dtrace, node::RegisterDtraceExternalReferences) |
0 commit comments