Class: Oink::Instrumentation::MemorySnapshot

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

Class Method Summary collapse

Class Method Details

.memoryObject



6
7
8
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 6

def self.memory
  memory_snapshot_class.new.memory
end

.memory_snapshot_classObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 10

def self.memory_snapshot_class
  @@memory_snapshot_class ||= begin
    [WindowsMemorySnapshot,
     StatmMemorySnapshot,
     SmapsMemorySnapshot,
     ProcessStatusMemorySnapshot].find { |snapshot_class| snapshot_class.available? }
  end

  raise MemoryDataUnavailableError if @@memory_snapshot_class.nil?
  @@memory_snapshot_class
end