lib/mharris_ext/benchmark.rb in GFunk911-mharris_ext-1.4.1 vs lib/mharris_ext/benchmark.rb in GFunk911-mharris_ext-1.4.2

- old
+ new

@@ -1,6 +1,17 @@ def tm(msg="Thing") t = Time.now - yield + res = yield seconds = Time.now - t puts "#{msg} took #{seconds} seconds" -end \ No newline at end of file + 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