Skip to content

Instantly share code, notes, and snippets.

@mogya
Created December 7, 2012 17:00
Show Gist options
  • Save mogya/4234641 to your computer and use it in GitHub Desktop.
Save mogya/4234641 to your computer and use it in GitHub Desktop.
[Titanium Mobile]TraceLog - to get processing time.
util = {}
//thanks to http://blog.xole.net/article.php?id=612
util.TraceLog = function (){
this.startTime = -1;
};
util.TraceLog.prototype = {
start: function(message){
this.startTime = new Date().getTime();
Ti.API.debug('[' + message + '] has started');
},
lap: function(message){
var current = new Date().getTime();
var endTime = current - this.startTime;
Ti.API.debug('[' + message + '] has passed at ' + endTime + 'ms');
},
stop: function(message){
var current = new Date().getTime();
var endTime = current - this.startTime;
Ti.API.debug('[' + message + '] has finished at ' + endTime + 'ms');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment