Class: Oink::Instrumentation::WindowsMemorySnapshot
- Inherits:
-
Object
- Object
- Oink::Instrumentation::WindowsMemorySnapshot
- Defined in:
- lib/oink/instrumentation/memory_snapshot.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.available? ⇒ Boolean
40 41 42 |
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 40 def self.available? defined? WIN32OLE end |
Instance Method Details
#memory ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/oink/instrumentation/memory_snapshot.rb', line 30 def memory wmi = WIN32OLE.connect("winmgmts:root/cimv2") mem = 0 query = "select * from Win32_Process where ProcessID = #{$$}" wmi.ExecQuery(query).each do |wproc| mem = wproc.WorkingSetSize end mem.to_i / 1000 end |