Sha256: 27d8999f3b38ffcc2d6e8ac9083fe241d0fc833374b18833f99636d6b1aa8fa2

Contents?: true

Size: 303 Bytes

Versions: 7

Compression:

Stored size: 303 Bytes

Contents

def tm(msg="Thing")
  t = Time.now
  res = yield
  seconds = Time.now - t
  puts "#{msg} took #{seconds} seconds"
  res
end

def print_memory_usage!
  Thread.new do
    loop do
      mem = `ps -l #{Process.pid}`.to_a[1].split[8]
      puts "Memory: #{mem} #{Time.now}"
      sleep(10)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
GFunk911-mharris_ext-1.4.2 lib/mharris_ext/benchmark.rb
GFunk911-mharris_ext-1.4.3 lib/mharris_ext/benchmark.rb
GFunk911-mharris_ext-1.4.4 lib/mharris_ext/benchmark.rb
mharris_ext-1.7.1 lib/mharris_ext/benchmark.rb
mharris_ext-1.7.0 lib/mharris_ext/benchmark.rb
mharris_ext-1.6.0 lib/mharris_ext/benchmark.rb
mharris_ext-1.5.0 lib/mharris_ext/benchmark.rb