diff --git a/node.gyp b/node.gyp index b948e1ca5a..67c8df208a 100644 --- a/node.gyp +++ b/node.gyp @@ -201,11 +201,8 @@ } ], [ 'node_use_systemtap=="true"', { 'defines': [ 'HAVE_SYSTEMTAP=1', 'STAP_SDT_V1=1' ], - 'dependencies': [ 'node_systemtap_header' ], - 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ], 'sources': [ 'src/node_dtrace.cc', - '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h', ], } ], [ 'node_use_etw=="true"', { @@ -393,7 +390,7 @@ 'target_name': 'node_dtrace_header', 'type': 'none', 'conditions': [ - [ 'node_use_dtrace=="true"', { + [ 'node_use_dtrace=="true" or node_use_systemtap=="true"', { 'actions': [ { 'action_name': 'node_dtrace_header', @@ -406,23 +403,6 @@ } ] ] }, - { - 'target_name': 'node_systemtap_header', - 'type': 'none', - 'conditions': [ - [ 'node_use_systemtap=="true"', { - 'actions': [ - { - 'action_name': 'node_systemtap_header', - 'inputs': [ 'src/node_systemtap.d' ], - 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h' ], - 'action': [ 'dtrace', '-h', '-C', '-s', '<@(_inputs)', - '-o', '<@(_outputs)' ] - } - ] - } ] - ] - }, { 'target_name': 'node_dtrace_provider', 'type': 'none', diff --git a/src/node.cc b/src/node.cc index 447d5f7ac5..b681c292af 100644 --- a/src/node.cc +++ b/src/node.cc @@ -77,7 +77,7 @@ typedef int mode_t; # include "node_crypto.h" #endif #if HAVE_SYSTEMTAP -#include "node_systemtap.h" +#include "node_provider.h" #endif #include "node_script.h" #include "v8_typed_array.h" diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc index 5c01a1753c..4fb4fcd44f 100644 --- a/src/node_dtrace.cc +++ b/src/node_dtrace.cc @@ -34,7 +34,7 @@ #include #include #include -#include "node_systemtap.h" +#include "node_provider.h" #include "node_dtrace.h" #else #define NODE_HTTP_SERVER_REQUEST(arg0, arg1) @@ -140,12 +140,8 @@ Handle DTRACE_NET_SERVER_CONNECTION(const Arguments& args) { HandleScope scope(node_isolate); SLURP_CONNECTION(args[0], conn); -#ifdef HAVE_SYSTEMTAP - NODE_NET_SERVER_CONNECTION(conn.fd, conn.remote, conn.port, \ - conn.buffered); -#else + NODE_NET_SERVER_CONNECTION(&conn, conn.remote, conn.port, conn.fd); -#endif return Undefined(node_isolate); } @@ -159,11 +155,8 @@ Handle DTRACE_NET_STREAM_END(const Arguments& args) { HandleScope scope(node_isolate); SLURP_CONNECTION(args[0], conn); -#ifdef HAVE_SYSTEMTAP - NODE_NET_STREAM_END(conn.fd, conn.remote, conn.port, conn.buffered); -#else + NODE_NET_STREAM_END(&conn, conn.remote, conn.port, conn.fd); -#endif return Undefined(node_isolate); } @@ -178,16 +171,12 @@ Handle DTRACE_NET_SOCKET_READ(const Arguments& args) { SLURP_CONNECTION(args[0], conn); -#ifdef HAVE_SYSTEMTAP - NODE_NET_SOCKET_READ(conn.fd, conn.remote, conn.port, conn.buffered); -#else if (!args[1]->IsNumber()) { return (ThrowException(Exception::Error(String::New("expected " "argument 1 to be number of bytes")))); } int nbytes = args[1]->Int32Value(); NODE_NET_SOCKET_READ(&conn, nbytes, conn.remote, conn.port, conn.fd); -#endif return Undefined(node_isolate); } @@ -202,16 +191,12 @@ Handle DTRACE_NET_SOCKET_WRITE(const Arguments& args) { SLURP_CONNECTION(args[0], conn); -#ifdef HAVE_SYSTEMTAP - NODE_NET_SOCKET_WRITE(conn.fd, conn.remote, conn.port, conn.buffered); -#else if (!args[1]->IsNumber()) { return (ThrowException(Exception::Error(String::New("expected " "argument 1 to be number of bytes")))); } int nbytes = args[1]->Int32Value(); NODE_NET_SOCKET_WRITE(&conn, nbytes, conn.remote, conn.port, conn.fd); -#endif return Undefined(node_isolate); } @@ -248,13 +233,9 @@ Handle DTRACE_HTTP_SERVER_REQUEST(const Arguments& args) { SLURP_CONNECTION(args[1], conn); -#ifdef HAVE_SYSTEMTAP - NODE_HTTP_SERVER_REQUEST(&req, conn.fd, conn.remote, conn.port, \ - conn.buffered); -#else NODE_HTTP_SERVER_REQUEST(&req, &conn, conn.remote, conn.port, req.method, \ req.url, conn.fd); -#endif + return Undefined(node_isolate); } @@ -267,11 +248,8 @@ Handle DTRACE_HTTP_SERVER_RESPONSE(const Arguments& args) { HandleScope scope(node_isolate); SLURP_CONNECTION(args[0], conn); -#ifdef HAVE_SYSTEMTAP - NODE_HTTP_SERVER_RESPONSE(conn.fd, conn.remote, conn.port, conn.buffered); -#else + NODE_HTTP_SERVER_RESPONSE(&conn, conn.remote, conn.port, conn.fd); -#endif return Undefined(node_isolate); } @@ -312,13 +290,10 @@ Handle DTRACE_HTTP_CLIENT_REQUEST(const Arguments& args) { *header = '\0'; SLURP_CONNECTION_HTTP_CLIENT(args[1], conn); -#ifdef HAVE_SYSTEMTAP - NODE_HTTP_CLIENT_REQUEST(&req, conn.fd, conn.remote, conn.port, \ - conn.buffered); -#else + NODE_HTTP_CLIENT_REQUEST(&req, &conn, conn.remote, conn.port, req.method, \ req.url, conn.fd); -#endif + return Undefined(node_isolate); } @@ -330,11 +305,8 @@ Handle DTRACE_HTTP_CLIENT_RESPONSE(const Arguments& args) { HandleScope scope(node_isolate); SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(args[0], args[1], conn); -#ifdef HAVE_SYSTEMTAP - NODE_HTTP_CLIENT_RESPONSE(conn.fd, conn.remote, conn.port, conn.buffered); -#else + NODE_HTTP_CLIENT_RESPONSE(&conn, conn.remote, conn.port, conn.fd); -#endif return Undefined(node_isolate); } @@ -342,11 +314,7 @@ Handle DTRACE_HTTP_CLIENT_RESPONSE(const Arguments& args) { #define NODE_PROBE(name) #name, name, Persistent() static int dtrace_gc_start(GCType type, GCCallbackFlags flags) { -#ifdef HAVE_SYSTEMTAP - NODE_GC_START(); -#else NODE_GC_START(type, flags); -#endif /* * We avoid the tail-call elimination of the USDT probe (which screws up * args) by forcing a return of 0. @@ -355,11 +323,7 @@ static int dtrace_gc_start(GCType type, GCCallbackFlags flags) { } static int dtrace_gc_done(GCType type, GCCallbackFlags flags) { -#ifdef HAVE_SYSTEMTAP - NODE_GC_DONE(); -#else NODE_GC_DONE(type, flags); -#endif return 0; } diff --git a/src/node_systemtap.d b/src/node_systemtap.d deleted file mode 100644 index 5247cc7fc2..0000000000 --- a/src/node_systemtap.d +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// Hints: -// This .d defines compiled in probes -// probes are handles (untyped pointers) -// v8 forward declared objs (dtrace_connection_t) are defined -// in node_dtrace.cc which builds an InitDtrace object which -// gets populated with the probes -// The probes gather the following: -// PROBE_REQUEST(req, fd, remote, port, buffered) -// PROBE_OTHER(fd, remote, port, buffered) -// other notes: -// using any PROBE_ENABLED() macros in dtrace.cc sdt broke it -// can only pass strings/ints/primitives not dtrace_connection_t -// conn or other structs -// verify probe existence by using -// $ stap -l 'process("out/Release/node").mark("*")' -// TODO: write .stp scripts (node.stp, node_v8ustack.stp + ???) - - -provider node { - probe http__client__request(string, int, string, int, int); - probe http__client__response(int, string, int, int); - probe http__server__request(string, int, string, int, int); - probe http__server__response(int, string, int, int); - probe net__server__connection(int, string, int, int); - probe net__socket__read(int, string, int, int); - probe net__socket__write(int, string, int, int); - probe net__stream__end(int, string, int, int); - probe gc__done(); - probe gc__start(); -};