Class: Bounscale::Collector::Throughput

Inherits:
Busyness show all
Defined in:
lib/bounscale/collector/throughput.rb

Constant Summary

Constants inherited from Busyness

Busyness::HISTORY_HOLDING_SEC

Instance Method Summary collapse

Methods inherited from Busyness

clear_history!

Instance Method Details

#nameObject



9
10
11
# File 'lib/bounscale/collector/throughput.rb', line 9

def name
  "throughput"
end

#postObject



6
7
# File 'lib/bounscale/collector/throughput.rb', line 6

def post
end

#preObject



3
4
# File 'lib/bounscale/collector/throughput.rb', line 3

def pre
end

#valueObject



13
14
15
16
17
18
19
# File 'lib/bounscale/collector/throughput.rb', line 13

def value
  #2つ以上のアクセスがないと測定不能なので0を返す
  return 0 if history.length < 2
  
  #リクエスト数 / 全体の時間 がスループット(分あたり換算なので60をかける)
  (history.length.to_f / whole_sec) * 60
end