Skip to content

Commit 23509eb

Browse files
committed
dtrace: unify dtrace and systemtap interfaces
1 parent f8193ab commit 23509eb

4 files changed

Lines changed: 10 additions & 117 deletions

File tree

node.gyp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,8 @@
201201
} ],
202202
[ 'node_use_systemtap=="true"', {
203203
'defines': [ 'HAVE_SYSTEMTAP=1', 'STAP_SDT_V1=1' ],
204-
'dependencies': [ 'node_systemtap_header' ],
205-
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
206204
'sources': [
207205
'src/node_dtrace.cc',
208-
'<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h',
209206
],
210207
} ],
211208
[ 'node_use_etw=="true"', {
@@ -393,7 +390,7 @@
393390
'target_name': 'node_dtrace_header',
394391
'type': 'none',
395392
'conditions': [
396-
[ 'node_use_dtrace=="true"', {
393+
[ 'node_use_dtrace=="true" or node_use_systemtap=="true"', {
397394
'actions': [
398395
{
399396
'action_name': 'node_dtrace_header',
@@ -406,23 +403,6 @@
406403
} ]
407404
]
408405
},
409-
{
410-
'target_name': 'node_systemtap_header',
411-
'type': 'none',
412-
'conditions': [
413-
[ 'node_use_systemtap=="true"', {
414-
'actions': [
415-
{
416-
'action_name': 'node_systemtap_header',
417-
'inputs': [ 'src/node_systemtap.d' ],
418-
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h' ],
419-
'action': [ 'dtrace', '-h', '-C', '-s', '<@(_inputs)',
420-
'-o', '<@(_outputs)' ]
421-
}
422-
]
423-
} ]
424-
]
425-
},
426406
{
427407
'target_name': 'node_dtrace_provider',
428408
'type': 'none',

src/node.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typedef int mode_t;
7777
# include "node_crypto.h"
7878
#endif
7979
#if HAVE_SYSTEMTAP
80-
#include "node_systemtap.h"
80+
#include "node_provider.h"
8181
#endif
8282
#include "node_script.h"
8383
#include "v8_typed_array.h"

src/node_dtrace.cc

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <node.h>
3535
#include <v8.h>
3636
#include <sys/sdt.h>
37-
#include "node_systemtap.h"
37+
#include "node_provider.h"
3838
#include "node_dtrace.h"
3939
#else
4040
#define NODE_HTTP_SERVER_REQUEST(arg0, arg1)
@@ -140,12 +140,8 @@ Handle<Value> DTRACE_NET_SERVER_CONNECTION(const Arguments& args) {
140140
HandleScope scope(node_isolate);
141141

142142
SLURP_CONNECTION(args[0], conn);
143-
#ifdef HAVE_SYSTEMTAP
144-
NODE_NET_SERVER_CONNECTION(conn.fd, conn.remote, conn.port, \
145-
conn.buffered);
146-
#else
143+
147144
NODE_NET_SERVER_CONNECTION(&conn, conn.remote, conn.port, conn.fd);
148-
#endif
149145

150146
return Undefined(node_isolate);
151147
}
@@ -159,11 +155,8 @@ Handle<Value> DTRACE_NET_STREAM_END(const Arguments& args) {
159155
HandleScope scope(node_isolate);
160156

161157
SLURP_CONNECTION(args[0], conn);
162-
#ifdef HAVE_SYSTEMTAP
163-
NODE_NET_STREAM_END(conn.fd, conn.remote, conn.port, conn.buffered);
164-
#else
158+
165159
NODE_NET_STREAM_END(&conn, conn.remote, conn.port, conn.fd);
166-
#endif
167160

168161
return Undefined(node_isolate);
169162
}
@@ -178,16 +171,12 @@ Handle<Value> DTRACE_NET_SOCKET_READ(const Arguments& args) {
178171

179172
SLURP_CONNECTION(args[0], conn);
180173

181-
#ifdef HAVE_SYSTEMTAP
182-
NODE_NET_SOCKET_READ(conn.fd, conn.remote, conn.port, conn.buffered);
183-
#else
184174
if (!args[1]->IsNumber()) {
185175
return (ThrowException(Exception::Error(String::New("expected "
186176
"argument 1 to be number of bytes"))));
187177
}
188178
int nbytes = args[1]->Int32Value();
189179
NODE_NET_SOCKET_READ(&conn, nbytes, conn.remote, conn.port, conn.fd);
190-
#endif
191180

192181
return Undefined(node_isolate);
193182
}
@@ -202,16 +191,12 @@ Handle<Value> DTRACE_NET_SOCKET_WRITE(const Arguments& args) {
202191

203192
SLURP_CONNECTION(args[0], conn);
204193

205-
#ifdef HAVE_SYSTEMTAP
206-
NODE_NET_SOCKET_WRITE(conn.fd, conn.remote, conn.port, conn.buffered);
207-
#else
208194
if (!args[1]->IsNumber()) {
209195
return (ThrowException(Exception::Error(String::New("expected "
210196
"argument 1 to be number of bytes"))));
211197
}
212198
int nbytes = args[1]->Int32Value();
213199
NODE_NET_SOCKET_WRITE(&conn, nbytes, conn.remote, conn.port, conn.fd);
214-
#endif
215200

216201
return Undefined(node_isolate);
217202
}
@@ -248,13 +233,9 @@ Handle<Value> DTRACE_HTTP_SERVER_REQUEST(const Arguments& args) {
248233

249234
SLURP_CONNECTION(args[1], conn);
250235

251-
#ifdef HAVE_SYSTEMTAP
252-
NODE_HTTP_SERVER_REQUEST(&req, conn.fd, conn.remote, conn.port, \
253-
conn.buffered);
254-
#else
255236
NODE_HTTP_SERVER_REQUEST(&req, &conn, conn.remote, conn.port, req.method, \
256237
req.url, conn.fd);
257-
#endif
238+
258239
return Undefined(node_isolate);
259240
}
260241

@@ -267,11 +248,8 @@ Handle<Value> DTRACE_HTTP_SERVER_RESPONSE(const Arguments& args) {
267248
HandleScope scope(node_isolate);
268249

269250
SLURP_CONNECTION(args[0], conn);
270-
#ifdef HAVE_SYSTEMTAP
271-
NODE_HTTP_SERVER_RESPONSE(conn.fd, conn.remote, conn.port, conn.buffered);
272-
#else
251+
273252
NODE_HTTP_SERVER_RESPONSE(&conn, conn.remote, conn.port, conn.fd);
274-
#endif
275253

276254
return Undefined(node_isolate);
277255
}
@@ -312,13 +290,10 @@ Handle<Value> DTRACE_HTTP_CLIENT_REQUEST(const Arguments& args) {
312290
*header = '\0';
313291

314292
SLURP_CONNECTION_HTTP_CLIENT(args[1], conn);
315-
#ifdef HAVE_SYSTEMTAP
316-
NODE_HTTP_CLIENT_REQUEST(&req, conn.fd, conn.remote, conn.port, \
317-
conn.buffered);
318-
#else
293+
319294
NODE_HTTP_CLIENT_REQUEST(&req, &conn, conn.remote, conn.port, req.method, \
320295
req.url, conn.fd);
321-
#endif
296+
322297
return Undefined(node_isolate);
323298
}
324299

@@ -330,23 +305,16 @@ Handle<Value> DTRACE_HTTP_CLIENT_RESPONSE(const Arguments& args) {
330305
HandleScope scope(node_isolate);
331306

332307
SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(args[0], args[1], conn);
333-
#ifdef HAVE_SYSTEMTAP
334-
NODE_HTTP_CLIENT_RESPONSE(conn.fd, conn.remote, conn.port, conn.buffered);
335-
#else
308+
336309
NODE_HTTP_CLIENT_RESPONSE(&conn, conn.remote, conn.port, conn.fd);
337-
#endif
338310

339311
return Undefined(node_isolate);
340312
}
341313

342314
#define NODE_PROBE(name) #name, name, Persistent<FunctionTemplate>()
343315

344316
static int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
345-
#ifdef HAVE_SYSTEMTAP
346-
NODE_GC_START();
347-
#else
348317
NODE_GC_START(type, flags);
349-
#endif
350318
/*
351319
* We avoid the tail-call elimination of the USDT probe (which screws up
352320
* args) by forcing a return of 0.
@@ -355,11 +323,7 @@ static int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
355323
}
356324

357325
static int dtrace_gc_done(GCType type, GCCallbackFlags flags) {
358-
#ifdef HAVE_SYSTEMTAP
359-
NODE_GC_DONE();
360-
#else
361326
NODE_GC_DONE(type, flags);
362-
#endif
363327
return 0;
364328
}
365329

src/node_systemtap.d

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)