Class: Oink::Instrumentation::SmapsMemorySnapshot
- Inherits:
-
Object
- Object
- Oink::Instrumentation::SmapsMemorySnapshot
- Defined in:
- lib/oink/instrumentation/memory_snapshot.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.available? ⇒ Boolean
81 82 83 |
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 81 def self.available? File.exist?("/proc/#{$$}/smaps") end |
Instance Method Details
#memory ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 73 def memory proc_file = File.new("/proc/#{$$}/smaps") lines = proc_file.lines lines.map do |line| size = line[/Size: *(\d+)/, 1] and size.to_i end.compact.sum end |