Created
December 7, 2012 17:00
-
-
Save mogya/4234641 to your computer and use it in GitHub Desktop.
[Titanium Mobile]TraceLog - to get processing time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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