Sha256: 0134ba5f1b3606b70f446dc280afcb412cdf761fe282e6942b488e19dc7b6e73

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

# Some classes used in measurement tests
module RubyProf
  class C1
    def C1.sleep_wait
      sleep(0.1)
    end

    def C1.busy_wait
      starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
      while (Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting) < 0.1
      end
    end

    def sleep_wait
      sleep(0.2)
    end

    def busy_wait
      starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
      while (Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting) < 0.2
      end
    end
  end

  module M1
    def sleep_wait
      sleep(0.3)
    end

    def busy_wait
      starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
      while (Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting) < 0.3
      end
    end
  end

  class C2
    include M1
    extend M1
  end

  class C3
    include Singleton
    def sleep_wait
      sleep(0.3)
    end

    def busy_wait
      starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
      while (Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting) < 0.2
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-prof-1.1.0-x64-mingw32 test/measure_times.rb
ruby-prof-1.1.0 test/measure_times.rb
ruby-prof-1.0.0 test/measure_times.rb