aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-10-28 14:05:59 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-10-28 14:05:59 -0700
commit1488cc47f25bd98ea897f56ac1cc096edf1d0da1 (patch)
tree946893d28d4d60b7e668456984cc68d6f860e0d3 /tests/runner.py
parentb8ffc3d9016fe2eef894a6957bbb90ab97d54691 (diff)
profiling option from C++
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 3fd63574..fe2f0f85 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3381,6 +3381,38 @@ if 'benchmark' not in str(sys.argv):
self.do_run(src, '*hello slim world*', build_ll_hook=hook)
def test_profiling(self):
+ src = '''
+ #include <emscripten.h>
+ #include <unistd.h>
+
+ int main()
+ {
+ EMSCRIPTEN_PROFILE_INIT(3);
+ EMSCRIPTEN_PROFILE_BEGIN(0);
+ usleep(10 * 1000);
+ EMSCRIPTEN_PROFILE_END(0);
+ EMSCRIPTEN_PROFILE_BEGIN(1);
+ usleep(50 * 1000);
+ EMSCRIPTEN_PROFILE_END(1);
+ EMSCRIPTEN_PROFILE_BEGIN(2);
+ usleep(250 * 1000);
+ EMSCRIPTEN_PROFILE_END(2);
+ return 0;
+ }
+ '''
+
+ def post1(filename):
+ src = open(filename, 'a')
+ src.write('''
+ Profiling.dump();
+ ''')
+ src.close()
+
+ self.do_run(src, '''Profiling data:
+Block 0: ''', post_build=post1)
+
+ # Part 2: old JS version
+
Settings.PROFILE = 1
Settings.INVOKE_RUN = 0
@@ -3427,7 +3459,6 @@ if 'benchmark' not in str(sys.argv):
''')
src.close()
- # Using build_ll_hook forces a recompile, which leads to DFE being done even without opts
self.do_run(src, ': __Z6inner1i (5000)\n*ok*', post_build=post)
### Integration tests