aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-17 15:45:36 +0100
committerAlon Zakai <alonzakai@gmail.com>2013-02-17 15:45:36 +0100
commit00f4a4148a96cdffa0a9606f077ff294aa3b1f8c (patch)
tree64ae2399eb78231f4f18c45de94990e91300d46c /src
parent3e0fa38db893f089de92ebe255301ff391f25793 (diff)
remove PROFILE option. It adds unacceptable overhead, and all browsers have proper JS profilers these days - use those
Diffstat (limited to 'src')
-rw-r--r--src/compiler.js2
-rw-r--r--src/jsifier.js15
-rw-r--r--src/library.js30
-rw-r--r--src/preamble.js33
-rw-r--r--src/settings.js4
5 files changed, 1 insertions, 83 deletions
diff --git a/src/compiler.js b/src/compiler.js
index a615d984..0b43842e 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -179,7 +179,7 @@ assert(!(!NAMED_GLOBALS && BUILD_AS_SHARED_LIB)); // shared libraries must have
if (phase == 'pre') {
if (!MICRO_OPTS || !RELOOP || ASSERTIONS || CHECK_SIGNS || CHECK_OVERFLOWS || INIT_STACK || INIT_HEAP ||
- !SKIP_STACK_IN_SMALL || SAFE_HEAP || PROFILE || !DISABLE_EXCEPTION_CATCHING) {
+ !SKIP_STACK_IN_SMALL || SAFE_HEAP || !DISABLE_EXCEPTION_CATCHING) {
print('// Note: Some Emscripten settings will significantly limit the speed of the generated code.');
} else {
print('// Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code');
diff --git a/src/jsifier.js b/src/jsifier.js
index 761a5fec..9fbcf5a8 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -631,15 +631,6 @@ function JSify(data, functionsOnly, givenFunctions) {
}
}
- if (PROFILE) {
- func.JS += ' if (PROFILING) { '
- + 'var __parentProfilingNode__ = PROFILING_NODE; PROFILING_NODE = PROFILING_NODE.children["' + func.ident + '"]; '
- + 'if (!PROFILING_NODE) __parentProfilingNode__.children["' + func.ident + '"] = PROFILING_NODE = { time: 0, children: {}, calls: 0 };'
- + 'PROFILING_NODE.calls++; '
- + 'var __profilingStartTime__ = Date.now() '
- + '}\n';
- }
-
if (true) { // TODO: optimize away when not needed
if (CLOSURE_ANNOTATIONS) func.JS += '/** @type {number} */';
func.JS += ' var label = 0;\n';
@@ -1145,12 +1136,6 @@ function JSify(data, functionsOnly, givenFunctions) {
});
makeFuncLineActor('return', function(item) {
var ret = RuntimeGenerator.stackExit(item.funcData.initialStack, item.funcData.otherStackAllocations) + ';\n';
- if (PROFILE) {
- ret += 'if (PROFILING) { '
- + 'PROFILING_NODE.time += Date.now() - __profilingStartTime__; '
- + 'PROFILING_NODE = __parentProfilingNode__ '
- + '}\n';
- }
if (LABEL_DEBUG && functionNameFilterTest(item.funcData.ident)) {
ret += "Module.print(INDENT + 'Exiting: " + item.funcData.ident + "');\n"
+ "INDENT = INDENT.substr(0, INDENT.length-2);\n";
diff --git a/src/library.js b/src/library.js
index ffac685b..4ebec526 100644
--- a/src/library.js
+++ b/src/library.js
@@ -7305,36 +7305,6 @@ LibraryManager.library = {
emscripten_random: function() {
return Math.random();
},
-
- $Profiling: {
- max_: 0,
- times: null,
- invalid: 0,
- dump: function() {
- if (Profiling.invalid) {
- Module.printErr('Invalid # of calls to Profiling begin and end!');
- return;
- }
- Module.printErr('Profiling data:')
- for (var i = 0; i < Profiling.max_; i++) {
- Module.printErr('Block ' + i + ': ' + Profiling.times[i]);
- }
- }
- },
- EMSCRIPTEN_PROFILE_INIT__deps: ['$Profiling'],
- EMSCRIPTEN_PROFILE_INIT: function(max_) {
- Profiling.max_ = max_;
- Profiling.times = new Array(max_);
- for (var i = 0; i < max_; i++) Profiling.times[i] = 0;
- },
- EMSCRIPTEN_PROFILE_BEGIN__inline: function(id) {
- return 'Profiling.times[' + id + '] -= Date.now();'
- + 'Profiling.invalid++;'
- },
- EMSCRIPTEN_PROFILE_END__inline: function(id) {
- return 'Profiling.times[' + id + '] += Date.now();'
- + 'Profiling.invalid--;'
- }
};
function autoAddDeps(object, name) {
diff --git a/src/preamble.js b/src/preamble.js
index 3c206def..349bf41e 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -191,39 +191,6 @@ var INDENT = '';
var START_TIME = Date.now();
#endif
-#if PROFILE
-var PROFILING = 0;
-var PROFILING_ROOT = { time: 0, children: {}, calls: 0 };
-var PROFILING_NODE;
-
-function startProfiling() {
- PROFILING_NODE = PROFILING_ROOT;
- PROFILING = 1;
-}
-Module['startProfiling'] = startProfiling;
-
-function stopProfiling() {
- PROFILING = 0;
- assert(PROFILING_NODE === PROFILING_ROOT, 'Must have popped all the profiling call stack');
-}
-Module['stopProfiling'] = stopProfiling;
-
-function printProfiling() {
- function dumpData(name_, node, indent) {
- Module.print(indent + ('________' + node.time).substr(-8) + ': ' + name_ + ' (' + node.calls + ')');
- var children = [];
- for (var child in node.children) {
- children.push(node.children[child]);
- children[children.length-1].name_ = child;
- }
- children.sort(function(x, y) { return y.time - x.time });
- children.forEach(function(child) { dumpData(child.name_, child, indent + ' ') });
- }
- dumpData('root', PROFILING_ROOT, ' ');
-}
-Module['printProfiling'] = printProfiling;
-#endif
-
//========================================
// Runtime essentials
//========================================
diff --git a/src/settings.js b/src/settings.js
index 8e8144f0..002e66d4 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -154,8 +154,6 @@ var GL_DEBUG = 0; // Print out all calls into WebGL. As with LIBRARY_DEBUG, you
// option, in this case GL.debug.
var GL_MAX_TEMP_BUFFER_SIZE = 2097152; // How large GL emulation temp buffers are
-var PROFILE_MAIN_LOOP = 0; // Profile the function called in set_main_loop
-
var DISABLE_EXCEPTION_CATCHING = 0; // Disables generating code to actually catch exceptions. If the code you
// are compiling does not actually rely on catching exceptions (but the
// compiler generates code for it, maybe because of stdlibc++ stuff),
@@ -209,8 +207,6 @@ var NAMED_GLOBALS = 0; // If 1, we use global variables for globals. Otherwise
// they are referred to by a base plus an offset (called an indexed global),
// saving global variables but adding runtime overhead.
-var PROFILE = 0; // Enables runtime profiling. See test_profiling for a usage example.
-
var EXPORT_ALL = 0; // If true, we export all the symbols
var EXPORTED_FUNCTIONS = ['_main']; // Functions that are explicitly exported. These functions are kept alive
// through LLVM dead code elimination, and also made accessible outside of