aboutsummaryrefslogtreecommitdiff
path: root/src/postamble.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-25 17:37:29 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-25 17:37:29 -0800
commitb97d3033f14e5f98527cf069f10287ddecea83cb (patch)
treeaedca06028b8e133d8987896d9564c5baf7fb2e3 /src/postamble.js
parent64381b4b3cf017ea714e90e030161d83e170f758 (diff)
benchmark code gen option
Diffstat (limited to 'src/postamble.js')
-rw-r--r--src/postamble.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/postamble.js b/src/postamble.js
index 5f541733..00205abc 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -17,18 +17,30 @@ Module.callMain = function callMain(args) {
argv.push(0);
argv = allocate(argv, 'i32', ALLOC_STATIC);
+#if BENCHMARK
+ var start = Date.now();
+#endif
+
+ var ret;
+
#if CATCH_EXIT_CODE
var initialStackTop = STACKTOP;
try {
- return Module['_main'](argc, argv, 0);
+ ret = Module['_main'](argc, argv, 0);
}
catch(e) { if (e.name == "ExitStatus") return e.status; throw e; }
finally {
STACKTOP = initialStackTop;
}
#else
- return Module['_main'](argc, argv, 0);
+ ret = Module['_main'](argc, argv, 0);
#endif
+
+#if BENCHMARK
+ Module.realPrint('main() took ' + (Date.now() - start) + ' milliseconds');
+#endif
+
+ return ret;
}
{{GLOBAL_VARS}}