Class: God::System::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/god/system/process.rb

Instance Method Summary collapse

Constructor Details

#initialize(pid) ⇒ Process

Returns a new instance of Process.



5
6
7
8
# File 'lib/god/system/process.rb', line 5

def initialize(pid)
  @pid = pid.to_i
  @poller = fetch_system_poller.new(@pid)
end

Instance Method Details

#exists?Boolean

Return true if this process is running, false otherwise

Returns:

  • (Boolean)


11
12
13
# File 'lib/god/system/process.rb', line 11

def exists?
  !!::Process.kill(0, @pid) rescue false
end

#memoryObject

Memory usage in kilobytes (resident set size)



16
17
18
# File 'lib/god/system/process.rb', line 16

def memory
  @poller.memory
end

#percent_cpuObject

Percentage CPU usage



26
27
28
# File 'lib/god/system/process.rb', line 26

def percent_cpu
  @poller.percent_cpu
end

#percent_memoryObject

Percentage memory usage



21
22
23
# File 'lib/god/system/process.rb', line 21

def percent_memory
  @poller.percent_memory
end