class Instrumentation::Memory

Reads RSS memory from the PID specified

Public Class Methods

new(pid) click to toggle source
# File lib/instrumentation/memory.rb, line 4
def initialize(pid)
  @pid = pid
end

Public Instance Methods

read() click to toggle source
# File lib/instrumentation/memory.rb, line 8
def read
  case system
  when :mac_os
    rss_via_ps
  else
    raise "Unknown system #{system.inspect}"
  end
end
rss_via_ps() click to toggle source
# File lib/instrumentation/memory.rb, line 21
def rss_via_ps
  `ps -o rss= -p #{@pid}`.strip.to_i
end
system() click to toggle source
# File lib/instrumentation/memory.rb, line 17
def system
  :mac_os
end