return total time from the profile .end() method

This commit is contained in:
Brian Gough 2017-07-11 14:25:26 +01:00
parent 41c2bd7fcd
commit ffea31290c

View file

@ -23,11 +23,12 @@ module.exports = class Profiler
end: (message) ->
totalTime = deltaMs(@t, @t0)
return if totalTime < @LOG_CUTOFF_TIME # skip anything less than cutoff
args = {}
for k,v of @args
args[k] = v
args.updateTimes = @updateTimes
args.start = @start
args.end = new Date()
logger.log args, @name
if totalTime > @LOG_CUTOFF_TIME # log anything greater than cutoff
args = {}
for k,v of @args
args[k] = v
args.updateTimes = @updateTimes
args.start = @start
args.end = new Date()
logger.log args, @name
return totalTime