class Fable::Profiler::Stopwatch
Attributes
elapsed_milliseconds[RW]
start_time[RW]
stop_time[RW]
Public Class Methods
new()
click to toggle source
# File lib/fable/profiler.rb, line 250 def initialize @elapsed_milliseconds = 0 end
Public Instance Methods
elapsed_from_start_to_stop()
click to toggle source
# File lib/fable/profiler.rb, line 282 def elapsed_from_start_to_stop ((@stop_time || Time.now.utc).to_r - @start_time.to_r) * 1000.0 end
reset!()
click to toggle source
# File lib/fable/profiler.rb, line 259 def reset! @elapsed_milliseconds = 0 end
restart!()
click to toggle source
# File lib/fable/profiler.rb, line 263 def restart! reset! start! end
start!()
click to toggle source
# File lib/fable/profiler.rb, line 254 def start! @stop_time = nil @start_time = Time.now.utc end
stop!()
click to toggle source
# File lib/fable/profiler.rb, line 268 def stop! @stop_time = Time.now.utc @elapsed_milliseconds += elapsed_from_start_to_stop end