Sha256: 967c925c804e3dd1888408b158bb83ef1358d9e0c0179c9b9e1a863cd32d3f58

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

#
# Copyright (c) 2012 Lorenzo Pasqualis - DreamBox Learning, Inc
# https://github.com/lpasqualis/rubyperf
#

module Perf
  #
  # This class can be used in substitution to a Perf::Measure class to avoid overhead when performance measurments is not
  # required. It needs to maintain the same API as Perf::Measure.
  #
  class NoopMeasure

    def measurements
      {}
    end

    def current_stack
      {}
    end

    def initialize(logger = nil)
    end

    def clear
    end

    #############################################################################################################

    def measure(what,type=nil)
      yield
    end

    def count_value(what_to_count)
      nil
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyperf-0.1.0 lib/perf/noop_measure.rb
rubyperf-0.0.0 lib/perf/noop_measure.rb