Sha256: e0d7d478a53600d43f6d51ca7403f3aad256b28dc5756036cb7b6bde5cd4b8ad

Contents?: true

Size: 628 Bytes

Versions: 14

Compression:

Stored size: 628 Bytes

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

module Contrast
  module Utils
    # Timer is class that can track state about when an event starts and how long it takes
    # Also containes utility methods to get time values in milliseconds
    class Timer
      attr_reader :start_ms, :events

      def initialize time = Time.now
        @start_at = time
        @start_ms = (@start_at.to_f * 1000).to_i
        @events = {}
      end

      def self.now_ms
        (Time.now.to_f * 1000).to_i
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
contrast-agent-4.4.1 lib/contrast/utils/timer.rb
contrast-agent-4.4.0 lib/contrast/utils/timer.rb
contrast-agent-4.3.2 lib/contrast/utils/timer.rb
contrast-agent-4.3.1 lib/contrast/utils/timer.rb
contrast-agent-4.3.0 lib/contrast/utils/timer.rb
contrast-agent-4.2.0 lib/contrast/utils/timer.rb
contrast-agent-4.1.0 lib/contrast/utils/timer.rb
contrast-agent-4.0.0 lib/contrast/utils/timer.rb
contrast-agent-3.16.0 lib/contrast/utils/timer.rb
contrast-agent-3.15.0 lib/contrast/utils/timer.rb
contrast-agent-3.14.0 lib/contrast/utils/timer.rb
contrast-agent-3.13.2 lib/contrast/utils/timer.rb
contrast-agent-3.13.1 lib/contrast/utils/timer.rb
contrast-agent-3.13.0 lib/contrast/utils/timer.rb