• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21 
22 #ifndef SRC_NODE_WIN32_ETW_PROVIDER_H_
23 #define SRC_NODE_WIN32_ETW_PROVIDER_H_
24 
25 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26 
27 #include "node_dtrace.h"
28 #include <evntprov.h>
29 
30 namespace node {
31 
32 #if defined(_MSC_VER)
33 # define INLINE __forceinline
34 #else
35 # define INLINE inline
36 #endif
37 
38 typedef ULONG (NTAPI* EventRegisterFunc)(
39   LPCGUID ProviderId,
40   PENABLECALLBACK EnableCallback,
41   PVOID CallbackContext,
42   PREGHANDLE RegHandle
43 );
44 
45 typedef ULONG (NTAPI* EventUnregisterFunc)(
46   REGHANDLE RegHandle
47 );
48 
49 typedef ULONG (NTAPI* EventWriteFunc)(
50   REGHANDLE RegHandle,
51   PCEVENT_DESCRIPTOR EventDescriptor,
52   ULONG UserDataCount,
53   PEVENT_DATA_DESCRIPTOR UserData
54 );
55 
56 void init_etw();
57 void shutdown_etw();
58 
59 INLINE void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req,
60   node_dtrace_connection_t* conn, const char* remote, int port,
61   const char* method, const char* url, int fd);
62 INLINE void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn,
63   const char* remote, int port, int fd);
64 INLINE void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req,
65   node_dtrace_connection_t* conn, const char* remote, int port,
66   const char* method, const char* url, int fd);
67 INLINE void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn,
68   const char* remote, int port, int fd);
69 INLINE void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn,
70   const char* remote, int port, int fd);
71 INLINE void NODE_NET_STREAM_END(node_dtrace_connection_t* conn,
72   const char* remote, int port, int fd);
73 INLINE void NODE_GC_START(v8::GCType type,
74                           v8::GCCallbackFlags flags,
75                           v8::Isolate* isolate);
76 INLINE void NODE_GC_DONE(v8::GCType type,
77                          v8::GCCallbackFlags flags,
78                          v8::Isolate* isolate);
79 INLINE void NODE_V8SYMBOL_REMOVE(const void* addr1, const void* addr2);
80 INLINE void NODE_V8SYMBOL_MOVE(const void* addr1, const void* addr2);
81 INLINE void NODE_V8SYMBOL_RESET();
82 INLINE void NODE_V8SYMBOL_ADD(LPCSTR symbol,
83                               int symbol_len,
84                               const void* addr1,
85                               int len);
86 
87 INLINE bool NODE_HTTP_SERVER_REQUEST_ENABLED();
88 INLINE bool NODE_HTTP_SERVER_RESPONSE_ENABLED();
89 INLINE bool NODE_HTTP_CLIENT_REQUEST_ENABLED();
90 INLINE bool NODE_HTTP_CLIENT_RESPONSE_ENABLED();
91 INLINE bool NODE_NET_SERVER_CONNECTION_ENABLED();
92 INLINE bool NODE_NET_STREAM_END_ENABLED();
93 INLINE bool NODE_V8SYMBOL_ENABLED();
94 
95 }  // namespace node
96 
97 #endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
98 
99 #endif  // SRC_NODE_WIN32_ETW_PROVIDER_H_
100