Class: OneApm::Collector::ShellPoller
- Inherits:
-
Object
- Object
- OneApm::Collector::ShellPoller
- Defined in:
- lib/one_apm/collector/support/shell_poller.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#pid ⇒ Object
Returns the value of attribute pid.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#pid ⇒ Object
Returns the value of attribute pid.
7 8 9 |
# File 'lib/one_apm/collector/support/shell_poller.rb', line 7 def pid @pid end |
Class Method Details
.kb_page_size ⇒ Object
22 23 24 |
# File 'lib/one_apm/collector/support/shell_poller.rb', line 22 def self.kb_page_size @size ||= `getconf PAGE_SIZE`.to_f / 1024.0 rescue 4.0 end |
Instance Method Details
#cpu_utilization ⇒ Object
13 14 15 16 |
# File 'lib/one_apm/collector/support/shell_poller.rb', line 13 def cpu_utilization @pid = Process.pid ps_float('%cpu') / 100.0 end |
#memory ⇒ Object
9 10 11 |
# File 'lib/one_apm/collector/support/shell_poller.rb', line 9 def memory pids.inject(0.0){|m, pid| m + get_memory_by_pid(pid) } end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/one_apm/collector/support/shell_poller.rb', line 18 def to_s "ShellPoller from: ps -p #{pid}" end |