Class: Moro::Process
- Inherits:
-
Object
- Object
- Moro::Process
- Defined in:
- lib/moro/process.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
-
#initialize(options) ⇒ Process
constructor
A new instance of Process.
- #usage ⇒ Object
Constructor Details
#initialize(options) ⇒ Process
Returns a new instance of Process.
7 8 9 10 11 12 |
# File 'lib/moro/process.rb', line 7 def initialize() @logger = Logger.new STDOUT @name=[:name] @file=[:file] update_pid end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/moro/process.rb', line 5 def file @file end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/moro/process.rb', line 5 def name @name end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
5 6 7 |
# File 'lib/moro/process.rb', line 5 def pid @pid end |
Instance Method Details
#usage ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/moro/process.rb', line 14 def usage if pid!=nil pm=GetProcessMem.new(pid) #pid need to change if pm.bytes==0 update_pid end pm=GetProcessMem.new(pid) mem = pm.mb {name:name,memory:mem} else update_pid {name:name,memory:0.0} end end |