Sha256: e0261bf0062699c031ff5aff324e49d487c7fc1496a890e3d67e01cd1d2f568f

Contents?: true

Size: 423 Bytes

Versions: 17

Compression:

Stored size: 423 Bytes

Contents

java_import 'java.lang.System'

module Timing
  def self.start
    TimingContext.new
  end

  class TimingContext
    def initialize
      reset!
    end

    def reset!
      @start = @last_tick = System.nano_time
    end

    def tick
      rt = System.nano_time - @last_tick
      @last_tick = System.nano_time
      rt
    end

    def stop
      rt = System.nano_time - @start
      reset!
      rt
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
liquid-ext-3.4.1 lib/liquid/timing.rb
liquid-ext-3.4.0 lib/liquid/timing.rb
liquid-ext-3.3.10 lib/liquid/timing.rb
liquid-ext-3.3.9 lib/liquid/timing.rb
liquid-ext-3.3.8 lib/liquid/timing.rb
liquid-ext-3.3.7 lib/liquid/timing.rb
liquid-ext-3.3.6 lib/liquid/timing.rb
liquid-ext-3.3.5 lib/liquid/timing.rb
liquid-ext-3.3.4 lib/liquid/timing.rb
liquid-ext-3.3.3 lib/liquid/timing.rb
liquid-ext-3.3.2 lib/liquid/timing.rb
liquid-ext-3.3.0 lib/liquid/timing.rb
liquid-ext-3.2.0 lib/liquid/timing.rb
liquid-ext-3.1.2 lib/liquid/timing.rb
liquid-ext-3.1.1 lib/liquid/timing.rb
liquid-ext-3.1.0 lib/liquid/timing.rb
liquid-ext-3.0.0 lib/liquid/timing.rb