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.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
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.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/moro/process.rb', line 8 def initialize() @name=[:name] @file=[:file] if [:tags]!=nil @tags=[:tags] else @tags=[] end update_pid end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/moro/process.rb', line 6 def file @file end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/moro/process.rb', line 6 def name @name end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
6 7 8 |
# File 'lib/moro/process.rb', line 6 def pid @pid end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
6 7 8 |
# File 'lib/moro/process.rb', line 6 def @tags end |
Instance Method Details
#usage ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/moro/process.rb', line 19 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,tags:} else update_pid {name:name,memory:0.0,tags:} end end |