diff options
author | James M Snell <jasnell@gmail.com> | 2018-08-23 10:16:00 -0700 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-09-19 11:07:01 +0200 |
commit | 9d71e6a6071134789a30471302d9735250dea96c (patch) | |
tree | 67a21cf09e3f5e3dd152ba22717ace87860e2f23 /src | |
parent | 6e746f1a55e5d94f1a8330d3436a64ed8d6f639b (diff) | |
download | android-node-v8-9d71e6a6071134789a30471302d9735250dea96c.tar.gz android-node-v8-9d71e6a6071134789a30471302d9735250dea96c.tar.bz2 android-node-v8-9d71e6a6071134789a30471302d9735250dea96c.zip |
src: deprecate global COUNTER_* and remove perfctr
To support Performance Counters on Windows, a number of
global `COUNTER_` methods were added that are undocumented
and really only intended to be used internally by Node.js.
Unfortunately, the perfctr support apparently hasn't even
worked for quite a while and no one has even complained.
This removes the perfctr support and replaces the global
functions with deprecated non-ops for now, with the intent
of removing those outright in the next major release cycle.
PR-URL: https://github.com/nodejs/node/pull/22485
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 8 | ||||
-rw-r--r-- | src/node_counters.cc | 145 | ||||
-rw-r--r-- | src/node_counters.h | 59 | ||||
-rw-r--r-- | src/node_internals.h | 2 | ||||
-rw-r--r-- | src/node_win32_perfctr_provider.cc | 345 | ||||
-rw-r--r-- | src/node_win32_perfctr_provider.h | 58 | ||||
-rw-r--r-- | src/noperfctr_macros.py | 9 | ||||
-rw-r--r-- | src/res/node_perfctr_provider.man | 107 | ||||
-rw-r--r-- | src/stream_wrap.cc | 12 | ||||
-rw-r--r-- | src/tls_wrap.cc | 3 |
10 files changed, 1 insertions, 747 deletions
diff --git a/src/node.cc b/src/node.cc index cd51734781..5e43361923 100644 --- a/src/node.cc +++ b/src/node.cc @@ -31,10 +31,6 @@ #include "node_context_data.h" #include "tracing/traced_value.h" -#if defined HAVE_PERFCTR -#include "node_counters.h" -#endif - #if HAVE_OPENSSL #include "node_crypto.h" #endif @@ -2152,10 +2148,6 @@ void LoadEnvironment(Environment* env) { InitDTrace(env, global); #endif -#if defined HAVE_PERFCTR - InitPerfCounters(env, global); -#endif - // Enable handling of uncaught exceptions // (FatalException(), break on uncaught exception in debugger) // diff --git a/src/node_counters.cc b/src/node_counters.cc deleted file mode 100644 index 99b3b8fd8b..0000000000 --- a/src/node_counters.cc +++ /dev/null @@ -1,145 +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. - -#include "node_counters.h" -#include "node_internals.h" -#include "uv.h" -#include "env-inl.h" - -#include <string.h> - - -namespace node { - -using v8::FunctionCallbackInfo; -using v8::FunctionTemplate; -using v8::GCCallbackFlags; -using v8::GCType; -using v8::HandleScope; -using v8::Isolate; -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - -static uint64_t counter_gc_start_time; -static uint64_t counter_gc_end_time; - - -void COUNTER_NET_SERVER_CONNECTION(const FunctionCallbackInfo<Value>&) { - NODE_COUNT_SERVER_CONN_OPEN(); -} - - -void COUNTER_NET_SERVER_CONNECTION_CLOSE(const FunctionCallbackInfo<Value>&) { - NODE_COUNT_SERVER_CONN_CLOSE(); -} - - -void COUNTER_HTTP_SERVER_REQUEST(const FunctionCallbackInfo<Value>&) { - NODE_COUNT_HTTP_SERVER_REQUEST(); -} - - -void COUNTER_HTTP_SERVER_RESPONSE(const FunctionCallbackInfo<Value>&) { - NODE_COUNT_HTTP_SERVER_RESPONSE(); -} - - -void COUNTER_HTTP_CLIENT_REQUEST(const FunctionCallbackInfo<Value>&) { - NODE_COUNT_HTTP_CLIENT_REQUEST(); -} - - -void COUNTER_HTTP_CLIENT_RESPONSE(const FunctionCallbackInfo<Value>&) { - NODE_COUNT_HTTP_CLIENT_RESPONSE(); -} - - -static void counter_gc_start(Isolate* isolate, - GCType type, - GCCallbackFlags flags) { - counter_gc_start_time = NODE_COUNT_GET_GC_RAWTIME(); -} - - -static void counter_gc_done(Isolate* isolate, - GCType type, - GCCallbackFlags flags) { - uint64_t endgc = NODE_COUNT_GET_GC_RAWTIME(); - if (endgc != 0) { - uint64_t totalperiod = endgc - counter_gc_end_time; - uint64_t gcperiod = endgc - counter_gc_start_time; - - if (totalperiod > 0) { - unsigned int percent = static_cast<unsigned int>( - (gcperiod * 100) / totalperiod); - - NODE_COUNT_GC_PERCENTTIME(percent); - counter_gc_end_time = endgc; - } - } -} - - -void InitPerfCounters(Environment* env, Local<Object> target) { - HandleScope scope(env->isolate()); - - static struct { - const char* name; - void (*func)(const FunctionCallbackInfo<Value>&); - } tab[] = { -#define NODE_PROBE(name) #name, name - { NODE_PROBE(COUNTER_NET_SERVER_CONNECTION) }, - { NODE_PROBE(COUNTER_NET_SERVER_CONNECTION_CLOSE) }, - { NODE_PROBE(COUNTER_HTTP_SERVER_REQUEST) }, - { NODE_PROBE(COUNTER_HTTP_SERVER_RESPONSE) }, - { NODE_PROBE(COUNTER_HTTP_CLIENT_REQUEST) }, - { NODE_PROBE(COUNTER_HTTP_CLIENT_RESPONSE) } -#undef NODE_PROBE - }; - - for (size_t i = 0; i < arraysize(tab); i++) { - Local<String> key = OneByteString(env->isolate(), tab[i].name); - Local<Value> val = env->NewFunctionTemplate(tab[i].func)->GetFunction(); - target->Set(key, val); - } - - // Only Windows performance counters supported - // To enable other OS, use conditional compilation here - InitPerfCountersWin32(); - - // init times for GC percent calculation and hook callbacks - counter_gc_start_time = NODE_COUNT_GET_GC_RAWTIME(); - counter_gc_end_time = counter_gc_start_time; - - env->isolate()->AddGCPrologueCallback(counter_gc_start); - env->isolate()->AddGCEpilogueCallback(counter_gc_done); -} - - -void TermPerfCounters(Local<Object> target) { - // Only Windows performance counters supported - // To enable other OS, use conditional compilation here - TermPerfCountersWin32(); -} - -} // namespace node diff --git a/src/node_counters.h b/src/node_counters.h deleted file mode 100644 index c8a1a88f0b..0000000000 --- a/src/node_counters.h +++ /dev/null @@ -1,59 +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. - -#ifndef SRC_NODE_COUNTERS_H_ -#define SRC_NODE_COUNTERS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_internals.h" - -#ifdef HAVE_PERFCTR -#include "node_win32_perfctr_provider.h" -#else -#define NODE_COUNTER_ENABLED() (false) -#define NODE_COUNT_GC_PERCENTTIME(percent) do { } while (false) -#define NODE_COUNT_GET_GC_RAWTIME() do { } while (false) -#define NODE_COUNT_HTTP_CLIENT_REQUEST() do { } while (false) -#define NODE_COUNT_HTTP_CLIENT_RESPONSE() do { } while (false) -#define NODE_COUNT_HTTP_SERVER_REQUEST() do { } while (false) -#define NODE_COUNT_HTTP_SERVER_RESPONSE() do { } while (false) -#define NODE_COUNT_NET_BYTES_RECV(bytes) do { } while (false) -#define NODE_COUNT_NET_BYTES_SENT(bytes) do { } while (false) -#define NODE_COUNT_PIPE_BYTES_RECV(bytes) do { } while (false) -#define NODE_COUNT_PIPE_BYTES_SENT(bytes) do { } while (false) -#define NODE_COUNT_SERVER_CONN_CLOSE() do { } while (false) -#define NODE_COUNT_SERVER_CONN_OPEN() do { } while (false) -#endif - -#include "v8.h" -#include "env.h" - -namespace node { - -void InitPerfCounters(Environment* env, v8::Local<v8::Object> target); -void TermPerfCounters(v8::Local<v8::Object> target); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_COUNTERS_H_ diff --git a/src/node_internals.h b/src/node_internals.h index 0bf08210a6..9a34825b1e 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -132,7 +132,7 @@ struct sockaddr; V(string_decoder) \ V(symbols) \ V(tcp_wrap) \ - V(timers) \ + V(timers) \ V(trace_events) \ V(tty_wrap) \ V(types) \ diff --git a/src/node_win32_perfctr_provider.cc b/src/node_win32_perfctr_provider.cc deleted file mode 100644 index 7e94db9fed..0000000000 --- a/src/node_win32_perfctr_provider.cc +++ /dev/null @@ -1,345 +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. - -#define __INIT_node_perfctr_provider_IMP -#include "node_counters.h" -#include "node_win32_perfctr_provider.h" - -#include <perflib.h> - -#include "node_perfctr_provider.h" - - -typedef ULONG (WINAPI* PerfStartProviderExFunc)( - __in LPGUID ProviderGuid, - __in_opt PPERF_PROVIDER_CONTEXT ProviderContext, - __out PHANDLE Provider); - -typedef ULONG (WINAPI* PerfStopProviderFunc)( - __in HANDLE ProviderHandle); - -typedef ULONG (WINAPI* PerfSetCounterSetInfoFunc)( - __in HANDLE ProviderHandle, - __inout_bcount(TemplateSize) PPERF_COUNTERSET_INFO Template, - __in ULONG TemplateSize); - -typedef PPERF_COUNTERSET_INSTANCE (WINAPI* PerfCreateInstanceFunc)( - __in HANDLE ProviderHandle, - __in LPCGUID CounterSetGuid, - __in PCWSTR Name, - __in ULONG Id); - -typedef ULONG (WINAPI* PerfDeleteInstanceFunc)( - __in HANDLE Provider, - __in PPERF_COUNTERSET_INSTANCE InstanceBlock); - -typedef ULONG (WINAPI* PerfSetULongCounterValueFunc)( - __in HANDLE Provider, - __inout PPERF_COUNTERSET_INSTANCE Instance, - __in ULONG CounterId, - __in ULONG Value); - -typedef ULONG (WINAPI* PerfSetULongLongCounterValueFunc)( - __in HANDLE Provider, - __inout PPERF_COUNTERSET_INSTANCE Instance, - __in ULONG CounterId, - __in ULONGLONG Value); - -typedef ULONG (WINAPI* PerfIncrementULongCounterValueFunc)( - __in HANDLE Provider, - __inout PPERF_COUNTERSET_INSTANCE Instance, - __in ULONG CounterId, - __in ULONG Value); - -typedef ULONG (WINAPI* PerfIncrementULongLongCounterValueFunc)( - __in HANDLE Provider, - __inout PPERF_COUNTERSET_INSTANCE Instance, - __in ULONG CounterId, - __in ULONGLONG Value); - -typedef ULONG (WINAPI* PerfDecrementULongCounterValueFunc)( - __in HANDLE Provider, - __inout PPERF_COUNTERSET_INSTANCE Instance, - __in ULONG CounterId, - __in ULONG Value); - -typedef ULONG (WINAPI* PerfDecrementULongLongCounterValueFunc)( - __in HANDLE Provider, - __inout PPERF_COUNTERSET_INSTANCE Instance, - __in ULONG CounterId, - __in ULONGLONG Value); - - -HMODULE advapimod; -PerfStartProviderExFunc perfctr_startProvider; -PerfStopProviderFunc perfctr_stopProvider; -PerfSetCounterSetInfoFunc perfctr_setCounterSetInfo; -PerfCreateInstanceFunc perfctr_createInstance; -PerfDeleteInstanceFunc perfctr_deleteInstance; -PerfSetULongCounterValueFunc perfctr_setULongValue; -PerfSetULongLongCounterValueFunc perfctr_setULongLongValue; -PerfIncrementULongCounterValueFunc perfctr_incrementULongValue; -PerfIncrementULongLongCounterValueFunc perfctr_incrementULongLongValue; -PerfDecrementULongCounterValueFunc perfctr_decrementULongValue; -PerfDecrementULongLongCounterValueFunc perfctr_decrementULongLongValue; - -PPERF_COUNTERSET_INSTANCE perfctr_instance; - - -#define NODE_COUNTER_HTTP_SERVER_REQUEST 1 -#define NODE_COUNTER_HTTP_SERVER_RESPONSE 2 -#define NODE_COUNTER_HTTP_CLIENT_REQUEST 3 -#define NODE_COUNTER_HTTP_CLIENT_RESPONSE 4 -#define NODE_COUNTER_SERVER_CONNS 5 -#define NODE_COUNTER_NET_BYTES_SENT 6 -#define NODE_COUNTER_NET_BYTES_RECV 7 -#define NODE_COUNTER_GC_PERCENTTIME 8 -#define NODE_COUNTER_PIPE_BYTES_SENT 9 -#define NODE_COUNTER_PIPE_BYTES_RECV 10 - - -namespace node { - - -HANDLE NodeCounterProvider = nullptr; - -void InitPerfCountersWin32() { - ULONG status; - PERF_PROVIDER_CONTEXT providerContext; - - // create instance name using pid -#define INST_MAX_LEN 32 -#define INST_PREFIX_LEN 5 -#define INST_PREFIX L"node_" - - wchar_t Inst[INST_MAX_LEN]; - DWORD pid = GetCurrentProcessId(); - wcscpy_s(Inst, INST_MAX_LEN, INST_PREFIX); - _itow_s(pid, Inst + INST_PREFIX_LEN, INST_MAX_LEN - INST_PREFIX_LEN, 10); - - advapimod = LoadLibraryW(L"advapi32.dll"); - if (advapimod) { - perfctr_startProvider = (PerfStartProviderExFunc) - GetProcAddress(advapimod, "PerfStartProviderEx"); - perfctr_stopProvider = (PerfStopProviderFunc) - GetProcAddress(advapimod, "PerfStopProvider"); - perfctr_setCounterSetInfo = (PerfSetCounterSetInfoFunc) - GetProcAddress(advapimod, "PerfSetCounterSetInfo"); - perfctr_createInstance = (PerfCreateInstanceFunc) - GetProcAddress(advapimod, "PerfCreateInstance"); - perfctr_deleteInstance = (PerfDeleteInstanceFunc) - GetProcAddress(advapimod, "PerfDeleteInstance"); - perfctr_setULongValue = (PerfSetULongCounterValueFunc) - GetProcAddress(advapimod, "PerfSetULongCounterValue"); - perfctr_setULongLongValue = (PerfSetULongLongCounterValueFunc) - GetProcAddress(advapimod, "PerfSetULongLongCounterValue"); - perfctr_incrementULongValue = (PerfIncrementULongCounterValueFunc) - GetProcAddress(advapimod, "PerfIncrementULongCounterValue"); - perfctr_incrementULongLongValue = (PerfIncrementULongLongCounterValueFunc) - GetProcAddress(advapimod, "PerfIncrementULongLongCounterValue"); - perfctr_decrementULongValue = (PerfDecrementULongCounterValueFunc) - GetProcAddress(advapimod, "PerfDecrementULongCounterValue"); - perfctr_decrementULongLongValue = (PerfDecrementULongLongCounterValueFunc) - GetProcAddress(advapimod, "PerfDecrementULongLongCounterValue"); - - ZeroMemory(&providerContext, sizeof(providerContext)); - providerContext.ContextSize = sizeof(providerContext); - - if (!perfctr_startProvider || - !perfctr_setCounterSetInfo || - !perfctr_createInstance) { - NodeCounterProvider = nullptr; - return; - } - - status = perfctr_startProvider(&NodeCounterSetGuid, - &providerContext, - &NodeCounterProvider); - if (status != ERROR_SUCCESS) { - NodeCounterProvider = nullptr; - return; - } - - status = perfctr_setCounterSetInfo(NodeCounterProvider, - &NodeCounterSetInfo.CounterSet, - sizeof(NodeCounterSetInfo.CounterSet)); - if (status != ERROR_SUCCESS) { - perfctr_stopProvider(NodeCounterProvider); - NodeCounterProvider = nullptr; - return; - } - - perfctr_instance = perfctr_createInstance(NodeCounterProvider, - &NodeCounterSetGuid, - Inst, - 1); - if (perfctr_instance == nullptr) { - perfctr_stopProvider(NodeCounterProvider); - NodeCounterProvider = nullptr; - } - } -} - - -void TermPerfCountersWin32() { - if (NodeCounterProvider != nullptr && - perfctr_stopProvider != nullptr) { - perfctr_stopProvider(NodeCounterProvider); - NodeCounterProvider = nullptr; - } - - if (advapimod) { - FreeLibrary(advapimod); - advapimod = nullptr; - } -} - - -void NODE_COUNT_HTTP_SERVER_REQUEST() { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongValue != nullptr) { - perfctr_incrementULongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_HTTP_SERVER_REQUEST, - 1); - } -} - - -void NODE_COUNT_HTTP_SERVER_RESPONSE() { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongValue != nullptr) { - perfctr_incrementULongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_HTTP_SERVER_RESPONSE, - 1); - } -} - - -void NODE_COUNT_HTTP_CLIENT_REQUEST() { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongValue != nullptr) { - perfctr_incrementULongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_HTTP_CLIENT_REQUEST, - 1); - } -} - - -void NODE_COUNT_HTTP_CLIENT_RESPONSE() { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongValue != nullptr) { - perfctr_incrementULongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_HTTP_CLIENT_RESPONSE, - 1); - } -} - - -void NODE_COUNT_SERVER_CONN_OPEN() { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongValue != nullptr) { - perfctr_incrementULongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_SERVER_CONNS, - 1); - } -} - - -void NODE_COUNT_SERVER_CONN_CLOSE() { - if (NodeCounterProvider != nullptr && - perfctr_decrementULongValue != nullptr) { - perfctr_decrementULongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_SERVER_CONNS, - 1); - } -} - - -void NODE_COUNT_NET_BYTES_SENT(int bytes) { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongLongValue != nullptr) { - perfctr_incrementULongLongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_NET_BYTES_SENT, - static_cast<ULONGLONG>(bytes)); - } -} - - -void NODE_COUNT_NET_BYTES_RECV(int bytes) { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongLongValue != nullptr) { - perfctr_incrementULongLongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_NET_BYTES_RECV, - static_cast<ULONGLONG>(bytes)); - } -} - - -uint64_t NODE_COUNT_GET_GC_RAWTIME() { - LARGE_INTEGER timegc; - if (QueryPerformanceCounter(&timegc)) { - return timegc.QuadPart; - } else { - return static_cast<uint64_t>(GetTickCount()); - } -} - - -void NODE_COUNT_GC_PERCENTTIME(unsigned int percent) { - if (NodeCounterProvider != nullptr && perfctr_setULongValue != nullptr) { - perfctr_setULongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_GC_PERCENTTIME, - percent); - } -} - - -void NODE_COUNT_PIPE_BYTES_SENT(int bytes) { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongLongValue != nullptr) { - perfctr_incrementULongLongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_PIPE_BYTES_SENT, - static_cast<ULONGLONG>(bytes)); - } -} - - -void NODE_COUNT_PIPE_BYTES_RECV(int bytes) { - if (NodeCounterProvider != nullptr && - perfctr_incrementULongLongValue != nullptr) { - perfctr_incrementULongLongValue(NodeCounterProvider, - perfctr_instance, - NODE_COUNTER_PIPE_BYTES_RECV, - static_cast<ULONGLONG>(bytes)); - } -} - -} // namespace node diff --git a/src/node_win32_perfctr_provider.h b/src/node_win32_perfctr_provider.h deleted file mode 100644 index 35185aa187..0000000000 --- a/src/node_win32_perfctr_provider.h +++ /dev/null @@ -1,58 +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. - -#ifndef SRC_NODE_WIN32_PERFCTR_PROVIDER_H_ -#define SRC_NODE_WIN32_PERFCTR_PROVIDER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#if defined(_MSC_VER) -# define INLINE __forceinline -#else -# define INLINE inline -#endif - -namespace node { - -extern HANDLE NodeCounterProvider; - -INLINE bool NODE_COUNTER_ENABLED() { return NodeCounterProvider != nullptr; } -void NODE_COUNT_HTTP_SERVER_REQUEST(); -void NODE_COUNT_HTTP_SERVER_RESPONSE(); -void NODE_COUNT_HTTP_CLIENT_REQUEST(); -void NODE_COUNT_HTTP_CLIENT_RESPONSE(); -void NODE_COUNT_SERVER_CONN_OPEN(); -void NODE_COUNT_SERVER_CONN_CLOSE(); -void NODE_COUNT_NET_BYTES_SENT(int bytes); -void NODE_COUNT_NET_BYTES_RECV(int bytes); -uint64_t NODE_COUNT_GET_GC_RAWTIME(); -void NODE_COUNT_GC_PERCENTTIME(unsigned int percent); -void NODE_COUNT_PIPE_BYTES_SENT(int bytes); -void NODE_COUNT_PIPE_BYTES_RECV(int bytes); - -void InitPerfCountersWin32(); -void TermPerfCountersWin32(); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_WIN32_PERFCTR_PROVIDER_H_ diff --git a/src/noperfctr_macros.py b/src/noperfctr_macros.py deleted file mode 100644 index 2f7e3cbf82..0000000000 --- a/src/noperfctr_macros.py +++ /dev/null @@ -1,9 +0,0 @@ -# This file is used by tools/js2c.py to preprocess out the performance counters -# symbols in builds that don't support counters. This is not used in builds -# that support performance counters. -macro COUNTER_NET_SERVER_CONNECTION(x) = ; -macro COUNTER_NET_SERVER_CONNECTION_CLOSE(x) = ; -macro COUNTER_HTTP_SERVER_REQUEST(x) = ; -macro COUNTER_HTTP_SERVER_RESPONSE(x) = ; -macro COUNTER_HTTP_CLIENT_REQUEST(x) = ; -macro COUNTER_HTTP_CLIENT_RESPONSE(x) = ; diff --git a/src/res/node_perfctr_provider.man b/src/res/node_perfctr_provider.man deleted file mode 100644 index 2f77e332f7..0000000000 --- a/src/res/node_perfctr_provider.man +++ /dev/null @@ -1,107 +0,0 @@ -<instrumentationManifest - xmlns="http://schemas.microsoft.com/win/2004/08/events" - xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events" - xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <instrumentation> - <counters xmlns="http://schemas.microsoft.com/win/2005/12/counters" - schemaVersion="1.1"> - <provider symbol="NodeCounterProvider" - applicationIdentity="node.exe" - providerType="userMode" - providerGuid="{793C9B44-3D6B-4F57-B5D7-4FF80ADCF9A2}"> - <counterSet symbol="NodeCounterSet" - guid="{3A22A8EC-297C-48AC-AB15-33EC93033FD8}" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet" - name="Node.js" - description="Node.js performance counters" - instances="multipleAggregate"> - - <counter id="1" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.httpsrvreq" - name="HTTP server requests" - description="Number of HTTP server requests" - type="perf_counter_counter" - detailLevel="standard" - aggregate="sum" /> - - <counter id="2" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.httpsrvrsp" - name="HTTP server responses" - description="Number of HTTP server responses" - type="perf_counter_counter" - detailLevel="standard" - aggregate="sum" /> - - <counter id="3" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.httpclireq" - name="HTTP client requests" - description="Number of HTTP client requests" - type="perf_counter_counter" - detailLevel="standard" - aggregate="sum" /> - - <counter id="4" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.httpclirsp" - name="HTTP client responses" - description="Number of HTTP client responses" - type="perf_counter_counter" - detailLevel="standard" - aggregate="sum" /> - - <counter id="5" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.netsrvconn" - name="Active server connections" - description="Number of server connections" - type="perf_counter_rawcount" - detailLevel="standard" - aggregate="sum" /> - - <counter id="6" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.netbytesent" - name="Network bytes sent" - description="Number of bytes sent using TCP" - type="perf_counter_bulk_count" - detailLevel="standard" - defaultScale="-3" - aggregate="sum" /> - - <counter id="7" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.netbyterecv" - name="Network bytes received" - description="Number of bytes received using TCP" - type="perf_counter_bulk_count" - detailLevel="standard" - defaultScale="-3" - aggregate="sum" /> - - <counter id="8" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.gctime" - name="%Time in GC" - description="Percent of time for last GC" - type="perf_counter_rawcount" - detailLevel="standard" - aggregate="avg" /> - - <counter id="9" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.pipebytesent" - name="Pipe bytes sent" - description="Number of bytes sent using pipe" - type="perf_counter_bulk_count" - detailLevel="standard" - defaultScale="-3" - aggregate="sum" /> - - <counter id="10" - uri="Microsoft.Windows.System.PerfCounters.NodeCounterSet.pipebyterecv" - name="Pipe bytes received" - description="Number of bytes received using pipe" - type="perf_counter_bulk_count" - detailLevel="standard" - defaultScale="-3" - aggregate="sum" /> - - </counterSet> - </provider> - </counters> - </instrumentation> -</instrumentationManifest> diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 59f7eb9503..350aae335a 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -25,7 +25,6 @@ #include "env-inl.h" #include "handle_wrap.h" #include "node_buffer.h" -#include "node_counters.h" #include "pipe_wrap.h" #include "req_wrap-inl.h" #include "tcp_wrap.h" @@ -206,12 +205,6 @@ void LibuvStreamWrap::OnUvRead(ssize_t nread, const uv_buf_t* buf) { CHECK_EQ(persistent().IsEmpty(), false); if (nread > 0) { - if (is_tcp()) { - NODE_COUNT_NET_BYTES_RECV(nread); - } else if (is_named_pipe()) { - NODE_COUNT_PIPE_BYTES_RECV(nread); - } - Local<Object> pending_obj; if (type == UV_TCP) { @@ -351,11 +344,6 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap, size_t bytes = 0; for (size_t i = 0; i < count; i++) bytes += bufs[i].len; - if (stream()->type == UV_TCP) { - NODE_COUNT_NET_BYTES_SENT(bytes); - } else if (stream()->type == UV_NAMED_PIPE) { - NODE_COUNT_PIPE_BYTES_SENT(bytes); - } } return r; diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index c2efc0c0b8..7ff8b068eb 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -26,7 +26,6 @@ #include "node_crypto_bio.h" // NodeBIO // ClientHelloParser #include "node_crypto_clienthello-inl.h" -#include "node_counters.h" #include "node_internals.h" #include "stream_base-inl.h" #include "util-inl.h" @@ -283,8 +282,6 @@ void TLSWrap::EncOut() { return; } - NODE_COUNT_NET_BYTES_SENT(write_size_); - if (!res.async) { HandleScope handle_scope(env()->isolate()); |