diff options
author | Bert Belder <bertbelder@gmail.com> | 2014-12-09 16:03:24 +0100 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2014-12-09 17:57:19 +0100 |
commit | 2b6a0f85f3fafa8afee0ddf09c50ebc5f3a7c6a8 (patch) | |
tree | 1f567e2b6f28b4a208922f0cd6d8766c1df2ab20 | |
parent | e96100f052a54499bf4fda19a01507971bb19da9 (diff) | |
download | nodejs-2b6a0f85f3fafa8afee0ddf09c50ebc5f3a7c6a8.tar.gz nodejs-2b6a0f85f3fafa8afee0ddf09c50ebc5f3a7c6a8.tar.bz2 nodejs-2b6a0f85f3fafa8afee0ddf09c50ebc5f3a7c6a8.zip |
src: remove the tracing module entirely
PR-URL: https://github.com/iojs/io.js/pull/124
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
-rw-r--r-- | doc/api/all.markdown | 1 | ||||
-rw-r--r-- | doc/api/tracing.markdown | 66 | ||||
-rw-r--r-- | lib/repl.js | 3 | ||||
-rw-r--r-- | lib/tracing.js | 65 | ||||
-rw-r--r-- | node.gyp | 1 | ||||
-rw-r--r-- | src/node.js | 3 | ||||
-rw-r--r-- | test/simple/test-v8-flags.js | 26 | ||||
-rw-r--r-- | test/simple/test-v8-gc.js | 53 | ||||
-rw-r--r-- | test/simple/test-v8-stats.js | 36 |
9 files changed, 1 insertions, 253 deletions
diff --git a/doc/api/all.markdown b/doc/api/all.markdown index 5ccef037f..2a164abb7 100644 --- a/doc/api/all.markdown +++ b/doc/api/all.markdown @@ -35,4 +35,3 @@ @include debugger @include cluster @include smalloc -@include tracing diff --git a/doc/api/tracing.markdown b/doc/api/tracing.markdown deleted file mode 100644 index 8802e2991..000000000 --- a/doc/api/tracing.markdown +++ /dev/null @@ -1,66 +0,0 @@ -# Tracing - - Stability: 1 - Experimental - -The tracing module is designed for instrumenting your Node application. It is -not meant for general purpose use. - -`require('tracing')` to use this module. - -## v8 - -The `v8` property is an [EventEmitter][], it exposes events and interfaces -specific to the version of `v8` built with node. These interfaces are subject -to change by upstream and are therefore not covered under the stability index. - -### Event: 'gc' - -`function (before, after) { }` - -Emitted each time a GC run is completed. - -`before` and `after` are objects with the following properties: - -``` -{ - type: 'mark-sweep-compact', - flags: 0, - timestamp: 905535650119053, - total_heap_size: 6295040, - total_heap_size_executable: 4194304, - total_physical_size: 6295040, - used_heap_size: 2855416, - heap_size_limit: 1535115264 -} -``` - -### getHeapStatistics() - -Returns an object with the following properties - -``` -{ - total_heap_size: 7326976, - total_heap_size_executable: 4194304, - total_physical_size: 7326976, - used_heap_size: 3476208, - heap_size_limit: 1535115264 -} -``` - -### setFlagsFromString() - -Set additional V8 command line flags. Use with care; changing settings -after the VM has started may result in unpredictable behavior, including -crashes and data loss. Or it may simply do nothing. - -Usage: - -``` -// Print GC events to stdout for one minute. -var v8 = require('tracing').v8; -v8.setFlagsFromString('--trace_gc'); -setTimeout(function() { v8.setFlagsFromString('--notrace_gc'); }, 60e3); -``` - - diff --git a/lib/repl.js b/lib/repl.js index 50d6cc264..2b34a1a8c 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -74,8 +74,7 @@ exports.writer = util.inspect; exports._builtinLibs = ['assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode', 'querystring', 'readline', 'stream', - 'string_decoder', 'tls', 'tty', 'url', 'util', 'vm', 'zlib', 'smalloc', - 'tracing']; + 'string_decoder', 'tls', 'tty', 'url', 'util', 'vm', 'zlib', 'smalloc']; function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) { diff --git a/lib/tracing.js b/lib/tracing.js deleted file mode 100644 index f3cddb313..000000000 --- a/lib/tracing.js +++ /dev/null @@ -1,65 +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. - -'use strict'; - -var EventEmitter = require('events'); -var v8binding, process; - -// This needs to be loaded early, and before the "process" object is made -// global. So allow src/node.js to pass the process object in during -// initialization. -exports._nodeInitialization = function nodeInitialization(pobj) { - process = pobj; - v8binding = process.binding('v8'); - - // Finish setting up the v8 Object. - v8.getHeapStatistics = v8binding.getHeapStatistics; - v8.setFlagsFromString = v8binding.setFlagsFromString; - - // Do a little housekeeping. - delete exports._nodeInitialization; -}; - - -// v8 - -var v8 = exports.v8 = new EventEmitter(); - - -function emitGC(before, after) { - v8.emit('gc', before, after); -} - - -v8.on('newListener', function(name) { - if (name === 'gc' && EventEmitter.listenerCount(this, name) === 0) { - v8binding.startGarbageCollectionTracking(emitGC); - } -}); - - -v8.on('removeListener', function(name) { - if (name === 'gc' && EventEmitter.listenerCount(this, name) === 0) { - v8binding.stopGarbageCollectionTracking(); - } -}); - @@ -57,7 +57,6 @@ 'lib/string_decoder.js', 'lib/sys.js', 'lib/timers.js', - 'lib/tracing.js', 'lib/tls.js', 'lib/_tls_common.js', 'lib/_tls_legacy.js', diff --git a/src/node.js b/src/node.js index a00c5f32e..27c06be25 100644 --- a/src/node.js +++ b/src/node.js @@ -42,9 +42,6 @@ process.EventEmitter = EventEmitter; // process.EventEmitter is deprecated - // Setup the tracing module - NativeModule.require('tracing')._nodeInitialization(process); - // do this good and early, since it handles errors. startup.processFatal(); diff --git a/test/simple/test-v8-flags.js b/test/simple/test-v8-flags.js deleted file mode 100644 index 1de36db67..000000000 --- a/test/simple/test-v8-flags.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2014, StrongLoop Inc. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var v8 = require('tracing').v8; -var vm = require('vm'); - -v8.setFlagsFromString('--allow_natives_syntax'); -assert(eval('%_IsSmi(42)')); -assert(vm.runInThisContext('%_IsSmi(42)')); - -v8.setFlagsFromString('--noallow_natives_syntax'); -assert.throws(function() { eval('%_IsSmi(42)') }, SyntaxError); -assert.throws(function() { vm.runInThisContext('%_IsSmi(42)') }, SyntaxError); diff --git a/test/simple/test-v8-gc.js b/test/simple/test-v8-gc.js deleted file mode 100644 index 077e48c57..000000000 --- a/test/simple/test-v8-gc.js +++ /dev/null @@ -1,53 +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. - -// Flags: --expose_gc - -var common = require('../common'); -var assert = require('assert'); -var v8 = require('tracing').v8; - -assert(typeof gc === 'function', 'Run this test with --expose_gc.'); - -var ncalls = 0; -var before; -var after; - -function ongc(before_, after_) { - // Try very hard to not create garbage because that could kick off another - // garbage collection cycle. - before = before_; - after = after_; - ncalls += 1; -} - -gc(); -v8.on('gc', ongc); -gc(); -v8.removeListener('gc', ongc); -gc(); - -assert.equal(ncalls, 1); -assert.equal(typeof before, 'object'); -assert.equal(typeof after, 'object'); -assert.equal(typeof before.timestamp, 'number'); -assert.equal(typeof after.timestamp, 'number'); -assert.equal(before.timestamp <= after.timestamp, true); diff --git a/test/simple/test-v8-stats.js b/test/simple/test-v8-stats.js deleted file mode 100644 index 6d70fb9a0..000000000 --- a/test/simple/test-v8-stats.js +++ /dev/null @@ -1,36 +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. - -var common = require('../common'); -var assert = require('assert'); -var v8 = require('tracing').v8; - -var s = v8.getHeapStatistics(); -var keys = [ - 'heap_size_limit', - 'total_heap_size', - 'total_heap_size_executable', - 'total_physical_size', - 'used_heap_size']; -assert.deepEqual(Object.keys(s).sort(), keys); -keys.forEach(function(key) { - assert.equal(typeof s[key], 'number'); -}); |