Class: Oink::Instrumentation::SmapsMemorySnapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/oink/instrumentation/memory_snapshot.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 80

def self.available?
  File.exist?("/proc/#{$$}/smaps")
end

Instance Method Details

#memoryObject



73
74
75
76
77
78
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 73

def memory
  proc_file = File.new("/proc/#{$$}/smaps")
  proc_file.map do |line|
    size = line[/Size: *(\d+)/, 1] and size.to_i
  end.compact.sum
end