New DTrace probes from CA team
This commit is contained in:
parent
778fb859c6
commit
e9257b859d
14
lib/http.js
14
lib/http.js
@ -597,7 +597,6 @@ OutgoingMessage.prototype.end = function(data, encoding) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.finished = true;
|
this.finished = true;
|
||||||
DTRACE_HTTP_SERVER_RESPONSE(this.connection);
|
|
||||||
|
|
||||||
// There is the first message on the outgoing queue, and we've sent
|
// There is the first message on the outgoing queue, and we've sent
|
||||||
// everything to the socket.
|
// everything to the socket.
|
||||||
@ -611,6 +610,13 @@ OutgoingMessage.prototype.end = function(data, encoding) {
|
|||||||
|
|
||||||
|
|
||||||
OutgoingMessage.prototype._finish = function() {
|
OutgoingMessage.prototype._finish = function() {
|
||||||
|
assert(this.connection);
|
||||||
|
if (this instanceof ServerResponse) {
|
||||||
|
DTRACE_HTTP_SERVER_RESPONSE(this.connection);
|
||||||
|
} else {
|
||||||
|
assert(this instanceof ClientRequest);
|
||||||
|
DTRACE_HTTP_CLIENT_REQUEST(this, this.connection);
|
||||||
|
}
|
||||||
this.emit('finish');
|
this.emit('finish');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1152,6 +1158,7 @@ Agent.prototype._establishNewConnection = function() {
|
|||||||
self._cycle();
|
self._cycle();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DTRACE_HTTP_CLIENT_RESPONSE(socket, self);
|
||||||
req.emit('response', res);
|
req.emit('response', res);
|
||||||
|
|
||||||
return isHeadResponse;
|
return isHeadResponse;
|
||||||
@ -1406,6 +1413,7 @@ Client.prototype._initParser = function() {
|
|||||||
self._cycle();
|
self._cycle();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DTRACE_HTTP_CLIENT_RESPONSE(self, self);
|
||||||
req.emit('response', res);
|
req.emit('response', res);
|
||||||
|
|
||||||
return isHeadResponse;
|
return isHeadResponse;
|
||||||
@ -1428,7 +1436,9 @@ Client.prototype._cycle = function() {
|
|||||||
this._httpMessage._flush();
|
this._httpMessage._flush();
|
||||||
} else {
|
} else {
|
||||||
var req = this._outgoing.shift();
|
var req = this._outgoing.shift();
|
||||||
if (req) req.assignSocket(this);
|
if (req) {
|
||||||
|
req.assignSocket(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -346,6 +346,7 @@ Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._onBufferChange();
|
this._onBufferChange();
|
||||||
|
DTRACE_NET_SOCKET_WRITE(this, 0);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -426,6 +427,7 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
bytesWritten = this._writeImpl(buffer, off, len, fd, 0);
|
bytesWritten = this._writeImpl(buffer, off, len, fd, 0);
|
||||||
|
DTRACE_NET_SOCKET_WRITE(this, bytesWritten);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.destroy(e);
|
this.destroy(e);
|
||||||
return false;
|
return false;
|
||||||
@ -608,6 +610,7 @@ Socket.prototype._onReadable = function() {
|
|||||||
bytesRead = self._readImpl(pool,
|
bytesRead = self._readImpl(pool,
|
||||||
pool.used,
|
pool.used,
|
||||||
pool.length - pool.used);
|
pool.length - pool.used);
|
||||||
|
DTRACE_NET_SOCKET_READ(this, bytesRead);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
self.destroy(e);
|
self.destroy(e);
|
||||||
return;
|
return;
|
||||||
|
@ -2057,7 +2057,9 @@ static void Load(int argc, char *argv[]) {
|
|||||||
Local<Object> global = v8::Context::GetCurrent()->Global();
|
Local<Object> global = v8::Context::GetCurrent()->Global();
|
||||||
Local<Value> args[1] = { Local<Value>::New(process) };
|
Local<Value> args[1] = { Local<Value>::New(process) };
|
||||||
|
|
||||||
|
#ifdef HAVE_DTRACE
|
||||||
InitDTrace(global);
|
InitDTrace(global);
|
||||||
|
#endif
|
||||||
|
|
||||||
f->Call(global, 1, args);
|
f->Call(global, 1, args);
|
||||||
|
|
||||||
|
@ -10,18 +10,21 @@ typedef struct {
|
|||||||
int32_t fd;
|
int32_t fd;
|
||||||
int32_t port;
|
int32_t port;
|
||||||
uint32_t remote;
|
uint32_t remote;
|
||||||
|
uint32_t buffered;
|
||||||
} node_dtrace_connection_t;
|
} node_dtrace_connection_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t fd;
|
int32_t fd;
|
||||||
int32_t port;
|
int32_t port;
|
||||||
uint64_t remote;
|
uint64_t remote;
|
||||||
|
uint32_t buffered;
|
||||||
} node_dtrace_connection64_t;
|
} node_dtrace_connection64_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fd;
|
int fd;
|
||||||
string remoteAddress;
|
string remoteAddress;
|
||||||
int remotePort;
|
int remotePort;
|
||||||
|
int bufferSize;
|
||||||
} node_connection_t;
|
} node_connection_t;
|
||||||
|
|
||||||
translator node_connection_t <node_dtrace_connection_t *nc> {
|
translator node_connection_t <node_dtrace_connection_t *nc> {
|
||||||
@ -33,6 +36,10 @@ translator node_connection_t <node_dtrace_connection_t *nc> {
|
|||||||
sizeof (int32_t))) :
|
sizeof (int32_t))) :
|
||||||
copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
|
copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
|
||||||
&((node_dtrace_connection64_t *)nc)->remote, sizeof (int64_t)));
|
&((node_dtrace_connection64_t *)nc)->remote, sizeof (int64_t)));
|
||||||
|
bufferSize = curpsinfo->pr_dmodel == PR_MODEL_ILP32 ?
|
||||||
|
*(uint32_t *)copyin((uintptr_t)&nc->buffered, sizeof (int32_t)) :
|
||||||
|
*(uint32_t *)copyin((uintptr_t)
|
||||||
|
&((node_dtrace_connection64_t *)nc)->buffered, sizeof (int32_t));
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -7,10 +7,20 @@
|
|||||||
#define NODE_HTTP_SERVER_REQUEST_ENABLED() (0)
|
#define NODE_HTTP_SERVER_REQUEST_ENABLED() (0)
|
||||||
#define NODE_HTTP_SERVER_RESPONSE(arg0)
|
#define NODE_HTTP_SERVER_RESPONSE(arg0)
|
||||||
#define NODE_HTTP_SERVER_RESPONSE_ENABLED() (0)
|
#define NODE_HTTP_SERVER_RESPONSE_ENABLED() (0)
|
||||||
|
#define NODE_HTTP_CLIENT_REQUEST(arg0, arg1)
|
||||||
|
#define NODE_HTTP_CLIENT_REQUEST_ENABLED() (0)
|
||||||
|
#define NODE_HTTP_CLIENT_RESPONSE(arg0)
|
||||||
|
#define NODE_HTTP_CLIENT_RESPONSE_ENABLED() (0)
|
||||||
#define NODE_NET_SERVER_CONNECTION(arg0)
|
#define NODE_NET_SERVER_CONNECTION(arg0)
|
||||||
#define NODE_NET_SERVER_CONNECTION_ENABLED() (0)
|
#define NODE_NET_SERVER_CONNECTION_ENABLED() (0)
|
||||||
#define NODE_NET_STREAM_END(arg0)
|
#define NODE_NET_STREAM_END(arg0)
|
||||||
#define NODE_NET_STREAM_END_ENABLED() (0)
|
#define NODE_NET_STREAM_END_ENABLED() (0)
|
||||||
|
#define NODE_NET_SOCKET_READ(arg0, arg1)
|
||||||
|
#define NODE_NET_SOCKET_READ_ENABLED() (0)
|
||||||
|
#define NODE_NET_SOCKET_WRITE(arg0, arg1)
|
||||||
|
#define NODE_NET_SOCKET_WRITE_ENABLED() (0)
|
||||||
|
#define NODE_GC_START(arg0, arg1)
|
||||||
|
#define NODE_GC_DONE(arg0, arg1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
@ -18,19 +28,69 @@ namespace node {
|
|||||||
using namespace v8;
|
using namespace v8;
|
||||||
|
|
||||||
#define SLURP_STRING(obj, member, valp) \
|
#define SLURP_STRING(obj, member, valp) \
|
||||||
|
if (!(obj)->IsObject()) { \
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected " \
|
||||||
|
"object for " #obj " to contain string member " #member)))); \
|
||||||
|
} \
|
||||||
String::Utf8Value _##member(obj->Get(String::New(#member))->ToString()); \
|
String::Utf8Value _##member(obj->Get(String::New(#member))->ToString()); \
|
||||||
if ((*(const char **)valp = *_##member) == NULL) \
|
if ((*(const char **)valp = *_##member) == NULL) \
|
||||||
*(const char **)valp = "<unknown>";
|
*(const char **)valp = "<unknown>";
|
||||||
|
|
||||||
#define SLURP_INT(obj, member, valp) \
|
#define SLURP_INT(obj, member, valp) \
|
||||||
|
if (!(obj)->IsObject()) { \
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected " \
|
||||||
|
"object for " #obj " to contain integer member " #member)))); \
|
||||||
|
} \
|
||||||
*valp = obj->Get(String::New(#member))->ToInteger()->Value();
|
*valp = obj->Get(String::New(#member))->ToInteger()->Value();
|
||||||
|
|
||||||
|
#define SLURP_OBJECT(obj, member, valp) \
|
||||||
|
if (!(obj)->IsObject()) { \
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected " \
|
||||||
|
"object for " #obj " to contain object member " #member)))); \
|
||||||
|
} \
|
||||||
|
*valp = Local<Object>::Cast(obj->Get(String::New(#member)));
|
||||||
|
|
||||||
#define SLURP_CONNECTION(arg, conn) \
|
#define SLURP_CONNECTION(arg, conn) \
|
||||||
|
if (!(arg)->IsObject()) { \
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected " \
|
||||||
|
"argument " #arg " to be a connection object")))); \
|
||||||
|
} \
|
||||||
node_dtrace_connection_t conn; \
|
node_dtrace_connection_t conn; \
|
||||||
Local<Object> _##conn = Local<Object>::Cast(arg); \
|
Local<Object> _##conn = Local<Object>::Cast(arg); \
|
||||||
SLURP_INT(_##conn, fd, &conn.fd); \
|
SLURP_INT(_##conn, fd, &conn.fd); \
|
||||||
SLURP_STRING(_##conn, remoteAddress, &conn.remote); \
|
SLURP_STRING(_##conn, remoteAddress, &conn.remote); \
|
||||||
SLURP_INT(_##conn, remotePort, &conn.port);
|
SLURP_INT(_##conn, remotePort, &conn.port); \
|
||||||
|
SLURP_INT(_##conn, bufferSize, &conn.buffered);
|
||||||
|
|
||||||
|
#define SLURP_CONNECTION_HTTP_CLIENT(arg, conn) \
|
||||||
|
if (!(arg)->IsObject()) { \
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected " \
|
||||||
|
"argument " #arg " to be a connection object")))); \
|
||||||
|
} \
|
||||||
|
node_dtrace_connection_t conn; \
|
||||||
|
Local<Object> _##conn = Local<Object>::Cast(arg); \
|
||||||
|
SLURP_INT(_##conn, fd, &conn.fd); \
|
||||||
|
SLURP_STRING(_##conn, host, &conn.remote); \
|
||||||
|
SLURP_INT(_##conn, port, &conn.port); \
|
||||||
|
SLURP_INT(_##conn, bufferSize, &conn.buffered);
|
||||||
|
|
||||||
|
#define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(arg0, arg1, conn) \
|
||||||
|
if (!(arg0)->IsObject()) { \
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected " \
|
||||||
|
"argument " #arg0 " to be a connection object")))); \
|
||||||
|
} \
|
||||||
|
if (!(arg1)->IsObject()) { \
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected " \
|
||||||
|
"argument " #arg1 " to be a connection object")))); \
|
||||||
|
} \
|
||||||
|
node_dtrace_connection_t conn; \
|
||||||
|
Local<Object> _##conn = Local<Object>::Cast(arg0); \
|
||||||
|
SLURP_INT(_##conn, fd, &conn.fd); \
|
||||||
|
SLURP_INT(_##conn, bufferSize, &conn.buffered); \
|
||||||
|
_##conn = Local<Object>::Cast(arg1); \
|
||||||
|
SLURP_STRING(_##conn, host, &conn.remote); \
|
||||||
|
SLURP_INT(_##conn, port, &conn.port);
|
||||||
|
|
||||||
|
|
||||||
Handle<Value> DTRACE_NET_SERVER_CONNECTION(const Arguments& args) {
|
Handle<Value> DTRACE_NET_SERVER_CONNECTION(const Arguments& args) {
|
||||||
if (!NODE_NET_SERVER_CONNECTION_ENABLED())
|
if (!NODE_NET_SERVER_CONNECTION_ENABLED())
|
||||||
@ -56,6 +116,48 @@ Handle<Value> DTRACE_NET_STREAM_END(const Arguments& args) {
|
|||||||
return Undefined();
|
return Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle<Value> DTRACE_NET_SOCKET_READ(const Arguments& args) {
|
||||||
|
if (!NODE_NET_SOCKET_READ_ENABLED())
|
||||||
|
return Undefined();
|
||||||
|
|
||||||
|
HandleScope scope;
|
||||||
|
int nbytes;
|
||||||
|
|
||||||
|
SLURP_CONNECTION(args[0], conn);
|
||||||
|
|
||||||
|
if (!args[1]->IsNumber()) {
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected "
|
||||||
|
"argument 1 to be number of bytes"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
nbytes = args[1]->Int32Value();
|
||||||
|
|
||||||
|
NODE_NET_SOCKET_READ(&conn, nbytes);
|
||||||
|
|
||||||
|
return Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle<Value> DTRACE_NET_SOCKET_WRITE(const Arguments& args) {
|
||||||
|
if (!NODE_NET_SOCKET_WRITE_ENABLED())
|
||||||
|
return Undefined();
|
||||||
|
|
||||||
|
HandleScope scope;
|
||||||
|
int nbytes;
|
||||||
|
|
||||||
|
SLURP_CONNECTION(args[0], conn);
|
||||||
|
|
||||||
|
if (!args[1]->IsNumber()) {
|
||||||
|
return (ThrowException(Exception::Error(String::New("expected "
|
||||||
|
"argument 1 to be number of bytes"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
nbytes = args[1]->Int32Value();
|
||||||
|
|
||||||
|
NODE_NET_SOCKET_WRITE(&conn, nbytes);
|
||||||
|
|
||||||
|
return Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
Handle<Value> DTRACE_HTTP_SERVER_REQUEST(const Arguments& args) {
|
Handle<Value> DTRACE_HTTP_SERVER_REQUEST(const Arguments& args) {
|
||||||
node_dtrace_http_request_t req;
|
node_dtrace_http_request_t req;
|
||||||
|
|
||||||
@ -65,7 +167,6 @@ Handle<Value> DTRACE_HTTP_SERVER_REQUEST(const Arguments& args) {
|
|||||||
HandleScope scope;
|
HandleScope scope;
|
||||||
|
|
||||||
Local<Object> arg0 = Local<Object>::Cast(args[0]);
|
Local<Object> arg0 = Local<Object>::Cast(args[0]);
|
||||||
Local<Object> arg1 = Local<Object>::Cast(args[1]);
|
|
||||||
|
|
||||||
SLURP_STRING(arg0, url, &req.url);
|
SLURP_STRING(arg0, url, &req.url);
|
||||||
SLURP_STRING(arg0, method, &req.method);
|
SLURP_STRING(arg0, method, &req.method);
|
||||||
@ -88,8 +189,72 @@ Handle<Value> DTRACE_HTTP_SERVER_RESPONSE(const Arguments& args) {
|
|||||||
return Undefined();
|
return Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle<Value> DTRACE_HTTP_CLIENT_REQUEST(const Arguments& args) {
|
||||||
|
node_dtrace_http_request_t req;
|
||||||
|
char *header;
|
||||||
|
|
||||||
|
if (!NODE_HTTP_CLIENT_REQUEST_ENABLED())
|
||||||
|
return Undefined();
|
||||||
|
|
||||||
|
HandleScope scope;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For the method and URL, we're going to dig them out of the header. This
|
||||||
|
* is not as efficient as it could be, but we would rather not force the
|
||||||
|
* caller here to retain their method and URL until the time at which
|
||||||
|
* DTRACE_HTTP_CLIENT_REQUEST can be called.
|
||||||
|
*/
|
||||||
|
Local<Object> arg0 = Local<Object>::Cast(args[0]);
|
||||||
|
SLURP_STRING(arg0, _header, &header);
|
||||||
|
|
||||||
|
req.method = header;
|
||||||
|
|
||||||
|
while (*header != '\0' && *header != ' ')
|
||||||
|
header++;
|
||||||
|
|
||||||
|
if (*header != '\0')
|
||||||
|
*header++ = '\0';
|
||||||
|
|
||||||
|
req.url = header;
|
||||||
|
|
||||||
|
while (*header != '\0' && *header != ' ')
|
||||||
|
header++;
|
||||||
|
|
||||||
|
*header = '\0';
|
||||||
|
|
||||||
|
SLURP_CONNECTION_HTTP_CLIENT(args[1], conn);
|
||||||
|
NODE_HTTP_CLIENT_REQUEST(&req, &conn);
|
||||||
|
return Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle<Value> DTRACE_HTTP_CLIENT_RESPONSE(const Arguments& args) {
|
||||||
|
if (!NODE_HTTP_CLIENT_RESPONSE_ENABLED())
|
||||||
|
return Undefined();
|
||||||
|
|
||||||
|
HandleScope scope;
|
||||||
|
|
||||||
|
SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(args[0], args[1], conn);
|
||||||
|
NODE_HTTP_CLIENT_RESPONSE(&conn);
|
||||||
|
|
||||||
|
return Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
#define NODE_PROBE(name) #name, name
|
#define NODE_PROBE(name) #name, name
|
||||||
|
|
||||||
|
static int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
|
||||||
|
NODE_GC_START(type, flags);
|
||||||
|
/*
|
||||||
|
* We avoid the tail-call elimination of the USDT probe (which screws up
|
||||||
|
* args) by forcing a return of 0.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dtrace_gc_done(GCType type, GCCallbackFlags flags) {
|
||||||
|
NODE_GC_DONE(type, flags);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void InitDTrace(Handle<Object> target) {
|
void InitDTrace(Handle<Object> target) {
|
||||||
static struct {
|
static struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -98,8 +263,12 @@ void InitDTrace(Handle<Object> target) {
|
|||||||
} tab[] = {
|
} tab[] = {
|
||||||
{ NODE_PROBE(DTRACE_NET_SERVER_CONNECTION) },
|
{ NODE_PROBE(DTRACE_NET_SERVER_CONNECTION) },
|
||||||
{ NODE_PROBE(DTRACE_NET_STREAM_END) },
|
{ NODE_PROBE(DTRACE_NET_STREAM_END) },
|
||||||
|
{ NODE_PROBE(DTRACE_NET_SOCKET_READ) },
|
||||||
|
{ NODE_PROBE(DTRACE_NET_SOCKET_WRITE) },
|
||||||
{ NODE_PROBE(DTRACE_HTTP_SERVER_REQUEST) },
|
{ NODE_PROBE(DTRACE_HTTP_SERVER_REQUEST) },
|
||||||
{ NODE_PROBE(DTRACE_HTTP_SERVER_RESPONSE) },
|
{ NODE_PROBE(DTRACE_HTTP_SERVER_RESPONSE) },
|
||||||
|
{ NODE_PROBE(DTRACE_HTTP_CLIENT_REQUEST) },
|
||||||
|
{ NODE_PROBE(DTRACE_HTTP_CLIENT_RESPONSE) },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -108,6 +277,11 @@ void InitDTrace(Handle<Object> target) {
|
|||||||
FunctionTemplate::New(tab[i].func));
|
FunctionTemplate::New(tab[i].func));
|
||||||
target->Set(String::NewSymbol(tab[i].name), tab[i].templ->GetFunction());
|
target->Set(String::NewSymbol(tab[i].name), tab[i].templ->GetFunction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DTRACE
|
||||||
|
v8::V8::AddGCPrologueCallback((GCPrologueCallback)dtrace_gc_start);
|
||||||
|
v8::V8::AddGCEpilogueCallback((GCEpilogueCallback)dtrace_gc_done);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ typedef struct {
|
|||||||
int32_t fd;
|
int32_t fd;
|
||||||
int32_t port;
|
int32_t port;
|
||||||
char *remote;
|
char *remote;
|
||||||
|
int32_t buffered;
|
||||||
} node_dtrace_connection_t;
|
} node_dtrace_connection_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -30,11 +30,22 @@ provider node {
|
|||||||
(node_connection_t *c);
|
(node_connection_t *c);
|
||||||
probe net__stream__end(node_dtrace_connection_t *c) :
|
probe net__stream__end(node_dtrace_connection_t *c) :
|
||||||
(node_connection_t *c);
|
(node_connection_t *c);
|
||||||
|
probe net__socket__read(node_dtrace_connection_t *c, int b) :
|
||||||
|
(node_connection_t *c, int b);
|
||||||
|
probe net__socket__write(node_dtrace_connection_t *c, int b) :
|
||||||
|
(node_connection_t *c, int b);
|
||||||
probe http__server__request(node_dtrace_http_request_t *h,
|
probe http__server__request(node_dtrace_http_request_t *h,
|
||||||
node_dtrace_connection_t *c) :
|
node_dtrace_connection_t *c) :
|
||||||
(node_http_request_t *h, node_connection_t *c);
|
(node_http_request_t *h, node_connection_t *c);
|
||||||
probe http__server__response(node_dtrace_connection_t *c) :
|
probe http__server__response(node_dtrace_connection_t *c) :
|
||||||
(node_connection_t *c);
|
(node_connection_t *c);
|
||||||
|
probe http__client__request(node_dtrace_http_request_t *h,
|
||||||
|
node_dtrace_connection_t *c) :
|
||||||
|
(node_http_request_t *h, node_connection_t *c);
|
||||||
|
probe http__client__response(node_dtrace_connection_t *c) :
|
||||||
|
(node_connection_t *c);
|
||||||
|
probe gc__start(int t, int f);
|
||||||
|
probe gc__done(int t, int f);
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma D attributes Evolving/Evolving/ISA provider node provider
|
#pragma D attributes Evolving/Evolving/ISA provider node provider
|
||||||
|
@ -39,11 +39,15 @@ process.on('exit', function() {
|
|||||||
process,
|
process,
|
||||||
global];
|
global];
|
||||||
|
|
||||||
if (DTRACE_HTTP_SERVER_RESPONSE) {
|
if (global.DTRACE_HTTP_SERVER_RESPONSE) {
|
||||||
knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE);
|
knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE);
|
||||||
knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST);
|
knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST);
|
||||||
|
knownGlobals.push(DTRACE_HTTP_CLIENT_RESPONSE);
|
||||||
|
knownGlobals.push(DTRACE_HTTP_CLIENT_REQUEST);
|
||||||
knownGlobals.push(DTRACE_NET_STREAM_END);
|
knownGlobals.push(DTRACE_NET_STREAM_END);
|
||||||
knownGlobals.push(DTRACE_NET_SERVER_CONNECTION);
|
knownGlobals.push(DTRACE_NET_SERVER_CONNECTION);
|
||||||
|
knownGlobals.push(DTRACE_NET_SOCKET_READ);
|
||||||
|
knownGlobals.push(DTRACE_NET_SOCKET_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var x in global) {
|
for (var x in global) {
|
||||||
|
23
wscript
23
wscript
@ -604,15 +604,20 @@ def build(bld):
|
|||||||
make_macros(macros_loc_default, "macro assert(x) = ;\n")
|
make_macros(macros_loc_default, "macro assert(x) = ;\n")
|
||||||
|
|
||||||
if not bld.env["USE_DTRACE"]:
|
if not bld.env["USE_DTRACE"]:
|
||||||
make_macros(macros_loc_default, "macro DTRACE_HTTP_SERVER_RESPONSE(x) = ;\n");
|
probes = [
|
||||||
make_macros(macros_loc_default, "macro DTRACE_HTTP_SERVER_REQUEST(x) = ;\n");
|
'DTRACE_HTTP_CLIENT_REQUEST',
|
||||||
make_macros(macros_loc_default, "macro DTRACE_NET_SERVER_CONNECTION(x) = ;\n");
|
'DTRACE_HTTP_CLIENT_RESPONSE',
|
||||||
make_macros(macros_loc_default, "macro DTRACE_NET_STREAM_END(x) = ;\n");
|
'DTRACE_HTTP_SERVER_REQUEST',
|
||||||
make_macros(macros_loc_debug, "macro DTRACE_HTTP_SERVER_RESPONSE(x) = ;\n");
|
'DTRACE_HTTP_SERVER_RESPONSE',
|
||||||
make_macros(macros_loc_debug, "macro DTRACE_HTTP_SERVER_REQUEST(x) = ;\n");
|
'DTRACE_NET_SERVER_CONNECTION',
|
||||||
make_macros(macros_loc_debug, "macro DTRACE_NET_SERVER_CONNECTION(x) = ;\n");
|
'DTRACE_NET_STREAM_END',
|
||||||
make_macros(macros_loc_debug, "macro DTRACE_NET_STREAM_END(x) = ;\n");
|
'DTRACE_NET_SOCKET_READ',
|
||||||
|
'DTRACE_NET_SOCKET_WRITE'
|
||||||
|
]
|
||||||
|
|
||||||
|
for probe in probes:
|
||||||
|
make_macros(macros_loc_default, "macro %s(x) = ;\n" % probe)
|
||||||
|
make_macros(macros_loc_debug, "macro %s(x) = ;\n" % probe)
|
||||||
|
|
||||||
def javascript_in_c(task):
|
def javascript_in_c(task):
|
||||||
env = task.env
|
env = task.env
|
||||||
@ -657,7 +662,7 @@ def build(bld):
|
|||||||
if bld.env["USE_DEBUG"]:
|
if bld.env["USE_DEBUG"]:
|
||||||
dtrace_g = dtrace.clone("debug")
|
dtrace_g = dtrace.clone("debug")
|
||||||
|
|
||||||
bld.install_files('/usr/lib/dtrace', 'src/node.d')
|
bld.install_files('${PREFIX}/usr/lib/dtrace', 'src/node.d')
|
||||||
|
|
||||||
if sys.platform.startswith("sunos"):
|
if sys.platform.startswith("sunos"):
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user