Top Level Namespace

Defined Under Namespace

Classes: Archivo, Generador, Libro

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
# File 'lib/helpers.rb', line 3

def print_memory_usage
  memory_before = `ps -o rss= -p #{Process.pid}`.to_i
  yield
  memory_after = `ps -o rss= -p #{Process.pid}`.to_i

  puts "Memoria: #{((memory_after - memory_before) / 1024.0).round(2)} MB"
end


11
12
13
14
15
16
17
# File 'lib/helpers.rb', line 11

def print_time_spent
  time = Benchmark.realtime do
    yield
  end

  puts "Tiempo: #{time.round(2)}"
end