Module: Emissary::OperatorStatistics

Included in:
Operator
Defined in:
lib/emissary/operator.rb

Constant Summary collapse

RX_COUNT_MUTEX =
Mutex.new
TX_COUNT_MUTEX =
Mutex.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rx_countObject (readonly)

Returns the value of attribute rx_count.



25
26
27
# File 'lib/emissary/operator.rb', line 25

def rx_count
  @rx_count
end

#tx_countObject (readonly)

Returns the value of attribute tx_count.



25
26
27
# File 'lib/emissary/operator.rb', line 25

def tx_count
  @tx_count
end

Instance Method Details

#increment_rx_countObject



41
42
43
44
45
# File 'lib/emissary/operator.rb', line 41

def increment_rx_count
  RX_COUNT_MUTEX.synchronize {
    @rx_count = (@rx_count + 1 rescue 1)
  }
end

#increment_tx_countObject



26
27
28
29
30
# File 'lib/emissary/operator.rb', line 26

def increment_tx_count
  TX_COUNT_MUTEX.synchronize {
    @tx_count = (@tx_count + 1 rescue 1)
  }
end