Class: PumaAutoTune::Worker
- Inherits:
-
Object
- Object
- PumaAutoTune::Worker
- Defined in:
- lib/puma_auto_tune/worker.rb
Instance Method Summary collapse
- #get_memory ⇒ Object
-
#initialize(worker) ⇒ Worker
constructor
A new instance of Worker.
- #memory ⇒ Object (also: #mb)
- #pid ⇒ Object
- #restart ⇒ Object
- #restarting? ⇒ Boolean
Constructor Details
#initialize(worker) ⇒ Worker
Returns a new instance of Worker.
4 5 6 |
# File 'lib/puma_auto_tune/worker.rb', line 4 def initialize(worker) @worker = worker end |
Instance Method Details
#get_memory ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/puma_auto_tune/worker.rb', line 13 def get_memory @memory = if restarting? 0 else ::GetProcessMem.new(self.pid).mb end end |
#memory ⇒ Object Also known as: mb
8 9 10 |
# File 'lib/puma_auto_tune/worker.rb', line 8 def memory @memory || get_memory end |
#pid ⇒ Object
31 32 33 |
# File 'lib/puma_auto_tune/worker.rb', line 31 def pid @worker.pid end |
#restart ⇒ Object
26 27 28 29 |
# File 'lib/puma_auto_tune/worker.rb', line 26 def restart @restarting = true @worker.term end |
#restarting? ⇒ Boolean
21 22 23 |
# File 'lib/puma_auto_tune/worker.rb', line 21 def restarting? @restarting end |