class NewRelic::Agent::Samplers::MemorySampler::ProcStatus
A class that samples memory by reading the file /proc/$$/status, which is specific to linux
Public Instance Methods
get_memory()
click to toggle source
Returns the amount of resident memory this process is using in MB
# File lib/new_relic/agent/samplers/memory_sampler.rb, line 142 def get_memory proc_status = File.open(proc_status_file, 'r') { |f| f.read_nonblock(4096).strip } if proc_status =~ /RSS:\s*(\d+) kB/i return $1.to_f / 1024.0 end raise "Unable to find RSS in #{proc_status_file}" end
proc_status_file()
click to toggle source
# File lib/new_relic/agent/samplers/memory_sampler.rb, line 151 def proc_status_file "/proc/#{$$}/status" end
to_s()
click to toggle source
# File lib/new_relic/agent/samplers/memory_sampler.rb, line 155 def to_s "proc status file sampler: #{proc_status_file}" end