Skip to content

Commit

Permalink
add some worker timing info
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Apr 26, 2013
1 parent 09b8e10 commit b8bf172
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion banana/game/headless.js
Expand Up @@ -5,7 +5,7 @@
//== HEADLESS ==//

var headlessPrint = function(x) {
//print(x);
print(x);
}

var window = {
Expand Down Expand Up @@ -241,7 +241,9 @@ var Worker = function(workerPath) {
headlessPrint('main thread sending message ' + msg.messageId + ' to worker ' + workerPath);
window.setTimeout(function() {
headlessPrint('worker ' + workerPath + ' receiving message ' + msg.messageId);
var start = Date.realNow();
onmessage({ data: duplicateJSON(msg) });
headlessPrint('worker ' + workerPath + ' took ' + (Date.realNow() - start) + ' ms');
});
};
var thisWorker = this;
Expand All @@ -250,7 +252,9 @@ var Worker = function(workerPath) {
headlessPrint('worker ' + workerPath + ' sending message ' + msg.messageId);
window.setTimeout(function() {
headlessPrint('main thread receiving message ' + msg.messageId + ' from ' + workerPath);
var start = Date.realNow();
thisWorker.onmessage({ data: duplicateJSON(msg) });
headlessPrint('main thread ' + workerPath + ' took ' + (Date.realNow() - start) + ' ms');
});
};
};
Expand Down

0 comments on commit b8bf172

Please sign in to comment.