GeezerVison is showing github.com — src: deprecate global COUNTER_* functions by jasnell · Pull Request #22485 · nodejs/node
src: deprecate global COUNTER_* functions
#22485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from all commits
Commits
File filter
Filter by extension
.bat
(1)
.cc
(5)
.gyp
(1)
.h
(3)
.js
(5)
.man
(1)
.py
(2)
.wixproj
(1)
.wxl
(4)
.wxs
(1)
All 10 file types selected
Deleted files
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -455,11 +455,6 @@
parser.add_option_group(http2_optgroup)
parser.add_option('--with-perfctr',
action='store_true',
dest='with_perfctr',
help='build with performance counters (default is true on Windows)')
parser.add_option('--without-dtrace',
action='store_true',
dest='without_dtrace',
Expand All
@@ -475,11 +470,6 @@
dest='without_npm',
help='do not install the bundled npm (package manager)')
parser.add_option('--without-perfctr',
action='store_true',
dest='without_perfctr',
help='build without performance counters')
# Dummy option for backwards compatibility
parser.add_option('--with-snapshot',
action='store_true',
Expand Down
Expand Up
@@ -1018,14 +1008,6 @@ def configure_node(o):
else:
o['variables']['node_use_etw'] = 'false'
# By default, enable Performance counters on Windows.
if flavor == 'win':
o['variables']['node_use_perfctr'] = b(not options.without_perfctr)
elif options.with_perfctr:
raise Exception('Performance counter is only supported on Windows.')
else:
o['variables']['node_use_perfctr'] = 'false'
o['variables']['node_with_ltcg'] = b(options.with_ltcg)
if flavor != 'win' and options.with_ltcg:
raise Exception('Link Time Code Generation is only supported on Windows.')
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -285,7 +285,6 @@ util.inherits(ClientRequest, OutgoingMessage);
ClientRequest.prototype._finish = function _finish() {
DTRACE_HTTP_CLIENT_REQUEST(this, this.connection);
COUNTER_HTTP_CLIENT_REQUEST();
OutgoingMessage.prototype._finish.call(this);
};
Expand Down
Expand Up
@@ -554,7 +553,6 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
}
DTRACE_HTTP_CLIENT_RESPONSE(socket, req);
COUNTER_HTTP_CLIENT_RESPONSE();
req.res = res;
res.req = req;
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -140,7 +140,6 @@ util.inherits(ServerResponse, OutgoingMessage);
ServerResponse.prototype._finish = function _finish() {
DTRACE_HTTP_SERVER_RESPONSE(this.connection);
COUNTER_HTTP_SERVER_RESPONSE();
OutgoingMessage.prototype._finish.call(this);
};
Expand Down
Expand Up
@@ -624,7 +623,6 @@ function parserOnIncoming(server, socket, state, req, keepAlive) {
res.shouldKeepAlive = keepAlive;
DTRACE_HTTP_SERVER_REQUEST(req, socket);
COUNTER_HTTP_SERVER_REQUEST();
if (socket._httpMessage) {
// There are already pending outgoing res, append.
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -171,11 +171,11 @@
NativeModule.require('internal/process/esm_loader').setup();
}
const { deprecate } = NativeModule.require('internal/util');
{
// Install legacy getters on the `util` binding for typechecking.
// TODO(addaleax): Turn into a full runtime deprecation.
const { pendingDeprecation } = process.binding('config');
const { deprecate } = NativeModule.require('internal/util');
const utilBinding = internalBinding('util');
const types = internalBinding('types');
for (const name of [
Expand All
@@ -194,6 +194,31 @@
}
}
// TODO(jasnell): The following have been globals since around 2012.
// That's just silly. The underlying perfctr support has been removed
// so these are now deprecated non-ops that can be removed after one
// major release cycle.
if (process.platform === 'win32') {
function noop() {}
const names = [
'NET_SERVER_CONNECTION',
'NET_SERVER_CONNECTION_CLOSE',
'HTTP_SERVER_REQUEST',
'HTTP_SERVER_RESPONSE',
'HTTP_CLIENT_REQUEST',
'HTTP_CLIENT_RESPONSE'
];
for (var n = 0; n < names.length; n++) {
Object.defineProperty(global, `COUNTER_${names[n]}`, {
configurable: true,
enumerable: false,
value: deprecate(noop,
`COUNTER_${names[n]}() is deprecated.`,
'DEP00XX')
});
}
}
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
setupAllowedFlags();
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -615,7 +615,6 @@ Socket.prototype._destroy = function(exception, cb) {
cb(exception);
if (this._server) {
COUNTER_NET_SERVER_CONNECTION_CLOSE(this);
debug('has server');
this._server._connections--;
if (this._server._emitCloseIfDrained) {
Expand Down
Expand Up
@@ -1522,7 +1521,6 @@ function onconnection(err, clientHandle) {
socket._server = self;
DTRACE_NET_SERVER_CONNECTION(socket);
COUNTER_NET_SERVER_CONNECTION(socket);
self.emit('connection', socket);
}
Expand Down
58 changes: 0 additions & 58 deletions
58
node.gyp
Original file line number
Diff line number
Diff line change
Expand Up
@@ -4,7 +4,6 @@
'v8_trace_maps%': 0,
'node_use_dtrace%': 'false',
'node_use_etw%': 'false',
'node_use_perfctr%': 'false',
'node_no_browser_globals%': 'false',
'node_code_cache_path%': '',
'node_use_v8_platform%': 'true',
Expand Down
Expand Up
@@ -285,11 +284,6 @@
'sources': [
'tools/msvs/genfiles/node_etw_provider.rc'
],
}],
[ 'node_use_perfctr=="true"', {
'sources': [
'tools/msvs/genfiles/node_perfctr_provider.rc',
],
}]
],
}],
Expand Down
Expand Up
@@ -565,28 +559,6 @@
}],
],
}],
[ 'node_use_perfctr=="true"', {
'defines': [ 'HAVE_PERFCTR=1' ],
'dependencies': [ 'node_perfctr' ],
'include_dirs': [
'src',
'tools/msvs/genfiles',
'<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
],
'sources': [
'src/node_win32_perfctr_provider.h',
'src/node_win32_perfctr_provider.cc',
'src/node_counters.cc',
'src/node_counters.h',
],
'conditions': [
['node_intermediate_lib_type != "static_library"', {
'sources': [
'tools/msvs/genfiles/node_perfctr_provider.rc',
],
}],
],
}],
[ 'node_use_dtrace=="true"', {
'defines': [ 'HAVE_DTRACE=1' ],
'dependencies': [
Expand Down
Expand Up
@@ -710,30 +682,6 @@
} ]
]
},
# generate perf counter header and resource files
{
'target_name': 'node_perfctr',
'type': 'none',
'conditions': [
[ 'node_use_perfctr=="true"', {
'actions': [
{
'action_name': 'node_perfctr_man',
'inputs': [ 'src/res/node_perfctr_provider.man' ],
'outputs': [
'tools/msvs/genfiles/node_perfctr_provider.h',
'tools/msvs/genfiles/node_perfctr_provider.rc',
'tools/msvs/genfiles/MSG00001.BIN',
],
'action': [ 'ctrpp <@(_inputs) '
'-o tools/msvs/genfiles/node_perfctr_provider.h '
'-rc tools/msvs/genfiles/node_perfctr_provider.rc'
]
},
],
} ]
]
},
{
'target_name': 'node_js2c',
'type': 'none',
Expand All
@@ -754,9 +702,6 @@
[ 'node_use_dtrace=="false" and node_use_etw=="false"', {
'inputs': [ 'src/notrace_macros.py' ]
}],
[ 'node_use_perfctr=="false"', {
'inputs': [ 'src/noperfctr_macros.py' ]
}],
[ 'node_debug_lib=="false"', {
'inputs': [ 'tools/nodcheck_macros.py' ]
}],
Expand Down
Expand Up
@@ -985,9 +930,6 @@
'HAVE_OPENSSL=1',
],
}],
[ 'node_use_perfctr=="true"', {
'defines': [ 'HAVE_PERFCTR=1' ],
}],
['v8_enable_inspector==1', {
'sources': [
'test/cctest/test_inspector_socket.cc',
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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
Expand Down
Expand Up
@@ -2229,10 +2225,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)
//
Expand Down
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Loading
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.