aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-02 18:37:42 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-11-02 18:37:42 -0700
commita07400c7d9b9c9e0f9c3cc8337c64d3ec3bc4ebf (patch)
treece728843120cc6901a6acdb0a5738f69d39d5aab
parent09de22204dd577ecfccb2c2011ad3b26d6f37f00 (diff)
improve js Benchmarker utility
-rw-r--r--src/utility.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utility.js b/src/utility.js
index 5019e117..632ee08c 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -319,11 +319,12 @@ function Benchmarker() {
//printErr(['+', id, starts[id]]);
starts[id] = (starts[id] || []).concat([Date.now()]);
};
- this.end = function(id) {
+ this.stop = function(id) {
//printErr(['-', id, starts[id]]);
assert(starts[id], new Error().stack);
times[id] = (times[id] || 0) + Date.now() - starts[id].pop();
counts[id] = (counts[id] || 0) + 1;
+ this.print();
};
this.print = function() {
var ids = keys(times);