8784: Fix test for latest firefox.
[arvados.git] / services / api / test / helpers / time_block.rb
1 class ActiveSupport::TestCase
2   def time_block label
3     t0 = Time.now
4     begin
5       yield
6     ensure
7       t1 = Time.now
8       $stderr.puts "#{t1 - t0}s #{label}"
9     end
10   end
11
12   def vmpeak c
13     open("/proc/self/status").each_line do |line|
14       print "Begin #{c} #{line}" if (line =~ /^VmHWM:/)
15     end
16     n = yield
17     open("/proc/self/status").each_line do |line|
18       print "End #{c} #{line}" if (line =~ /^VmHWM:/)
19     end
20     n
21   end
22
23 end