aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-14 19:56:21 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-14 19:56:21 -0700
commit355a67d3a1605e7321f21162ccf8c236b63e8c23 (patch)
treea7b45bb39ffa433c804c58537ac0f7118145d731
parentccbfbc922a42302973ef523c36fafcc4bbce0d88 (diff)
add -profiling option
-rwxr-xr-xemcc12
-rw-r--r--tests/test_other.py1
2 files changed, 13 insertions, 0 deletions
diff --git a/emcc b/emcc
index e28ec767..1c57d991 100755
--- a/emcc
+++ b/emcc
@@ -235,6 +235,13 @@ Options that are modified or new in %s include:
slower because JS optimization will be
limited to 1 core. (default in -O0)
+ -profiling Use reasonable defaults when emitting JS to
+ make the build useful for profiling. This
+ sets -g2 (preserve function names) and may
+ also enable optimizations that affect
+ performance and otherwise might not be
+ performed in -g2.
+
--typed-arrays <mode> 0: No typed arrays
1: Parallel typed arrays
2: Shared (C-like) typed arrays (default)
@@ -770,6 +777,7 @@ try:
opt_level = 0
debug_level = 0
+ profiling = False
js_opts = None
llvm_opts = None
llvm_lto = None
@@ -890,6 +898,10 @@ try:
requested_level = newargs[i][2:] or '3'
debug_level = validate_arg_level(requested_level, 4, 'Invalid debug level: ' + newargs[i])
newargs[i] = '-g' # we'll need this to get LLVM debug info
+ elif newargs[i] == '-profiling':
+ debug_level = 2
+ profiling = True
+ newargs[i] = ''
elif newargs[i] == '--bind':
bind = True
newargs[i] = ''
diff --git a/tests/test_other.py b/tests/test_other.py
index 553a3d83..7200b9fd 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -191,6 +191,7 @@ Options that are modified or new in %s include:
(['-O2', '-g1'], lambda generated: 'var b = 0' in generated and not 'function _main' in generated, 'compress is cancelled by -g1'),
(['-O2', '-g2'], lambda generated: ('var b = 0' in generated or 'var i1 = 0' in generated) and 'function _main' in generated, 'minify is cancelled by -g2'),
(['-O2', '-g3'], lambda generated: 'var b=0' not in generated and 'var b = 0' not in generated and 'function _main' in generated, 'registerize is cancelled by -g3'),
+ (['-O2', '-profiling'], lambda generated: ('var b = 0' in generated or 'var i1 = 0' in generated) and 'function _main' in generated, 'similar to -g2'),
#(['-O2', '-g4'], lambda generated: 'var b=0' not in generated and 'var b = 0' not in generated and 'function _main' in generated, 'same as -g3 for now'),
(['-s', 'INLINING_LIMIT=0'], lambda generated: 'function _dump' in generated, 'no inlining without opts'),
(['-s', 'USE_TYPED_ARRAYS=0'], lambda generated: 'new Int32Array' not in generated, 'disable typed arrays'),