src: remove the tracing module entirely
authorBert Belder <bertbelder@gmail.com>
Tue, 9 Dec 2014 15:03:24 +0000 (16:03 +0100)
committerBert Belder <bertbelder@gmail.com>
Tue, 9 Dec 2014 16:57:19 +0000 (17:57 +0100)
PR-URL: https://github.com/iojs/io.js/pull/124
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
doc/api/all.markdown
doc/api/tracing.markdown [deleted file]
lib/repl.js
lib/tracing.js [deleted file]
node.gyp
src/node.js
test/simple/test-v8-flags.js [deleted file]
test/simple/test-v8-gc.js [deleted file]
test/simple/test-v8-stats.js [deleted file]

index 5ccef03..2a164ab 100644 (file)
@@ -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 (file)
index 8802e29..0000000
+++ /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);
-```
-
index 50d6cc2..2b34a1a 100644 (file)
@@ -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 (file)
index f3cddb3..0000000
+++ /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();
-  }
-});
-
index c2d0b0a..77265c5 100644 (file)
--- a/node.gyp
+++ b/node.gyp
@@ -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',
index a00c5f3..27c06be 100644 (file)
@@ -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 (file)
index 1de36db..0000000
+++ /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 (file)
index 077e48c..0000000
+++ /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 (file)
index 6d70fb9..0000000
+++ /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');
-});