Class: LitmusPaper::Metric::TcpSocketUtilization
- Inherits:
-
SocketUtilization
- Object
- SocketUtilization
- LitmusPaper::Metric::TcpSocketUtilization
- Defined in:
- lib/litmus_paper/metric/tcp_socket_utilization.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
Attributes inherited from SocketUtilization
Instance Method Summary collapse
- #_stats ⇒ Object
-
#initialize(weight, address, maxconn) ⇒ TcpSocketUtilization
constructor
A new instance of TcpSocketUtilization.
- #to_s ⇒ Object
Methods inherited from SocketUtilization
Constructor Details
#initialize(weight, address, maxconn) ⇒ TcpSocketUtilization
Returns a new instance of TcpSocketUtilization.
8 9 10 11 |
# File 'lib/litmus_paper/metric/tcp_socket_utilization.rb', line 8 def initialize(weight, address, maxconn) super(weight, maxconn) @address = address end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
6 7 8 |
# File 'lib/litmus_paper/metric/tcp_socket_utilization.rb', line 6 def address @address end |
Instance Method Details
#_stats ⇒ Object
13 14 15 |
# File 'lib/litmus_paper/metric/tcp_socket_utilization.rb', line 13 def _stats Raindrops::Linux.tcp_listener_stats([address])[address] end |
#to_s ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/litmus_paper/metric/tcp_socket_utilization.rb', line 17 def to_s current_stats = stats active = current_stats[:socket_active] queued = current_stats[:socket_queued] utilization = current_stats[:socket_utilization] "Metric::TcpSocketUtilization(weight: #{weight}, maxconn: #{maxconn}, active: #{active}, queued: #{queued}, utilization: #{utilization}, address: #{address})" end |