Logging how long function took to run
var originalDoSomething = doSomething;
doSomething = function() {
var startTime = new Date();
// call the original version of the function
var r = originalDoSomething.apply(this, arguments);
var stopTime = new Date();
console.log("Started at " + startTime + " and ended at " + stopTime);
return r
}